#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 /*<<< orphan*/ inkernel_quicksort(float *, int /*<<< orphan*/, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(float *, float *, int);
void filter_c_3d_adaptive_median(float *im, int nz, int ny, int nx, float *res,
                                 int nzr, int nyr, int nxr, int w, int wmax) {
  int nwin = wmax * wmax * wmax;
  float *win = (float *)malloc(nwin * sizeof(float));
  int size_mem_im = nz * ny * nx * sizeof(float);
  int step = ny * nx;
  float smin, smead, smax;
  int edgex, edgey, edgez;
  int wa, nwa;
  int x, y, z, wx, wy, wz, ind, indimz, indy, indz;
  for (wa = w; wa <= wmax; wa += 2) {
    edgex = wa / 2;
    edgey = wa / 2;
    edgez = wa / 2;
    for (z = edgez; z < (nz - edgez); ++z) {
      indimz = step * z;
      for (y = edgey; y < (ny - edgey); ++y) {
        ind = indimz + y * ny;
        for (x = edgex; x < (nx - edgex); ++x) {
          nwa = 0;
          for (wz = 0; wz < wa; ++wz) {
            indz = step * (z + wz - edgez);
            for (wy = 0; wy < wa; ++wy) {
              indy = indz + ny * (y + wy - edgey);
              for (wx = 0; wx < wa; ++wx) {
                win[nwa] = im[indy + x + wx - edgex];
                ++nwa;
              }
            }
          }
          inkernel_quicksort(win, 0, nwa - 1);
          smin = win[0];
          smead = win[nwa / 2];
          smax = win[nwa - 1];
          res[ind + x] = smead;
          if ((smin < smead) && (smead < smax)) {
            if ((smin < im[ind + x]) && (im[ind + x] < smax)) {
              res[ind + x] = im[ind + x];
            } else {
              res[ind + x] = smead;
            }
          } else {
            res[ind + x] = smead;
          }
        }
      }
    }
    if (wa != wmax) {
      memcpy(im, res, size_mem_im);
    }
  }
}


x86 assembly (clang, -O0):
<filter_c_3d_adaptive_median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    0x28(%rbp),%eax
imul   0x28(%rbp),%eax
imul   0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    0x28(%rbp),%eax
jg     14a2 <filter_c_3d_adaptive_median+0x372>
mov    -0x54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
mov    -0x54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x50(%rbp),%ecx
cmp    %ecx,%eax
jge    1473 <filter_c_3d_adaptive_median+0x343>
mov    -0x38(%rbp),%eax
imul   -0x64(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
cmp    %ecx,%eax
jge    1460 <filter_c_3d_adaptive_median+0x330>
mov    -0x78(%rbp),%eax
mov    -0x60(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x74(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x48(%rbp),%ecx
cmp    %ecx,%eax
jge    144d <filter_c_3d_adaptive_median+0x31d>
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1300 <filter_c_3d_adaptive_median+0x1d0>
mov    -0x38(%rbp),%eax
mov    -0x64(%rbp),%ecx
add    -0x70(%rbp),%ecx
sub    -0x50(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x80(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    12ed <filter_c_3d_adaptive_median+0x1bd>
mov    -0x80(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    -0x60(%rbp),%edx
add    -0x6c(%rbp),%edx
sub    -0x4c(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    12da <filter_c_3d_adaptive_median+0x1aa>
mov    -0x8(%rbp),%rax
mov    -0x7c(%rbp),%ecx
add    -0x5c(%rbp),%ecx
add    -0x68(%rbp),%ecx
sub    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x58(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1292 <filter_c_3d_adaptive_median+0x162>
jmp    12df <filter_c_3d_adaptive_median+0x1af>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1268 <filter_c_3d_adaptive_median+0x138>
jmp    12f2 <filter_c_3d_adaptive_median+0x1c2>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1243 <filter_c_3d_adaptive_median+0x113>
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <inkernel_quicksort@plt>
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x58(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x3c(%rbp),%xmm1
movss  -0x40(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1423 <filter_c_3d_adaptive_median+0x2f3>
movss  -0x40(%rbp),%xmm1
movss  -0x44(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1423 <filter_c_3d_adaptive_median+0x2f3>
movss  -0x3c(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    1407 <filter_c_3d_adaptive_median+0x2d7>
mov    -0x8(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x44(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1407 <filter_c_3d_adaptive_median+0x2d7>
mov    -0x8(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    141e <filter_c_3d_adaptive_median+0x2ee>
movss  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    143a <filter_c_3d_adaptive_median+0x30a>
movss  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
add    -0x5c(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    143f <filter_c_3d_adaptive_median+0x30f>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1224 <filter_c_3d_adaptive_median+0xf4>
jmp    1452 <filter_c_3d_adaptive_median+0x322>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    11fe <filter_c_3d_adaptive_median+0xce>
jmp    1465 <filter_c_3d_adaptive_median+0x335>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11dd <filter_c_3d_adaptive_median+0xad>
mov    -0x54(%rbp),%eax
cmp    0x28(%rbp),%eax
je     148f <filter_c_3d_adaptive_median+0x35f>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1040 <memcpy@plt>
jmp    1494 <filter_c_3d_adaptive_median+0x364>
mov    -0x54(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x54(%rbp)
jmp    11a1 <filter_c_3d_adaptive_median+0x71>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_c_3d_adaptive_median>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %r8,%r15
mov    %ecx,0x10(%rsp)
mov    %edx,%ebp
mov    %esi,0x14(%rsp)
mov    %rdi,%rbx
mov    0x1b8(%rsp),%r14d
mov    0x1b0(%rsp),%r12d
mov    %r14d,%edi
imul   %r14d,%edi
imul   %r14d,%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %ebp,%edi
mov    %rax,%rbp
mov    %r12,%rax
cmp    %r14d,%eax
jle    1193 <filter_c_3d_adaptive_median+0x63>
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%ecx
imul   %edi,%ecx
mov    %ecx,%edx
imul   0x14(%rsp),%edx
shl    $0x2,%edx
mov    %edx,0x48(%rsp)
movslq %edi,%rdx
mov    %ecx,0x54(%rsp)
movslq %ecx,%rcx
lea    0x30(%rbp),%rsi
mov    %rsi,0x120(%rsp)
mov    %rcx,0xc8(%rsp)
mov    %ecx,%ecx
mov    %rcx,0xc0(%rsp)
mov    %rdx,0xd0(%rsp)
mov    %edx,%r12d
mov    %edi,0xc(%rsp)
mov    %r15,0xe0(%rsp)
jmp    11f9 <filter_c_3d_adaptive_median+0xc9>
nopl   0x0(%rax)
lea    0x2(%r14),%eax
cmp    %r13d,%eax
jg     1181 <filter_c_3d_adaptive_median+0x51>
mov    %eax,%r14d
mov    %eax,%edx
shr    $0x1f,%edx
mov    %rax,%rcx
add    %eax,%edx
sar    %edx
mov    0x14(%rsp),%eax
sub    %edx,%eax
mov    %edx,0x8(%rsp)
mov    %eax,0x4c(%rsp)
cmp    %eax,%edx
jge    1800 <filter_c_3d_adaptive_median+0x6d0>
mov    %r14d,%eax
and    $0xfffffff8,%eax
add    $0xfffffffffffffff8,%rax
shr    $0x3,%rax
add    $0x1,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x128(%rsp)
and    $0xfffffff8,%ecx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,0x140(%rsp)
shr    $0x3,%rcx
add    $0x1,%rcx
mov    %rcx,0x138(%rsp)
lea    -0x1(%r14),%rdx
mov    %edi,%ecx
mov    0x8(%rsp),%eax
sub    %eax,%ecx
mov    %ecx,0x1c(%rsp)
mov    0x10(%rsp),%ecx
sub    %eax,%ecx
mov    %ecx,0x24(%rsp)
cltq
lea    0x0(,%r14,4),%rcx
add    %rbp,%rcx
mov    %rcx,0x148(%rsp)
lea    (%rbx,%r14,4),%rcx
mov    %rcx,0x150(%rsp)
mov    %r14d,%ecx
and    $0xfffffff8,%ecx
mov    %rcx,0x130(%rsp)
mov    %r14,%rcx
neg    %rcx
mov    %rcx,0x158(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x78(%rsp)
mov    $0x8,%ecx
mov    %rcx,0x70(%rsp)
mov    $0x1,%ecx
mov    %rcx,0x68(%rsp)
movl   $0x0,0x18(%rsp)
mov    %rax,0x80(%rsp)
mov    %rax,0x28(%rsp)
mov    %rdx,0x40(%rsp)
jmp    1324 <filter_c_3d_adaptive_median+0x1f4>
nopl   0x0(%rax)
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
addl   $0x1,0x18(%rsp)
mov    0xc0(%rsp),%rax
add    %rax,0x70(%rsp)
add    %rax,0x78(%rsp)
add    %rax,0x68(%rsp)
mov    %rcx,0x28(%rsp)
cmp    %ecx,0x4c(%rsp)
je     1800 <filter_c_3d_adaptive_median+0x6d0>
mov    0x1c(%rsp),%eax
cmp    %eax,0x8(%rsp)
jge    12f0 <filter_c_3d_adaptive_median+0x1c0>
mov    0xc8(%rsp),%rax
mov    %eax,%ecx
imul   0x18(%rsp),%ecx
mov    %ecx,0x50(%rsp)
mov    0x28(%rsp),%rcx
mov    %rcx,%rsi
imul   %rax,%rsi
mov    %rsi,0xd8(%rsp)
sub    0x8(%rsp),%ecx
mov    %rcx,0xf8(%rsp)
movl   $0x0,0x20(%rsp)
mov    0x68(%rsp),%rax
mov    %rax,0x98(%rsp)
mov    0x78(%rsp),%rax
mov    %rax,0x90(%rsp)
mov    0x70(%rsp),%rax
mov    %rax,0x88(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,0x30(%rsp)
jmp    13d5 <filter_c_3d_adaptive_median+0x2a5>
nop
mov    0x30(%rsp),%rax
add    $0x1,%rax
addl   $0x1,0x20(%rsp)
add    %r12,0x88(%rsp)
add    %r12,0x90(%rsp)
add    %r12,0x98(%rsp)
mov    %rax,0x30(%rsp)
cmp    %eax,0x1c(%rsp)
je     12f0 <filter_c_3d_adaptive_median+0x1c0>
mov    0x24(%rsp),%eax
cmp    %eax,0x8(%rsp)
jge    13a0 <filter_c_3d_adaptive_median+0x270>
mov    0x20(%rsp),%eax
imul   %edi,%eax
add    0x50(%rsp),%eax
mov    %rax,0xe8(%rsp)
mov    0x30(%rsp),%rax
mov    %rax,%rcx
imul   0xd0(%rsp),%rcx
add    0xd8(%rsp),%rcx
mov    %rcx,0xf0(%rsp)
sub    0x8(%rsp),%eax
mov    %rax,0x160(%rsp)
xor    %eax,%eax
mov    %rax,0x38(%rsp)
mov    0x98(%rsp),%rax
mov    %rax,0xb0(%rsp)
mov    0x90(%rsp),%rax
mov    %rax,0xa8(%rsp)
mov    0x88(%rsp),%rax
mov    %rax,0xa0(%rsp)
mov    0x80(%rsp),%rcx
jmp    149f <filter_c_3d_adaptive_median+0x36f>
add    $0x1,%rcx
mov    0x38(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x38(%rsp)
addq   $0x1,0xa0(%rsp)
addq   $0x1,0xa8(%rsp)
addq   $0x1,0xb0(%rsp)
cmp    %ecx,0x24(%rsp)
mov    0xc(%rsp),%edi
mov    0x40(%rsp),%rdx
je     13a0 <filter_c_3d_adaptive_median+0x270>
mov    %rcx,0xb8(%rsp)
mov    $0x0,%r13d
test   %r14d,%r14d
jle    1778 <filter_c_3d_adaptive_median+0x648>
mov    %rdx,%r8
mov    0xe8(%rsp),%rax
mov    0x38(%rsp),%rcx
add    %ecx,%eax
mov    %eax,0x5c(%rsp)
mov    0xb8(%rsp),%rax
sub    0x8(%rsp),%eax
mov    %eax,0x58(%rsp)
xor    %r13d,%r13d
mov    0xb0(%rsp),%rsi
mov    0xa8(%rsp),%r11
mov    0xa0(%rsp),%r15
xor    %edx,%edx
jmp    1540 <filter_c_3d_adaptive_median+0x410>
nopl   0x0(%rax,%rax,1)
mov    %rdx,%r8
mov    0x100(%rsp),%rdx
add    $0x1,%edx
mov    0xc0(%rsp),%rax
mov    0x108(%rsp),%r15
add    %rax,%r15
mov    0x110(%rsp),%r11
add    %rax,%r11
mov    0x118(%rsp),%rsi
add    %rax,%rsi
cmp    %r14d,%edx
je     1770 <filter_c_3d_adaptive_median+0x640>
mov    0x54(%rsp),%eax
mov    %eax,%ecx
imul   %edx,%ecx
add    0x5c(%rsp),%ecx
mov    %ecx,0x60(%rsp)
mov    0xf8(%rsp),%rcx
mov    %rdx,0x100(%rsp)
add    %edx,%ecx
imul   %eax,%ecx
add    0x58(%rsp),%ecx
mov    %ecx,0x64(%rsp)
mov    %rsi,0x118(%rsp)
mov    %r11,0x110(%rsp)
mov    %r15,0x108(%rsp)
xor    %r10d,%r10d
mov    %r8,%rdx
jmp    15a6 <filter_c_3d_adaptive_median+0x476>
xchg   %ax,%ax
add    $0x1,%r10d
add    %r12,%r15
add    %r12,%r11
add    %r12,%rsi
cmp    %r14d,%r10d
je     1500 <filter_c_3d_adaptive_median+0x3d0>
mov    0x160(%rsp),%rax
lea    (%rax,%r10,1),%r8d
imul   %edi,%r8d
add    0x64(%rsp),%r8d
movslq %r13d,%r13
cmp    $0x8,%r14d
jb     1630 <filter_c_3d_adaptive_median+0x500>
mov    %r10d,%eax
imul   %edi,%eax
add    0x60(%rsp),%eax
lea    (%rax,%rdx,1),%ecx
cmp    %eax,%ecx
jl     1630 <filter_c_3d_adaptive_median+0x500>
mov    %rdx,%rcx
shr    $0x20,%rcx
jne    1630 <filter_c_3d_adaptive_median+0x500>
cltq
mov    0x150(%rsp),%rcx
lea    (%rcx,%rax,4),%rcx
lea    0x0(,%r13,4),%rdx
add    %rbp,%rdx
cmp    %rcx,%rdx
jae    16a7 <filter_c_3d_adaptive_median+0x577>
lea    (%rbx,%rax,4),%rax
mov    0x148(%rsp),%rcx
lea    (%rcx,%r13,4),%rcx
cmp    %rcx,%rax
jae    16a7 <filter_c_3d_adaptive_median+0x577>
xor    %r9d,%r9d
mov    0x40(%rsp),%rdx
jmp    1633 <filter_c_3d_adaptive_median+0x503>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r9d,%r9d
test   $0x1,%r14b
jne    1640 <filter_c_3d_adaptive_median+0x510>
mov    %r9,%rax
jmp    165d <filter_c_3d_adaptive_median+0x52d>
xchg   %ax,%ax
add    %r9d,%r8d
movslq %r8d,%rax
movss  (%rbx,%rax,4),%xmm0
movss  %xmm0,0x0(%rbp,%r13,4)
add    $0x1,%r13
mov    %r9,%rax
or     $0x1,%rax
not    %r9
cmp    0x158(%rsp),%r9
je     1590 <filter_c_3d_adaptive_median+0x460>
xchg   %ax,%ax
lea    (%r11,%rax,1),%ecx
movslq %ecx,%rcx
movss  (%rbx,%rcx,4),%xmm0
movss  %xmm0,0x0(%rbp,%r13,4)
lea    (%rsi,%rax,1),%ecx
movslq %ecx,%rcx
movss  (%rbx,%rcx,4),%xmm0
movss  %xmm0,0x4(%rbp,%r13,4)
add    $0x2,%r13
add    $0x2,%rax
cmp    %rax,%r14
jne    1670 <filter_c_3d_adaptive_median+0x540>
jmp    1590 <filter_c_3d_adaptive_median+0x460>
cmpq   $0x0,0x140(%rsp)
je     1758 <filter_c_3d_adaptive_median+0x628>
mov    0x120(%rsp),%rax
lea    (%rax,%r13,4),%rcx
mov    0x128(%rsp),%rdx
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%r11,%rax,1),%edi
movslq %edi,%rdi
movups (%rbx,%rdi,4),%xmm0
movups 0x10(%rbx,%rdi,4),%xmm1
movups %xmm0,-0x30(%rcx,%rax,4)
movups %xmm1,-0x20(%rcx,%rax,4)
lea    (%r15,%rax,1),%edi
movslq %edi,%rdi
movups (%rbx,%rdi,4),%xmm0
movups 0x10(%rbx,%rdi,4),%xmm1
movups %xmm0,-0x10(%rcx,%rax,4)
movups %xmm1,(%rcx,%rax,4)
add    $0x10,%rax
add    $0xfffffffffffffffe,%rdx
jne    16d0 <filter_c_3d_adaptive_median+0x5a0>
testb  $0x1,0x138(%rsp)
01
je     1733 <filter_c_3d_adaptive_median+0x603>
lea    (%rax,%r13,1),%rcx
add    %r8d,%eax
cltq
movups (%rbx,%rax,4),%xmm0
movups 0x10(%rbx,%rax,4),%xmm1
movups %xmm0,0x0(%rbp,%rcx,4)
movups %xmm1,0x10(%rbp,%rcx,4)
mov    0x130(%rsp),%rax
add    %rax,%r13
mov    %rax,%r9
cmp    %r14,%rax
mov    0xc(%rsp),%edi
mov    0x40(%rsp),%rdx
je     1590 <filter_c_3d_adaptive_median+0x460>
jmp    1633 <filter_c_3d_adaptive_median+0x503>
xor    %eax,%eax
testb  $0x1,0x138(%rsp)
01
jne    1717 <filter_c_3d_adaptive_median+0x5e7>
jmp    1733 <filter_c_3d_adaptive_median+0x603>
cs nopw 0x0(%rax,%rax,1)
mov    0xe0(%rsp),%r15
lea    -0x1(%r13),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <inkernel_quicksort@plt>
movss  0x0(%rbp),%xmm0
mov    %r13d,%eax
shr    $0x1f,%eax
add    %r13d,%eax
sar    %eax
cltq
movss  0x0(%rbp,%rax,4),%xmm2
movslq %r13d,%rax
movss  -0x4(%rbp,%rax,4),%xmm1
mov    0xf0(%rsp),%rax
mov    0xb8(%rsp),%rcx
add    %rcx,%rax
movss  %xmm2,(%r15,%rax,4)
ucomiss %xmm0,%xmm2
jbe    1460 <filter_c_3d_adaptive_median+0x330>
ucomiss %xmm2,%xmm1
jbe    1460 <filter_c_3d_adaptive_median+0x330>
movss  (%rbx,%rax,4),%xmm2
ucomiss %xmm0,%xmm2
jbe    1460 <filter_c_3d_adaptive_median+0x330>
ucomiss %xmm2,%xmm1
jbe    1460 <filter_c_3d_adaptive_median+0x330>
movss  %xmm2,(%r15,%rax,4)
jmp    1460 <filter_c_3d_adaptive_median+0x330>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x1b8(%rsp),%r13d
cmp    %r13d,%r14d
je     11f0 <filter_c_3d_adaptive_median+0xc0>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    0x48(%rsp),%edx
call   1040 <memcpy@plt>
mov    0xc(%rsp),%edi
jmp    11f0 <filter_c_3d_adaptive_median+0xc0>

LLVM IR (-O0):
define void @filter_c_3d_adaptive_median(float* %0, i32 %1, i32 %2, i32 %3, float* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca float*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca float*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca float*
%23 = alloca i32
%24 = alloca i32
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
store float* %0, float** %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store float* %4, float** %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%43 = load i32, i32* %20
%44 = load i32, i32* %20
%45 = mul nsw i32 %43, %44
%46 = load i32, i32* %20
%47 = mul nsw i32 %45, %46
store i32 %47, i32* %21
%48 = load i32, i32* %21
%49 = sext i32 %48 to i64
%50 = mul i64 %49, 4
%51 = trunc i64 %50 to i32
%52 = call i64 @malloc(i32 %51)
%53 = inttoptr i64 %52 to float*
store float* %53, float** %22
%54 = load i32, i32* %12
%55 = load i32, i32* %13
%56 = mul nsw i32 %54, %55
%57 = load i32, i32* %14
%58 = mul nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 4
%61 = trunc i64 %60 to i32
store i32 %61, i32* %23
%62 = load i32, i32* %13
%63 = load i32, i32* %14
%64 = mul nsw i32 %62, %63
store i32 %64, i32* %24
%65 = load i32, i32* %19
store i32 %65, i32* %31
br label %66
66: ; preds = %275, %10
%67 = load i32, i32* %31
%68 = load i32, i32* %20
%69 = icmp sle i32 %67, %68
br i1 %69, label %70, label %278
70: ; preds = %66
%71 = load i32, i32* %31
%72 = sdiv i32 %71, 2
store i32 %72, i32* %28
%73 = load i32, i32* %31
%74 = sdiv i32 %73, 2
store i32 %74, i32* %29
%75 = load i32, i32* %31
%76 = sdiv i32 %75, 2
store i32 %76, i32* %30
%77 = load i32, i32* %30
store i32 %77, i32* %35
br label %78
78: ; preds = %262, %70
%79 = load i32, i32* %35
%80 = load i32, i32* %12
%81 = load i32, i32* %30
%82 = sub nsw i32 %80, %81
%83 = icmp slt i32 %79, %82
br i1 %83, label %84, label %265
84: ; preds = %78
%85 = load i32, i32* %24
%86 = load i32, i32* %35
%87 = mul nsw i32 %85, %86
store i32 %87, i32* %40
%88 = load i32, i32* %29
store i32 %88, i32* %34
br label %89
89: ; preds = %258, %84
%90 = load i32, i32* %34
%91 = load i32, i32* %13
%92 = load i32, i32* %29
%93 = sub nsw i32 %91, %92
%94 = icmp slt i32 %90, %93
br i1 %94, label %95, label %261
95: ; preds = %89
%96 = load i32, i32* %40
%97 = load i32, i32* %34
%98 = load i32, i32* %13
%99 = mul nsw i32 %97, %98
%100 = add nsw i32 %96, %99
store i32 %100, i32* %39
%101 = load i32, i32* %28
store i32 %101, i32* %33
br label %102
102: ; preds = %254, %95
%103 = load i32, i32* %33
%104 = load i32, i32* %14
%105 = load i32, i32* %28
%106 = sub nsw i32 %104, %105
%107 = icmp slt i32 %103, %106
br i1 %107, label %108, label %257
108: ; preds = %102
store i32 0, i32* %32
store i32 0, i32* %38
br label %109
109: ; preds = %165, %108
%110 = load i32, i32* %38
%111 = load i32, i32* %31
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %168
113: ; preds = %109
%114 = load i32, i32* %24
%115 = load i32, i32* %35
%116 = load i32, i32* %38
%117 = add nsw i32 %115, %116
%118 = load i32, i32* %30
%119 = sub nsw i32 %117, %118
%120 = mul nsw i32 %114, %119
store i32 %120, i32* %42
store i32 0, i32* %37
br label %121
121: ; preds = %161, %113
%122 = load i32, i32* %37
%123 = load i32, i32* %31
%124 = icmp slt i32 %122, %123
br i1 %124, label %125, label %164
125: ; preds = %121
%126 = load i32, i32* %42
%127 = load i32, i32* %13
%128 = load i32, i32* %34
%129 = load i32, i32* %37
%130 = add nsw i32 %128, %129
%131 = load i32, i32* %29
%132 = sub nsw i32 %130, %131
%133 = mul nsw i32 %127, %132
%134 = add nsw i32 %126, %133
store i32 %134, i32* %41
store i32 0, i32* %36
br label %135
135: ; preds = %157, %125
%136 = load i32, i32* %36
%137 = load i32, i32* %31
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %160
139: ; preds = %135
%140 = load float*, float** %11
%141 = load i32, i32* %41
%142 = load i32, i32* %33
%143 = add nsw i32 %141, %142
%144 = load i32, i32* %36
%145 = add nsw i32 %143, %144
%146 = load i32, i32* %28
%147 = sub nsw i32 %145, %146
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds float, float* %140, i64 %148
%150 = load float, float* %149
%151 = load float*, float** %22
%152 = load i32, i32* %32
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds float, float* %151, i64 %153
store float %150, float* %154
%155 = load i32, i32* %32
%156 = add nsw i32 %155, 1
store i32 %156, i32* %32
br label %157
157: ; preds = %139
%158 = load i32, i32* %36
%159 = add nsw i32 %158, 1
store i32 %159, i32* %36
br label %135
160: ; preds = %135
br label %161
161: ; preds = %160
%162 = load i32, i32* %37
%163 = add nsw i32 %162, 1
store i32 %163, i32* %37
br label %121
164: ; preds = %121
br label %165
165: ; preds = %164
%166 = load i32, i32* %38
%167 = add nsw i32 %166, 1
store i32 %167, i32* %38
br label %109
168: ; preds = %109
%169 = load float*, float** %22
%170 = load i32, i32* %32
%171 = sub nsw i32 %170, 1
%172 = call i32 @inkernel_quicksort(float* %169, i32 0, i32 %171)
%173 = load float*, float** %22
%174 = getelementptr inbounds float, float* %173, i64 0
%175 = load float, float* %174
store float %175, float* %25
%176 = load float*, float** %22
%177 = load i32, i32* %32
%178 = sdiv i32 %177, 2
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds float, float* %176, i64 %179
%181 = load float, float* %180
store float %181, float* %26
%182 = load float*, float** %22
%183 = load i32, i32* %32
%184 = sub nsw i32 %183, 1
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds float, float* %182, i64 %185
%187 = load float, float* %186
store float %187, float* %27
%188 = load float, float* %26
%189 = load float*, float** %15
%190 = load i32, i32* %39
%191 = load i32, i32* %33
%192 = add nsw i32 %190, %191
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds float, float* %189, i64 %193
store float %188, float* %194
%195 = load float, float* %25
%196 = load float, float* %26
%197 = fcmp olt float %195, %196
br i1 %197, label %198, label %245
198: ; preds = %168
%199 = load float, float* %26
%200 = load float, float* %27
%201 = fcmp olt float %199, %200
br i1 %201, label %202, label %245
202: ; preds = %198
%203 = load float, float* %25
%204 = load float*, float** %11
%205 = load i32, i32* %39
%206 = load i32, i32* %33
%207 = add nsw i32 %205, %206
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds float, float* %204, i64 %208
%210 = load float, float* %209
%211 = fcmp olt float %203, %210
br i1 %211, label %212, label %236
212: ; preds = %202
%213 = load float*, float** %11
%214 = load i32, i32* %39
%215 = load i32, i32* %33
%216 = add nsw i32 %214, %215
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds float, float* %213, i64 %217
%219 = load float, float* %218
%220 = load float, float* %27
%221 = fcmp olt float %219, %220
br i1 %221, label %222, label %236
222: ; preds = %212
%223 = load float*, float** %11
%224 = load i32, i32* %39
%225 = load i32, i32* %33
%226 = add nsw i32 %224, %225
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds float, float* %223, i64 %227
%229 = load float, float* %228
%230 = load float*, float** %15
%231 = load i32, i32* %39
%232 = load i32, i32* %33
%233 = add nsw i32 %231, %232
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds float, float* %230, i64 %234
store float %229, float* %235
br label %244
236: ; preds = %212, %202
%237 = load float, float* %26
%238 = load float*, float** %15
%239 = load i32, i32* %39
%240 = load i32, i32* %33
%241 = add nsw i32 %239, %240
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds float, float* %238, i64 %242
store float %237, float* %243
br label %244
244: ; preds = %236, %222
br label %253
245: ; preds = %198, %168
%246 = load float, float* %26
%247 = load float*, float** %15
%248 = load i32, i32* %39
%249 = load i32, i32* %33
%250 = add nsw i32 %248, %249
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds float, float* %247, i64 %251
store float %246, float* %252
br label %253
253: ; preds = %245, %244
br label %254
254: ; preds = %253
%255 = load i32, i32* %33
%256 = add nsw i32 %255, 1
store i32 %256, i32* %33
br label %102
257: ; preds = %102
br label %258
258: ; preds = %257
%259 = load i32, i32* %34
%260 = add nsw i32 %259, 1
store i32 %260, i32* %34
br label %89
261: ; preds = %89
br label %262
262: ; preds = %261
%263 = load i32, i32* %35
%264 = add nsw i32 %263, 1
store i32 %264, i32* %35
br label %78
265: ; preds = %78
%266 = load i32, i32* %31
%267 = load i32, i32* %20
%268 = icmp ne i32 %266, %267
br i1 %268, label %269, label %274
269: ; preds = %265
%270 = load float*, float** %11
%271 = load float*, float** %15
%272 = load i32, i32* %23
%273 = call i32 @memcpy(float* %270, float* %271, i32 %272)
br label %274
274: ; preds = %269, %265
br label %275
275: ; preds = %274
%276 = load i32, i32* %31
%277 = add nsw i32 %276, 2
store i32 %277, i32* %31
br label %66
278: ; preds = %66
ret void
}

LLVM IR (-O2):
define void @filter_c_3d_adaptive_median(float* %0, i32 %1, i32 %2, i32 %3, float* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = shl i32 %9, 2
%12 = mul i32 %11, %9
%13 = mul i32 %12, %9
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to float*
%16 = mul i32 %3, %2
%17 = shl i32 %16, 2
%18 = mul i32 %17, %1
%19 = icmp sgt i32 %8, %9
br i1 %19, label %276, label %20
20: ; preds = %10
%21 = sext i32 %2 to i64
%22 = sext i32 %16 to i64
%23 = mul i32 %3, %2
%24 = mul i32 %3, %2
%25 = mul i32 %3, %2
%26 = mul i32 %3, %2
br label %27
27: ; preds = %20, %273
%28 = phi i32 [ %274, %273 ], [ %8, %20 ]
%29 = zext i32 %28 to i64
%30 = and i32 %28, -8
%31 = zext i32 %30 to i64
%32 = add nsw i64 %31, -8
%33 = lshr exact i64 %32, 3
%34 = add nuw nsw i64 %33, 1
%35 = zext i32 %28 to i64
%36 = zext i32 %28 to i64
%37 = zext i32 %28 to i64
%38 = add nsw i64 %37, -1
%39 = sdiv i32 %28, 2
%40 = sub i32 %1, %39
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %269
42: ; preds = %27
%43 = sub i32 %2, %39
%44 = icmp slt i32 %39, %43
%45 = sub i32 %3, %39
%46 = icmp slt i32 %39, %45
%47 = icmp sgt i32 %28, 0
%48 = sext i32 %39 to i64
%49 = zext i32 %28 to i64
%50 = getelementptr float, float* %15, i64 %36
%51 = getelementptr float, float* %0, i64 %36
%52 = icmp ult i32 %28, 8
%53 = trunc i64 %38 to i32
%54 = icmp ugt i64 %38, 4294967295
%55 = and i64 %35, 4294967288
%56 = and i64 %34, 1
%57 = icmp eq i64 %32, 0
%58 = and i64 %34, 4611686018427387902
%59 = icmp eq i64 %56, 0
%60 = icmp eq i64 %55, %35
%61 = and i64 %29, 1
%62 = icmp eq i64 %61, 0
%63 = sub nsw i64 0, %29
br label %64
64: ; preds = %42, %264
%65 = phi i32 [ 0, %42 ], [ %268, %264 ]
%66 = phi i64 [ %48, %42 ], [ %265, %264 ]
%67 = mul i32 %25, %65
%68 = mul i32 %23, %65
%69 = mul nsw i64 %66, %22
br i1 %44, label %70, label %264
70: ; preds = %64
%71 = trunc i64 %66 to i32
%72 = sub i32 %71, %39
br label %73
73: ; preds = %70, %259
%74 = phi i32 [ 0, %70 ], [ %263, %259 ]
%75 = phi i64 [ %48, %70 ], [ %260, %259 ]
%76 = mul i32 %74, %2
%77 = add i32 %67, %76
%78 = mul i32 %74, %2
%79 = add i32 %68, %78
%80 = mul nsw i64 %75, %21
%81 = add nsw i64 %80, %69
br i1 %46, label %82, label %259
82: ; preds = %73
%83 = trunc i64 %75 to i32
%84 = sub i32 %83, %39
br label %85
85: ; preds = %82, %254
%86 = phi i32 [ 0, %82 ], [ %258, %254 ]
%87 = phi i64 [ %48, %82 ], [ %255, %254 ]
%88 = add i32 %77, %86
%89 = add i32 %79, %86
br i1 %47, label %90, label %230
90: ; preds = %85
%91 = trunc i64 %87 to i32
%92 = sub i32 %91, %39
br label %93
93: ; preds = %225, %90
%94 = phi i64 [ 0, %90 ], [ %222, %225 ]
%95 = phi i32 [ 0, %90 ], [ %226, %225 ]
%96 = mul i32 %26, %95
%97 = add i32 %88, %96
%98 = mul i32 %24, %95
%99 = add i32 %89, %98
%100 = add i32 %72, %95
%101 = mul nsw i32 %100, %16
%102 = add i32 %92, %101
br label %103
103: ; preds = %221, %93
%104 = phi i64 [ %94, %93 ], [ %222, %221 ]
%105 = phi i32 [ 0, %93 ], [ %223, %221 ]
%106 = mul i32 %105, %2
%107 = add i32 %97, %106
%108 = sext i32 %107 to i64
%109 = getelementptr float, float* %0, i64 %108
%110 = getelementptr float, float* %51, i64 %108
%111 = mul i32 %105, %2
%112 = add i32 %99, %111
%113 = add i32 %84, %105
%114 = mul nsw i32 %113, %2
%115 = add i32 %102, %114
%116 = shl i64 %104, 32
%117 = ashr exact i64 %116, 32
br i1 %52, label %183, label %118
118: ; preds = %103
%119 = add i32 %112, %53
%120 = icmp slt i32 %119, %112
%121 = or i1 %120, %54
br i1 %121, label %183, label %122
122: ; preds = %118
%123 = getelementptr float, float* %15, i64 %117
%124 = getelementptr float, float* %50, i64 %117
%125 = icmp ult float* %123, %110
%126 = icmp ult float* %109, %124
%127 = and i1 %125, %126
br i1 %127, label %183, label %128
128: ; preds = %122
%129 = add nsw i64 %117, %55
br i1 %57, label %165, label %130
130: ; preds = %128, %130
%131 = phi i64 [ %162, %130 ], [ 0, %128 ]
%132 = phi i64 [ %163, %130 ], [ 0, %128 ]
%133 = add i64 %117, %131
%134 = trunc i64 %131 to i32
%135 = add i32 %115, %134
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds float, float* %0, i64 %136
%138 = bitcast float* %137 to <4 x float>*
%139 = load <4 x float>, <4 x float>* %138
%140 = getelementptr inbounds float, float* %137, i64 4
%141 = bitcast float* %140 to <4 x float>*
%142 = load <4 x float>, <4 x float>* %141
%143 = getelementptr inbounds float, float* %15, i64 %133
%144 = bitcast float* %143 to <4 x float>*
store <4 x float> %139, <4 x float>* %144
%145 = getelementptr inbounds float, float* %143, i64 4
%146 = bitcast float* %145 to <4 x float>*
store <4 x float> %142, <4 x float>* %146
%147 = or i64 %131, 8
%148 = add i64 %117, %147
%149 = trunc i64 %147 to i32
%150 = add i32 %115, %149
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds float, float* %0, i64 %151
%153 = bitcast float* %152 to <4 x float>*
%154 = load <4 x float>, <4 x float>* %153
%155 = getelementptr inbounds float, float* %152, i64 4
%156 = bitcast float* %155 to <4 x float>*
%157 = load <4 x float>, <4 x float>* %156
%158 = getelementptr inbounds float, float* %15, i64 %148
%159 = bitcast float* %158 to <4 x float>*
store <4 x float> %154, <4 x float>* %159
%160 = getelementptr inbounds float, float* %158, i64 4
%161 = bitcast float* %160 to <4 x float>*
store <4 x float> %157, <4 x float>* %161
%162 = add nuw i64 %131, 16
%163 = add i64 %132, 2
%164 = icmp eq i64 %163, %58
br i1 %164, label %165, label %130
165: ; preds = %130, %128
%166 = phi i64 [ 0, %128 ], [ %162, %130 ]
br i1 %59, label %182, label %167
167: ; preds = %165
%168 = add i64 %117, %166
%169 = trunc i64 %166 to i32
%170 = add i32 %115, %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds float, float* %0, i64 %171
%173 = bitcast float* %172 to <4 x float>*
%174 = load <4 x float>, <4 x float>* %173
%175 = getelementptr inbounds float, float* %172, i64 4
%176 = bitcast float* %175 to <4 x float>*
%177 = load <4 x float>, <4 x float>* %176
%178 = getelementptr inbounds float, float* %15, i64 %168
%179 = bitcast float* %178 to <4 x float>*
store <4 x float> %174, <4 x float>* %179
%180 = getelementptr inbounds float, float* %178, i64 4
%181 = bitcast float* %180 to <4 x float>*
store <4 x float> %177, <4 x float>* %181
br label %182
182: ; preds = %165, %167
br i1 %60, label %221, label %183
183: ; preds = %122, %118, %103, %182
%184 = phi i64 [ 0, %122 ], [ 0, %118 ], [ 0, %103 ], [ %55, %182 ]
%185 = phi i64 [ %117, %122 ], [ %117, %118 ], [ %117, %103 ], [ %129, %182 ]
%186 = xor i64 %184, -1
br i1 %62, label %196, label %187
187: ; preds = %183
%188 = trunc i64 %184 to i32
%189 = add i32 %115, %188
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds float, float* %0, i64 %190
%192 = load float, float* %191
%193 = getelementptr inbounds float, float* %15, i64 %185
store float %192, float* %193
%194 = add nsw i64 %185, 1
%195 = or i64 %184, 1
br label %196
196: ; preds = %187, %183
%197 = phi i64 [ undef, %183 ], [ %194, %187 ]
%198 = phi i64 [ %184, %183 ], [ %195, %187 ]
%199 = phi i64 [ %185, %183 ], [ %194, %187 ]
%200 = icmp eq i64 %186, %63
br i1 %200, label %221, label %201
201: ; preds = %196, %201
%202 = phi i64 [ %219, %201 ], [ %198, %196 ]
%203 = phi i64 [ %218, %201 ], [ %199, %196 ]
%204 = trunc i64 %202 to i32
%205 = add i32 %115, %204
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds float, float* %0, i64 %206
%208 = load float, float* %207
%209 = getelementptr inbounds float, float* %15, i64 %203
store float %208, float* %209
%210 = add nsw i64 %203, 1
%211 = trunc i64 %202 to i32
%212 = add i32 %211, 1
%213 = add i32 %115, %212
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds float, float* %0, i64 %214
%216 = load float, float* %215
%217 = getelementptr inbounds float, float* %15, i64 %210
store float %216, float* %217
%218 = add nsw i64 %203, 2
%219 = add nuw nsw i64 %202, 2
%220 = icmp eq i64 %219, %49
br i1 %220, label %221, label %201
221: ; preds = %196, %201, %182
%222 = phi i64 [ %129, %182 ], [ %197, %196 ], [ %218, %201 ]
%223 = add nuw nsw i32 %105, 1
%224 = icmp eq i32 %223, %28
br i1 %224, label %225, label %103
225: ; preds = %221
%226 = add nuw nsw i32 %95, 1
%227 = icmp eq i32 %226, %28
br i1 %227, label %228, label %93
228: ; preds = %225
%229 = trunc i64 %222 to i32
br label %230
230: ; preds = %228, %85
%231 = phi i32 [ 0, %85 ], [ %229, %228 ]
%232 = add nsw i32 %231, -1
%233 = tail call i32 @inkernel_quicksort(float* %15, i32 0, i32 %232)
%234 = load float, float* %15
%235 = sdiv i32 %231, 2
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds float, float* %15, i64 %236
%238 = load float, float* %237
%239 = sext i32 %232 to i64
%240 = getelementptr inbounds float, float* %15, i64 %239
%241 = load float, float* %240
%242 = add nsw i64 %81, %87
%243 = getelementptr inbounds float, float* %4, i64 %242
store float %238, float* %243
%244 = fcmp olt float %234, %238
%245 = fcmp olt float %238, %241
%246 = select i1 %244, i1 %245, i1 false
br i1 %246, label %247, label %254
247: ; preds = %230
%248 = getelementptr inbounds float, float* %0, i64 %242
%249 = load float, float* %248
%250 = fcmp olt float %234, %249
%251 = fcmp olt float %249, %241
%252 = select i1 %250, i1 %251, i1 false
br i1 %252, label %253, label %254
253: ; preds = %247
store float %249, float* %243
br label %254
254: ; preds = %230, %247, %253
%255 = add nsw i64 %87, 1
%256 = trunc i64 %255 to i32
%257 = icmp eq i32 %45, %256
%258 = add i32 %86, 1
br i1 %257, label %259, label %85
259: ; preds = %254, %73
%260 = add nsw i64 %75, 1
%261 = trunc i64 %260 to i32
%262 = icmp eq i32 %43, %261
%263 = add i32 %74, 1
br i1 %262, label %264, label %73
264: ; preds = %259, %64
%265 = add nsw i64 %66, 1
%266 = trunc i64 %265 to i32
%267 = icmp eq i32 %40, %266
%268 = add i32 %65, 1
br i1 %267, label %269, label %64
269: ; preds = %264, %27
%270 = icmp eq i32 %28, %9
br i1 %270, label %273, label %271
271: ; preds = %269
%272 = tail call i32 @memcpy(float* %0, float* %4, i32 %18)
br label %273
273: ; preds = %269, %271
%274 = add nsw i32 %28, 2
%275 = icmp sgt i32 %274, %9
br i1 %275, label %276, label %27
276: ; preds = %273, %10
ret void
}