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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int UCHAR_MAX;
double UINT_MAX;
int const _p3dHuangYagerThresholding_yager(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_8(unsigned char *in_im, unsigned char *out_im,
                                const int dimx, const int dimy, const int dimz,
                                unsigned char *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((UCHAR_MAX + 1), sizeof(double))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((S = (double *)malloc(sizeof(double) * (UCHAR_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((Sbar = (double *)malloc(sizeof(double) * (UCHAR_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((W = (double *)malloc(sizeof(double) * (UCHAR_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((Wbar = (double *)malloc(sizeof(double) * (UCHAR_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((F = (double *)malloc(sizeof(double) * (UCHAR_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 <= UCHAR_MAX; i++) {
    S[i] = S[i - 1] + hist[i];
    W[i] = i * hist[i] + W[i - 1];
  }
  Sbar[UCHAR_MAX] = 0;
  Wbar[UCHAR_MAX] = 0;
  for (i = (UCHAR_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 < UCHAR_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_yager(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 >= UCHAR_MAX)
    end = (UCHAR_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 char)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 0;
}


x86 assembly (clang, -O0):
<p3dHuangYagerThresholding_8>:
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_8+0x59>
mov    $0x0,%al
call   1080 <p3dResetStartTime@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   *0x10(%rbp)
mov    0x2e20(%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_8+0x82>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
mov    0x2df7(%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_8+0xae>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
mov    0x2dcb(%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_8+0xda>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
mov    0x2d9f(%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_8+0x106>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
mov    0x2d73(%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_8+0x132>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
mov    0x2d47(%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_8+0x15e>
jmp    1957 <p3dHuangYagerThresholding_8+0x7e7>
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_8+0x1cd>
mov    -0x58(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0xa0(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
movsd  0xd04(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0xa0(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    12d8 <p3dHuangYagerThresholding_8+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    0x2c81(%rip),%rcx
cmp    (%rcx),%eax
jg     1405 <p3dHuangYagerThresholding_8+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_8+0x1f2>
mov    -0x40(%rbp),%rax
mov    0x2be0(%rip),%rcx
movslq (%rcx),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
mov    0x2bca(%rip),%rcx
movslq (%rcx),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x2bb8(%rip),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
jl     14ed <p3dHuangYagerThresholding_8+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_8+0x2d3>
movl   $0x1,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    0x2aec(%rip),%rcx
cmp    (%rcx),%eax
jge    16cb <p3dHuangYagerThresholding_8+0x55b>
mov    -0x58(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1534 <p3dHuangYagerThresholding_8+0x3c4>
jp     1534 <p3dHuangYagerThresholding_8+0x3c4>
jmp    16b7 <p3dHuangYagerThresholding_8+0x547>
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    155c <p3dHuangYagerThresholding_8+0x3ec>
jp     155c <p3dHuangYagerThresholding_8+0x3ec>
jmp    16b7 <p3dHuangYagerThresholding_8+0x547>
mov    -0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1584 <p3dHuangYagerThresholding_8+0x414>
jp     1584 <p3dHuangYagerThresholding_8+0x414>
jmp    16b7 <p3dHuangYagerThresholding_8+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   1050 <_p3dHuangYagerThresholding_yager@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_8+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_8+0x507>
mov    -0x88(%rbp),%eax
mov    %eax,-0x8c(%rbp)
jmp    16b2 <p3dHuangYagerThresholding_8+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_8+0x53d>
mov    -0x88(%rbp),%eax
mov    %eax,-0x8c(%rbp)
jmp    16b2 <p3dHuangYagerThresholding_8+0x542>
jmp    16b7 <p3dHuangYagerThresholding_8+0x547>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    14f7 <p3dHuangYagerThresholding_8+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_8+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    0x2899(%rip),%rcx
cmp    (%rcx),%eax
jl     1771 <p3dHuangYagerThresholding_8+0x601>
mov    0x288a(%rip),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2868(%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_8+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_8+0x698>
mov    -0x84(%rbp),%eax
mov    %eax,-0x88(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    180d <p3dHuangYagerThresholding_8+0x69d>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    178d <p3dHuangYagerThresholding_8+0x61d>
mov    -0x88(%rbp),%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%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    18bb <p3dHuangYagerThresholding_8+0x74b>
mov    -0x10(%rbp),%rax
movslq -0xa0(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
jle    1884 <p3dHuangYagerThresholding_8+0x714>
mov    0x2779(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
jmp    1891 <p3dHuangYagerThresholding_8+0x721>
xor    %eax,%eax
mov    %eax,-0xa4(%rbp)
jmp    1891 <p3dHuangYagerThresholding_8+0x721>
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    1839 <p3dHuangYagerThresholding_8+0x6c9>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,0x10(%rbp)
je     194b <p3dHuangYagerThresholding_8+0x7db>
mov    0x10(%rbp),%rcx
mov    -0x30(%rbp),%rax
movzbl (%rax),%esi
lea    0x745(%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   1040 <p3dGetElapsedTime_sec@plt>
mov    -0xb4(%rbp),%esi
mov    -0xb0(%rbp),%rcx
mov    %eax,%edx
lea    0x727(%rip),%rdi
mov    $0x0,%al
call   *%rcx
movl   $0x2,-0x4(%rbp)
jmp    19ab <p3dHuangYagerThresholding_8+0x83b>
cmpq   $0x0,0x10(%rbp)
je     196e <p3dHuangYagerThresholding_8+0x7fe>
lea    0x73b(%rip),%rdi
mov    $0x0,%al
call   *0x10(%rbp)
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p3dHuangYagerThresholding_8>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,0x50(%rsp)
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%r13d
mov    %rsi,0x58(%rsp)
mov    %rdi,0x48(%rsp)
mov    0xa0(%rsp),%rbx
test   %rbx,%rbx
je     11b5 <p3dHuangYagerThresholding_8+0x45>
xor    %eax,%eax
call   1080 <p3dResetStartTime@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   *%rbx
mov    0x2e34(%rip),%rbp
mov    0x0(%rbp),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     12a3 <p3dHuangYagerThresholding_8+0x133>
mov    0x0(%rbp),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12a5 <p3dHuangYagerThresholding_8+0x135>
mov    %rax,0x28(%rsp)
mov    0x0(%rbp),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12ae <p3dHuangYagerThresholding_8+0x13e>
mov    %rax,%rbx
mov    0x0(%rbp),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x40(%rsp)
test   %rax,%rax
je     12b2 <p3dHuangYagerThresholding_8+0x142>
mov    0x0(%rbp),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     12b6 <p3dHuangYagerThresholding_8+0x146>
mov    0x0(%rbp),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12c0 <p3dHuangYagerThresholding_8+0x150>
mov    %rax,%r8
imul   %r13d,%r15d
imul   %r12d,%r15d
mov    %r15d,%r9d
test   %r15d,%r15d
mov    0x50(%rsp),%r13
mov    0x40(%rsp),%rbp
mov    %rbx,%r12
mov    0x28(%rsp),%rbx
mov    0x48(%rsp),%r10
jle    13dd <p3dHuangYagerThresholding_8+0x26d>
lea    -0x1(%r9),%rcx
mov    %r9d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    1326 <p3dHuangYagerThresholding_8+0x1b6>
xor    %ecx,%ecx
jmp    13a0 <p3dHuangYagerThresholding_8+0x230>
jmp    12ca <p3dHuangYagerThresholding_8+0x15a>
xor    %eax,%eax
mov    %rax,0x28(%rsp)
jmp    12ca <p3dHuangYagerThresholding_8+0x15a>
xor    %ebx,%ebx
jmp    12ca <p3dHuangYagerThresholding_8+0x15a>
xor    %ebp,%ebp
jmp    12ca <p3dHuangYagerThresholding_8+0x15a>
xor    %r15d,%r15d
mov    0x40(%rsp),%rbp
jmp    12ca <p3dHuangYagerThresholding_8+0x15a>
mov    0x40(%rsp),%rbp
mov    0x8(%rsp),%r15
mov    0xa0(%rsp),%rcx
test   %rcx,%rcx
je     12e2 <p3dHuangYagerThresholding_8+0x172>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   *%rcx
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r9d,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
movsd  0xcca(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
movzbl (%r10,%rcx,1),%esi
movsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
movzbl 0x1(%r10,%rcx,1),%esi
movsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
movzbl 0x2(%r10,%rcx,1),%esi
movsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
movzbl 0x3(%r10,%rcx,1),%esi
movsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    1340 <p3dHuangYagerThresholding_8+0x1d0>
test   %rax,%rax
je     13dd <p3dHuangYagerThresholding_8+0x26d>
add    %r10,%rcx
xor    %edx,%edx
movsd  0xc4e(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rcx,%rdx,1),%esi
movsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    13c0 <p3dHuangYagerThresholding_8+0x250>
movsd  (%r14),%xmm0
movsd  %xmm0,(%rbx)
movq   $0x0,0x0(%rbp)
mov    0x2bfb(%rip),%rax
movslq (%rax),%rsi
test   %rsi,%rsi
mov    %r8,0x30(%rsp)
jle    1468 <p3dHuangYagerThresholding_8+0x2f8>
mov    %esi,%edi
lea    0x1(%rdi),%rax
lea    0x8(,%rdi,8),%rcx
add    %rbp,%rcx
cmp    %rcx,%rbx
jae    1491 <p3dHuangYagerThresholding_8+0x321>
lea    (%rbx,%rdi,8),%rcx
add    $0x8,%rcx
cmp    %rcx,%rbp
jae    1491 <p3dHuangYagerThresholding_8+0x321>
mov    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
movsd  -0x8(%rbx,%rcx,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  (%r14,%rcx,8),%xmm0
addsd  -0x8(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1430 <p3dHuangYagerThresholding_8+0x2c0>
jmp    153d <p3dHuangYagerThresholding_8+0x3cd>
movq   $0x0,(%r12,%rsi,8)
mov    0x8(%rsp),%rax
movq   $0x0,(%rax,%rsi,8)
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
jmp    19b8 <p3dHuangYagerThresholding_8+0x848>
mov    %eax,%edx
movsd  (%rbx),%xmm0
movsd  0x0(%rbp),%xmm1
add    $0xffffffffffffffff,%rax
mov    $0x1,%ecx
cmp    $0x2,%edx
je     1517 <p3dHuangYagerThresholding_8+0x3a7>
mov    %rdi,%r11
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
mov    $0x1,%ecx
nopl   0x0(%rax)
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm2,%xmm2
cvtsi2sd %ecx,%xmm2
mulsd  (%r14,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x0(%rbp,%rcx,8)
addsd  0x8(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
lea    0x1(%rcx),%rdi
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
mulsd  0x8(%r14,%rcx,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rbp,%rcx,8)
add    $0x2,%rcx
cmp    %rdx,%rdi
jne    14c0 <p3dHuangYagerThresholding_8+0x350>
mov    %r11,%rdi
test   $0x1,%al
je     153d <p3dHuangYagerThresholding_8+0x3cd>
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  (%r14,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%rbp,%rcx,8)
movq   $0x0,(%r12,%rsi,8)
mov    0x8(%rsp),%rax
movq   $0x0,(%rax,%rsi,8)
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
test   %esi,%esi
jle    19b8 <p3dHuangYagerThresholding_8+0x848>
cmp    $0x1,%esi
mov    %r9,0x10(%rsp)
jne    1580 <p3dHuangYagerThresholding_8+0x410>
mov    %rdi,%rax
mov    0x8(%rsp),%r10
jmp    1860 <p3dHuangYagerThresholding_8+0x6f0>
lea    -0x1(%rdi),%r10
lea    -0x1(%rsi),%r9d
mov    $0x8,%edx
mov    %r10,%rax
mul    %rdx
seto   %dl
cmp    %r10d,%r9d
jb     1d26 <p3dHuangYagerThresholding_8+0xbb6>
mov    %rdi,0x18(%rsp)
mov    %r10,%rdi
shr    $0x20,%rdi
jne    1849 <p3dHuangYagerThresholding_8+0x6d9>
lea    (%r12,%r9,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1849 <p3dHuangYagerThresholding_8+0x6d9>
test   %dl,%dl
jne    1849 <p3dHuangYagerThresholding_8+0x6d9>
mov    0x8(%rsp),%rcx
lea    (%rcx,%r9,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1849 <p3dHuangYagerThresholding_8+0x6d9>
test   %dl,%dl
mov    0x18(%rsp),%rcx
jne    1d1e <p3dHuangYagerThresholding_8+0xbae>
lea    (%r12,%rcx,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1849 <p3dHuangYagerThresholding_8+0x6d9>
test   %dl,%dl
jne    1849 <p3dHuangYagerThresholding_8+0x6d9>
mov    0x18(%rsp),%rcx
lea    (%r14,%rcx,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1849 <p3dHuangYagerThresholding_8+0x6d9>
test   %dl,%dl
jne    1849 <p3dHuangYagerThresholding_8+0x6d9>
mov    0x8(%rsp),%rcx
mov    0x18(%rsp),%rdi
lea    (%rcx,%rdi,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1849 <p3dHuangYagerThresholding_8+0x6d9>
test   %dl,%dl
jne    1849 <p3dHuangYagerThresholding_8+0x6d9>
mov    %r10,0x60(%rsp)
mov    %r15d,0x3c(%rsp)
lea    0x1(%r9),%rax
mov    0x18(%rsp),%rbx
sub    %rbx,%rax
lea    (%r12,%rax,8),%rdi
lea    (%r12,%r9,8),%r8
add    $0x8,%r8
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,8),%rdx
lea    0x8(%rcx,%r9,8),%rax
lea    0x8(%r12),%r9
lea    0x8(%r12,%rbx,8),%r11
lea    0x8(%r14),%r15
lea    (%r14,%rbx,8),%r10
add    $0x8,%r10
lea    (%rcx,%rbx,8),%rbx
add    $0x8,%rbx
cmp    %rax,%rdi
setb   0x7(%rsp)
cmp    %r8,%rdx
setb   0x27(%rsp)
cmp    %r11,%rdi
setb   0x26(%rsp)
cmp    %r8,%r9
setb   0x25(%rsp)
cmp    %r10,%rdi
setb   0x22(%rsp)
cmp    %r8,%r15
setb   0x23(%rsp)
cmp    %rbx,%rdi
lea    0x8(%rcx),%rdi
setb   0x24(%rsp)
cmp    %r8,%rdi
setb   0x21(%rsp)
cmp    %r11,%rdx
setb   %r8b
cmp    %rax,%r9
setb   %r9b
cmp    %r10,%rdx
setb   %r10b
cmp    %rax,%r15
setb   %cl
cmp    %rbx,%rdx
setb   %dl
cmp    %rax,%rdi
setb   %bl
mov    0x27(%rsp),%al
test   %al,0x7(%rsp)
jne    1d2e <p3dHuangYagerThresholding_8+0xbbe>
mov    %bl,0x7(%rsp)
mov    %ecx,%edi
mov    0x24(%rsp),%al
mov    0x25(%rsp),%cl
and    %cl,0x26(%rsp)
jne    1d2e <p3dHuangYagerThresholding_8+0xbbe>
mov    %r9d,%ebx
mov    0x22(%rsp),%cl
and    0x23(%rsp),%cl
mov    0x10(%rsp),%r9
mov    0x3c(%rsp),%r15d
mov    $0xffffffff,%r11d
mov    0x18(%rsp),%rcx
jne    1d07 <p3dHuangYagerThresholding_8+0xb97>
and    0x21(%rsp),%al
jne    1d07 <p3dHuangYagerThresholding_8+0xb97>
and    %bl,%r8b
jne    1d07 <p3dHuangYagerThresholding_8+0xb97>
and    %dil,%r10b
mov    0x28(%rsp),%rbx
mov    0x30(%rsp),%r8
jne    1bee <p3dHuangYagerThresholding_8+0xa7e>
and    0x7(%rsp),%dl
jne    1bee <p3dHuangYagerThresholding_8+0xa7e>
mov    %ecx,%r15d
and    $0xfffffffe,%r15d
mov    %ecx,%eax
and    $0x1,%eax
movd   %esi,%xmm0
pshufd $0x50,%xmm0,%xmm0
paddd  0x87d(%rip),%xmm0
mov    %r15,%rdx
neg    %rdx
mov    0x8(%rsp),%r10
mov    0x60(%rsp),%rbx
lea    (%r10,%rbx,8),%r11
mov    %rcx,%r9
lea    (%r14,%rbx,8),%rdi
lea    (%r12,%rbx,8),%r8
mov    $0xffffffff,%ecx
add    %r9,%rcx
xor    %r9d,%r9d
movdqa 0x85b(%rip),%xmm1
lea    (%rcx,%r9,1),%r13d
movupd (%r8,%r9,8),%xmm2
movupd (%rdi,%r9,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,-0x8(%r12,%r13,8)
movupd (%r11,%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    17d5 <p3dHuangYagerThresholding_8+0x665>
cmp    0x18(%rsp),%r15
mov    0x50(%rsp),%r13
mov    0x28(%rsp),%rbx
mov    0x30(%rsp),%r8
mov    0x10(%rsp),%r9
mov    0x3c(%rsp),%r15d
mov    $0xffffffff,%r11d
jne    1860 <p3dHuangYagerThresholding_8+0x6f0>
jmp    189a <p3dHuangYagerThresholding_8+0x72a>
mov    0x18(%rsp),%rax
mov    0x8(%rsp),%r10
mov    0x10(%rsp),%r9
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rax),%rcx
movsd  (%r12,%rax,8),%xmm0
addsd  (%r14,%rax,8),%xmm0
mov    %ecx,%edx
movsd  %xmm0,(%r12,%rdx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%r14,%rax,8),%xmm0
addsd  (%r10,%rax,8),%xmm0
movsd  %xmm0,(%r10,%rdx,8)
cmp    $0x1,%rax
mov    %rcx,%rax
ja     1860 <p3dHuangYagerThresholding_8+0x6f0>
cmp    $0x2,%esi
mov    0x48(%rsp),%r10
jl     19b8 <p3dHuangYagerThresholding_8+0x848>
xorpd  %xmm2,%xmm2
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
jmp    18f7 <p3dHuangYagerThresholding_8+0x787>
movapd %xmm0,%xmm5
mov    %ebp,%r11d
mov    0x28(%rsp),%rbx
mov    0x10(%rsp),%r9
mov    0x48(%rsp),%r10
xorpd  %xmm2,%xmm2
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    0x2705(%rip),%rax
movslq (%rax),%rsi
cmp    %rsi,%rbp
jge    19b8 <p3dHuangYagerThresholding_8+0x848>
movsd  (%r14,%rbp,8),%xmm0
ucomisd %xmm2,%xmm0
jne    1905 <p3dHuangYagerThresholding_8+0x795>
jnp    18e0 <p3dHuangYagerThresholding_8+0x770>
movsd  (%rbx,%rbp,8),%xmm1
ucomisd %xmm2,%xmm1
jne    1912 <p3dHuangYagerThresholding_8+0x7a2>
jnp    18e0 <p3dHuangYagerThresholding_8+0x770>
movsd  (%r12,%rbp,8),%xmm0
ucomisd %xmm2,%xmm0
jne    1920 <p3dHuangYagerThresholding_8+0x7b0>
jnp    18e0 <p3dHuangYagerThresholding_8+0x770>
mov    0x40(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm2
divsd  %xmm1,%xmm2
movsd  0x6d2(%rip),%xmm3
addsd  %xmm3,%xmm2
cvttsd2si %xmm2,%edi
mov    0x8(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
cvttsd2si %xmm1,%esi
mov    %ebp,%edx
movsd  %xmm5,0x50(%rsp)
mov    %r11d,%ebx
call   1050 <_p3dHuangYagerThresholding_yager@plt>
mov    0x30(%rsp),%r8
cltd
idiv   %r15d
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,(%r8,%rbp,8)
movapd %xmm1,%xmm0
maxsd  0x50(%rsp),%xmm0
test   %ebx,%ebx
js     18bd <p3dHuangYagerThresholding_8+0x74d>
mov    %ebx,%r11d
mov    %ebx,%eax
movsd  (%r8,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
mov    0x10(%rsp),%r9
mov    0x48(%rsp),%r10
movapd %xmm0,%xmm5
jbe    19ae <p3dHuangYagerThresholding_8+0x83e>
mov    %ebp,%r11d
mov    0x28(%rsp),%rbx
jmp    18d3 <p3dHuangYagerThresholding_8+0x763>
movslq %r11d,%rax
movsd  (%r8,%rax,8),%xmm0
subsd  %xmm0,%xmm5
mulsd  0x643(%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    1a09 <p3dHuangYagerThresholding_8+0x899>
mov    %ebp,%edx
jmp    1ab3 <p3dHuangYagerThresholding_8+0x943>
mov    0x25d0(%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    1a2b <p3dHuangYagerThresholding_8+0x8bb>
jmp    1a54 <p3dHuangYagerThresholding_8+0x8e4>
movsd  -0x8(%r14,%rcx,8),%xmm1
addsd  (%r14,%rcx,8),%xmm1
addsd  0x8(%r14,%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     1ab3 <p3dHuangYagerThresholding_8+0x943>
nopl   0x0(%rax)
movsd  (%r14,%rcx,8),%xmm1
movsd  -0x8(%r14,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
lea    0x1(%rcx),%rsi
mov    %esi,%edx
addsd  (%r14,%rdx,8),%xmm2
ucomisd %xmm2,%xmm0
mov    %ecx,%edx
cmovbe %ebp,%edx
addsd  0x8(%r14,%rcx,8),%xmm1
add    $0x2,%rcx
mov    %ecx,%edi
addsd  (%r14,%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    1a60 <p3dHuangYagerThresholding_8+0x8f0>
mov    %dl,0x0(%r13)
test   %r15d,%r15d
mov    0x40(%rsp),%rbp
mov    0x58(%rsp),%rdi
jle    1c3a <p3dHuangYagerThresholding_8+0xaca>
xor    %eax,%eax
cmp    %dl,(%r10)
jbe    1ada <p3dHuangYagerThresholding_8+0x96a>
mov    0x2518(%rip),%rax
mov    (%rax),%eax
mov    %al,(%rdi)
cmp    $0x1,%r15d
je     1c3a <p3dHuangYagerThresholding_8+0xaca>
lea    -0x1(%r9),%r11
mov    $0x1,%eax
cmp    $0x8,%r11
jb     1c08 <p3dHuangYagerThresholding_8+0xa98>
lea    0x1(%rdi),%rcx
lea    (%rdi,%r9,1),%rbp
lea    0x1(%r10),%rsi
cmp    %r13,%rdi
mov    %r9,%rdx
setb   %r9b
cmp    %r13,%rbp
mov    %r10,%rdi
seta   %r10b
mov    %rdx,%rbx
add    %rdi,%rdx
cmp    %rdx,%rcx
setb   %dl
cmp    %rbp,%rsi
setb   %sil
mov    0x24bd(%rip),%r8
lea    0x4(%r8),%rdi
cmp    %rdi,%rcx
setb   %cl
cmp    %r8,%rbp
seta   %r8b
test   %r10b,%r9b
jne    1bf6 <p3dHuangYagerThresholding_8+0xa86>
and    %sil,%dl
mov    0x40(%rsp),%rbp
jne    1bfb <p3dHuangYagerThresholding_8+0xa8b>
and    %r8b,%cl
mov    0x58(%rsp),%rdi
mov    %rbx,%r9
mov    0x48(%rsp),%r10
jne    1c08 <p3dHuangYagerThresholding_8+0xa98>
mov    %r11,%rdx
and    $0xfffffffffffffff8,%rdx
lea    0x1(%rdx),%rax
movzbl 0x0(%r13),%ecx
movd   %ecx,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
mov    0x245b(%rip),%rcx
movd   (%rcx),%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x0,%xmm1,%xmm1
xor    %esi,%esi
movd   0x1(%r10,%rsi,1),%xmm2
movd   0x5(%r10,%rsi,1),%xmm3
movdqa %xmm2,%xmm4
pminub %xmm0,%xmm4
pcmpeqb %xmm2,%xmm4
movdqa %xmm3,%xmm2
pminub %xmm0,%xmm2
pcmpeqb %xmm3,%xmm2
pandn  %xmm1,%xmm4
pandn  %xmm1,%xmm2
movd   %xmm4,0x1(%rdi,%rsi,1)
movd   %xmm2,0x5(%rdi,%rsi,1)
add    $0x8,%rsi
cmp    %rsi,%rdx
jne    1ba4 <p3dHuangYagerThresholding_8+0xa34>
cmp    %rdx,%r11
jne    1c08 <p3dHuangYagerThresholding_8+0xa98>
jmp    1c3a <p3dHuangYagerThresholding_8+0xaca>
mov    %rcx,%rax
jmp    1576 <p3dHuangYagerThresholding_8+0x406>
mov    0x40(%rsp),%rbp
mov    0x58(%rsp),%rdi
mov    %rbx,%r9
mov    0x48(%rsp),%r10
mov    %rax,%rcx
not    %rcx
test   $0x1,%r9b
jne    1c31 <p3dHuangYagerThresholding_8+0xac1>
mov    (%r10,%rax,1),%dl
xor    %esi,%esi
cmp    0x0(%r13),%dl
jbe    1c29 <p3dHuangYagerThresholding_8+0xab9>
mov    0x23c9(%rip),%rdx
mov    (%rdx),%esi
mov    %sil,(%rdi,%rax,1)
add    $0x1,%rax
add    %r9,%rcx
jne    1cd2 <p3dHuangYagerThresholding_8+0xb62>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    $0x2,%ebx
mov    0xa0(%rsp),%r14
test   %r14,%r14
je     1315 <p3dHuangYagerThresholding_8+0x1a5>
movzbl 0x0(%r13),%esi
lea    0x3e9(%rip),%rdi
xor    %eax,%eax
call   *%r14
xor    %eax,%eax
call   1070 <p3dGetElapsedTime_min@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <p3dGetElapsedTime_sec@plt>
lea    0x3e8(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   *%r14
jmp    1315 <p3dHuangYagerThresholding_8+0x1a5>
nopl   0x0(%rax)
mov    %sil,0x1(%rdi,%rax,1)
add    $0x2,%rax
cmp    %rax,%r9
je     1c3a <p3dHuangYagerThresholding_8+0xaca>
movzbl (%r10,%rax,1),%ecx
xor    %esi,%esi
mov    $0x0,%edx
cmp    0x0(%r13),%cl
jbe    1ced <p3dHuangYagerThresholding_8+0xb7d>
mov    0x2305(%rip),%rcx
mov    (%rcx),%edx
mov    %dl,(%rdi,%rax,1)
movzbl 0x1(%r10,%rax,1),%ecx
cmp    0x0(%r13),%cl
jbe    1cc0 <p3dHuangYagerThresholding_8+0xb50>
mov    0x22ed(%rip),%rcx
mov    (%rcx),%esi
jmp    1cc0 <p3dHuangYagerThresholding_8+0xb50>
mov    %rcx,%rax
mov    0x8(%rsp),%r10
mov    0x28(%rsp),%rbx
mov    0x30(%rsp),%r8
jmp    1860 <p3dHuangYagerThresholding_8+0x6f0>
mov    %rcx,%rax
jmp    184e <p3dHuangYagerThresholding_8+0x6de>
mov    %rdi,%rax
jmp    184e <p3dHuangYagerThresholding_8+0x6de>
mov    0x18(%rsp),%rax
mov    0x8(%rsp),%r10
mov    0x28(%rsp),%rbx
mov    0x30(%rsp),%r8
mov    0x10(%rsp),%r9
mov    0x3c(%rsp),%r15d
mov    $0xffffffff,%r11d
jmp    1860 <p3dHuangYagerThresholding_8+0x6f0>

LLVM IR (-O0):
@.str = [59 x i8] c"Pore3D - Thresholding image according to Huang's method...\00"
@UCHAR_MAX = global i32 0
@UINT_MAX = global double 0.000000e+00
@.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_8(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i8* %5, i32 (i8*, ...)* %6, i32 (i32, ...)* %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%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 i8* %0, i8** %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i8* %5, i8** %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* @UCHAR_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 %476
49: ; preds = %42
%50 = load i32, i32* @UCHAR_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 %476
59: ; preds = %49
%60 = load i32, i32* @UCHAR_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 %476
69: ; preds = %59
%70 = load i32, i32* @UCHAR_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 %476
79: ; preds = %69
%80 = load i32, i32* @UCHAR_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 %476
89: ; preds = %79
%90 = load i32, i32* @UCHAR_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 %476
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 i8*, i8** %10
%111 = load i32, i32* %35
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
%114 = load i8, i8* %113
%115 = zext i8 %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 i8*, i8** %10
%121 = load i32, i32* %35
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
%124 = load i8, i8* %123
%125 = zext i8 %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* @UCHAR_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* @UCHAR_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* @UCHAR_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* @UCHAR_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* @UCHAR_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_yager(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* @UCHAR_MAX
%373 = icmp sge i32 %371, %372
br i1 %373, label %374, label %377
374: ; preds = %365
%375 = load i32, i32* @UCHAR_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 i8
%417 = load i8*, i8** %15
store i8 %416, i8* %417
store i32 0, i32* %35
br label %418
418: ; preds = %447, %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 %450
426: ; preds = %418
%427 = load i8*, i8** %10
%428 = load i32, i32* %35
%429 = sext i32 %428 to i64
%430 = getelementptr inbounds i8, i8* %427, i64 %429
%431 = load i8, i8* %430
%432 = zext i8 %431 to i32
%433 = load i8*, i8** %15
%434 = load i8, i8* %433
%435 = zext i8 %434 to i32
%436 = icmp sgt i32 %432, %435
br i1 %436, label %437, label %439
437: ; preds = %426
%438 = load i32, i32* @UCHAR_MAX
br label %440
439: ; preds = %426
br label %440
440: ; preds = %439, %437
%441 = phi i32 [ %438, %437 ], [ 0, %439 ]
%442 = trunc i32 %441 to i8
%443 = load i8*, i8** %11
%444 = load i32, i32* %35
%445 = sext i32 %444 to i64
%446 = getelementptr inbounds i8, i8* %443, i64 %445
store i8 %442, i8* %446
br label %447
447: ; preds = %440
%448 = load i32, i32* %35
%449 = add nsw i32 %448, 1
store i32 %449, i32* %35
br label %418
450: ; preds = %418
%451 = load double*, double** %22
%452 = call i32 @free(double* %451)
%453 = load double*, double** %18
%454 = call i32 @free(double* %453)
%455 = load double*, double** %19
%456 = call i32 @free(double* %455)
%457 = load double*, double** %20
%458 = call i32 @free(double* %457)
%459 = load double*, double** %21
%460 = call i32 @free(double* %459)
%461 = load double*, double** %23
%462 = call i32 @free(double* %461)
%463 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%464 = icmp ne i32 (i8*, ...)* %463, null
br i1 %464, label %465, label %475
465: ; preds = %450
%466 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%467 = load i8*, i8** %15
%468 = load i8, i8* %467
%469 = zext i8 %468 to i32
%470 = call i32 (i8*, ...) %466(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %469)
%471 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%472 = call i32 (...) @p3dGetElapsedTime_min()
%473 = call i32 (...) @p3dGetElapsedTime_sec()
%474 = call i32 (i8*, ...) %471(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %472, i32 %473)
br label %475
475: ; preds = %465, %450
store i32 2, i32* %9
br label %495
476: ; preds = %98, %88, %78, %68, %58, %48
%477 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%478 = icmp ne i32 (i8*, ...)* %477, null
br i1 %478, label %479, label %482
479: ; preds = %476
%480 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%481 = call i32 (i8*, ...) %480(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
br label %482
482: ; preds = %479, %476
%483 = load double*, double** %22
%484 = call i32 @free(double* %483)
%485 = load double*, double** %18
%486 = call i32 @free(double* %485)
%487 = load double*, double** %19
%488 = call i32 @free(double* %487)
%489 = load double*, double** %20
%490 = call i32 @free(double* %489)
%491 = load double*, double** %21
%492 = call i32 @free(double* %491)
%493 = load double*, double** %23
%494 = call i32 @free(double* %493)
store i32 0, i32* %9
br label %495
495: ; preds = %482, %475
%496 = load i32, i32* %9
ret i32 %496
}

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