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

/* Forward declarations */

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

/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ gaussian_blur(int *, int *, int *, int, int, double);
scalar_t__ malloc(int);
int /*<<< orphan*/ shift_cmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int *,
                             int, int, int, int, int);
int motion_detect(int16_t *prev, int16_t *next, int w, int h, double sd,
                  int shift, char maxx, char maxy, char *mx, char *my,
                  float *conf) {
  int x, y;
  int i;
  float tmpf;
  int *dif, *difb, *difw, *tmp, *difa;
  dif = (int *)malloc(w * h * sizeof(int));
  difb = (int *)malloc(w * h * sizeof(int));
  difw = (int *)malloc(w * h * sizeof(int));
  tmp = (int *)malloc(w * h * sizeof(int));
  difa = (int *)malloc(w * h * sizeof(int));
  if ((!dif) || (!difb) || (!difw) || (!tmp) || (!difa))
    return 1;
  for (i = 0; i < w * h; i++)
    mx[i] = 0;
  for (i = 0; i < w * h; i++)
    my[i] = 0;
  for (i = 0; i < w * h; i++)
    difw[i] = 0x7FFFFFFF;
  for (i = 0; i < w * h; i++)
    difa[i] = 0;
  for (y = -maxy; y <= maxy; y++) {
    for (x = -maxx; x <= maxx; x++) {
      shift_cmp(prev, next, dif, w, h, x, y, shift);
      gaussian_blur(dif, difb, tmp, w, h, sd);
      for (i = 0; i < w * h; i++) {
        difa[i] += difb[i] >> 8;
        if (difb[i] < difw[i]) {
          mx[i] = x;
          my[i] = y;
          difw[i] = difb[i];
        }
      }
    }
  }
  for (i = 0; i < w * h; i++) {
    if (difw[i] == 0) {
      conf[i] = 1.0;
    } else {
      tmpf = difw[i];
      tmpf = tmpf * (2 * maxx + 1) * (2 * maxy + 1);
      tmpf = tmpf * 0.0039;
      tmpf = tmpf / ((float)difa[i]);
      if (tmpf < 0.0)
        tmpf = 0.0;
      conf[i] = 1.0 - tmpf;
    }
  }
  free(difa);
  free(tmp);
  free(difw);
  free(difb);
  free(dif);
  return 0;
}


x86 assembly (clang, -O0):
<motion_detect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %r9b,%al
mov    0x28(%rbp),%r9
mov    0x20(%rbp),%r9
mov    0x18(%rbp),%r9
mov    0x10(%rbp),%r9b
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %al,-0x2d(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1227 <motion_detect+0xe7>
cmpq   $0x0,-0x50(%rbp)
je     1227 <motion_detect+0xe7>
cmpq   $0x0,-0x58(%rbp)
je     1227 <motion_detect+0xe7>
cmpq   $0x0,-0x60(%rbp)
je     1227 <motion_detect+0xe7>
cmpq   $0x0,-0x68(%rbp)
jne    1233 <motion_detect+0xf3>
movl   $0x1,-0x4(%rbp)
jmp    158a <motion_detect+0x44a>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1266 <motion_detect+0x126>
mov    0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    123a <motion_detect+0xfa>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1299 <motion_detect+0x159>
mov    0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    126d <motion_detect+0x12d>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    12cf <motion_detect+0x18f>
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movl   $0x7fffffff,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a0 <motion_detect+0x160>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1305 <motion_detect+0x1c5>
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12d6 <motion_detect+0x196>
movsbl 0x10(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
movsbl 0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     1441 <motion_detect+0x301>
movsbl -0x2d(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
movsbl -0x2d(%rbp),%ecx
cmp    %ecx,%eax
jg     142e <motion_detect+0x2ee>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    -0x38(%rbp),%r10d
mov    -0x2c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <shift_cmp@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
movsd  -0x28(%rbp),%xmm0
call   1050 <gaussian_blur@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    141b <motion_detect+0x2db>
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
sar    $0x8,%edx
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x58(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1408 <motion_detect+0x2c8>
mov    -0x34(%rbp),%eax
mov    %al,%dl
mov    0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
mov    %al,%dl
mov    0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    140d <motion_detect+0x2cd>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1388 <motion_detect+0x248>
jmp    1420 <motion_detect+0x2e0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    132a <motion_detect+0x1ea>
jmp    1433 <motion_detect+0x2f3>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1310 <motion_detect+0x1d0>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1556 <motion_detect+0x416>
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1486 <motion_detect+0x346>
mov    0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  0xb94(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1543 <motion_detect+0x403>
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
movsbl -0x2d(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movsbl 0x10(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb29(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    151d <motion_detect+0x3dd>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xada(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1548 <motion_detect+0x408>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1448 <motion_detect+0x308>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<motion_detect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,0x10(%rsp)
mov    %r8,0x70(%rsp)
movsd  %xmm0,0x68(%rsp)
mov    %rsi,0x60(%rsp)
mov    %rdi,0x58(%rsp)
mov    %ecx,0x2c(%rsp)
mov    %ecx,%eax
mov    %edx,0x14(%rsp)
imul   %edx,%eax
mov    %rax,0x8(%rsp)
lea    0x0(,%rax,4),%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    $0x1,%eax
mov    %r14,0x40(%rsp)
test   %r14,%r14
je     1570 <motion_detect+0x420>
test   %rbx,%rbx
je     1570 <motion_detect+0x420>
test   %r15,%r15
je     1570 <motion_detect+0x420>
cmpq   $0x0,0x18(%rsp)
je     1570 <motion_detect+0x420>
test   %r13,%r13
je     1570 <motion_detect+0x420>
mov    0xc0(%rsp),%rbp
mov    0xb8(%rsp),%rdi
mov    0xb0(%rsp),%r12b
mov    0x8(%rsp),%rax
mov    %eax,%r14d
test   %eax,%eax
jle    1382 <motion_detect+0x232>
xor    %r12d,%r12d
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <memset@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <memset@plt>
cmpl   $0x8,0x8(%rsp)
jb     1350 <motion_detect+0x200>
mov    %r14d,%r12d
and    $0xfffffff8,%r12d
lea    -0x8(%r12),%rdx
mov    %rdx,%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x38,%rdx
jae    1275 <motion_detect+0x125>
xor    %edx,%edx
jmp    1315 <motion_detect+0x1c5>
and    $0xfffffffffffffff8,%rcx
xor    %edx,%edx
movaps 0xd7e(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups %xmm0,(%r15,%rdx,4)
movups %xmm0,0x10(%r15,%rdx,4)
movups %xmm0,0x20(%r15,%rdx,4)
movups %xmm0,0x30(%r15,%rdx,4)
movups %xmm0,0x40(%r15,%rdx,4)
movups %xmm0,0x50(%r15,%rdx,4)
movups %xmm0,0x60(%r15,%rdx,4)
movups %xmm0,0x70(%r15,%rdx,4)
movups %xmm0,0x80(%r15,%rdx,4)
movups %xmm0,0x90(%r15,%rdx,4)
movups %xmm0,0xa0(%r15,%rdx,4)
movups %xmm0,0xb0(%r15,%rdx,4)
movups %xmm0,0xc0(%r15,%rdx,4)
movups %xmm0,0xd0(%r15,%rdx,4)
movups %xmm0,0xe0(%r15,%rdx,4)
movups %xmm0,0xf0(%r15,%rdx,4)
add    $0x40,%rdx
add    $0xfffffffffffffff8,%rcx
jne    1290 <motion_detect+0x140>
test   %rax,%rax
je     1342 <motion_detect+0x1f2>
lea    (%r15,%rdx,4),%rcx
add    $0x10,%rcx
shl    $0x5,%rax
xor    %edx,%edx
movaps 0xcd1(%rip),%xmm0
nop
movups %xmm0,-0x10(%rcx,%rdx,1)
movups %xmm0,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rax
jne    1330 <motion_detect+0x1e0>
cmp    %r14,%r12
je     1361 <motion_detect+0x211>
nopw   0x0(%rax,%rax,1)
movl   $0x7fffffff,(%r15,%r12,4)
7f
add    $0x1,%r12
cmp    %r12,%r14
jne    1350 <motion_detect+0x200>
cmpl   $0x0,0x8(%rsp)
mov    0xb0(%rsp),%r12b
jle    1382 <motion_detect+0x232>
lea    0x0(,%r14,4),%rdx
mov    %r13,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movsbl %r12b,%ecx
movsbl 0x10(%rsp),%eax
mov    %rax,0x30(%rsp)
mov    %rcx,%rax
mov    %rcx,0x38(%rsp)
test   %cl,%cl
js     14a2 <motion_detect+0x352>
mov    0x30(%rsp),%rax
mov    %eax,%ecx
neg    %ecx
mov    %ecx,0x20(%rsp)
cmovns %ecx,%eax
mov    %eax,0x28(%rsp)
mov    0x38(%rsp),%rax
mov    %eax,%ebp
neg    %ebp
cmovns %ebp,%eax
mov    %eax,0x24(%rsp)
mov    %r13,0x50(%rsp)
mov    %r14,0x48(%rsp)
jmp    13df <motion_detect+0x28f>
lea    0x1(%rbp),%eax
cmp    0x24(%rsp),%ebp
mov    %eax,%ebp
je     14a2 <motion_detect+0x352>
cmpb   $0x0,0x10(%rsp)
js     13d0 <motion_detect+0x280>
mov    0x20(%rsp),%eax
mov    %eax,%r12d
jmp    13ff <motion_detect+0x2af>
nop
lea    0x1(%r12),%eax
cmp    0x28(%rsp),%r12d
mov    %eax,%r12d
je     13d0 <motion_detect+0x280>
mov    0x58(%rsp),%rdi
mov    0x60(%rsp),%rsi
mov    0x40(%rsp),%r13
mov    %r13,%rdx
mov    0x14(%rsp),%ecx
mov    0x2c(%rsp),%r14d
mov    %r14d,%r8d
mov    %r12d,%r9d
push   0x70(%rsp)
push   %rbp
call   1040 <shift_cmp@plt>
add    $0x10,%rsp
mov    %r13,%rdi
mov    0x50(%rsp),%r13
mov    %rbx,%rsi
mov    0x18(%rsp),%rdx
mov    0x14(%rsp),%ecx
mov    %r14d,%r8d
mov    0x48(%rsp),%r14
movsd  0x68(%rsp),%xmm0
call   1060 <gaussian_blur@plt>
mov    0xb8(%rsp),%rsi
mov    0xc0(%rsp),%rdx
cmpl   $0x0,0x8(%rsp)
jle    13f0 <motion_detect+0x2a0>
xor    %eax,%eax
jmp    147d <motion_detect+0x32d>
add    $0x1,%rax
cmp    %rax,%r14
je     13f0 <motion_detect+0x2a0>
mov    (%rbx,%rax,4),%ecx
sar    $0x8,%ecx
add    %ecx,0x0(%r13,%rax,4)
mov    (%rbx,%rax,4),%ecx
cmp    (%r15,%rax,4),%ecx
jge    1470 <motion_detect+0x320>
mov    %r12b,(%rsi,%rax,1)
mov    %bpl,(%rdx,%rax,1)
mov    (%rbx,%rax,4),%ecx
mov    %ecx,(%r15,%rax,4)
jmp    1470 <motion_detect+0x320>
cmpl   $0x0,0x8(%rsp)
jle    1542 <motion_detect+0x3f2>
mov    0x30(%rsp),%rax
add    %eax,%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x38(%rsp),%rax
add    %eax,%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
mov    0xc8(%rsp),%rax
xor    %ecx,%ecx
movss  0xb32(%rip),%xmm2
movsd  0xb32(%rip),%xmm3
jmp    14fe <motion_detect+0x3ae>
nopl   0x0(%rax,%rax,1)
movss  %xmm4,(%rax,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r14
je     1542 <motion_detect+0x3f2>
mov    (%r15,%rcx,4),%edx
movaps %xmm2,%xmm4
test   %edx,%edx
je     14f0 <motion_detect+0x3a0>
xorps  %xmm4,%xmm4
cvtsi2ss %edx,%xmm4
mulss  %xmm0,%xmm4
mulss  %xmm1,%xmm4
cvtss2sd %xmm4,%xmm4
mulsd  %xmm3,%xmm4
cvtsd2ss %xmm4,%xmm4
xorps  %xmm5,%xmm5
cvtsi2ssl 0x0(%r13,%rcx,4),%xmm5
divss  %xmm5,%xmm4
xorps  %xmm5,%xmm5
maxss  %xmm4,%xmm5
movaps %xmm2,%xmm4
subss  %xmm5,%xmm4
jmp    14f0 <motion_detect+0x3a0>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @motion_detect(i32* %0, i32* %1, i32 %2, i32 %3, double %4, i32 %5, i8 signext %6, i8 signext %7, i8* nocapture writeonly %8, i8* nocapture writeonly %9, float* nocapture writeonly %10) {
%12 = mul nsw i32 %3, %2
%13 = shl i32 %12, 2
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
%16 = tail call i64 @malloc(i32 %13)
%17 = inttoptr i64 %16 to i32*
%18 = tail call i64 @malloc(i32 %13)
%19 = inttoptr i64 %18 to i32*
%20 = tail call i64 @malloc(i32 %13)
%21 = inttoptr i64 %20 to i32*
%22 = tail call i64 @malloc(i32 %13)
%23 = inttoptr i64 %22 to i32*
%24 = inttoptr i64 %22 to i8*
%25 = icmp ne i64 %14, 0
%26 = icmp ne i64 %16, 0
%27 = select i1 %25, i1 %26, i1 false
%28 = icmp ne i64 %18, 0
%29 = select i1 %27, i1 %28, i1 false
%30 = icmp ne i64 %20, 0
%31 = select i1 %29, i1 %30, i1 false
%32 = icmp ne i64 %22, 0
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %34, label %207
34: ; preds = %11
%35 = icmp sgt i32 %12, 0
br i1 %35, label %36, label %121
36: ; preds = %34
%37 = zext i32 %12 to i64
%38 = zext i32 %12 to i64
%39 = zext i32 %12 to i64
%40 = icmp ult i32 %12, 8
br i1 %40, label %110, label %41
41: ; preds = %36
%42 = and i64 %39, 4294967288
%43 = add nsw i64 %42, -8
%44 = lshr exact i64 %43, 3
%45 = add nuw nsw i64 %44, 1
%46 = and i64 %45, 7
%47 = icmp ult i64 %43, 56
br i1 %47, label %95, label %48
48: ; preds = %41
%49 = and i64 %45, 4611686018427387896
br label %50
50: ; preds = %50, %48
%51 = phi i64 [ 0, %48 ], [ %92, %50 ]
%52 = phi i64 [ 0, %48 ], [ %93, %50 ]
%53 = getelementptr inbounds i32, i32* %19, i64 %51
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %54
%55 = getelementptr inbounds i32, i32* %53, i64 4
%56 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %56
%57 = or i64 %51, 8
%58 = getelementptr inbounds i32, i32* %19, i64 %57
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %59
%60 = getelementptr inbounds i32, i32* %58, i64 4
%61 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %61
%62 = or i64 %51, 16
%63 = getelementptr inbounds i32, i32* %19, i64 %62
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %64
%65 = getelementptr inbounds i32, i32* %63, i64 4
%66 = bitcast i32* %65 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %66
%67 = or i64 %51, 24
%68 = getelementptr inbounds i32, i32* %19, i64 %67
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %69
%70 = getelementptr inbounds i32, i32* %68, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %71
%72 = or i64 %51, 32
%73 = getelementptr inbounds i32, i32* %19, i64 %72
%74 = bitcast i32* %73 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %74
%75 = getelementptr inbounds i32, i32* %73, i64 4
%76 = bitcast i32* %75 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %76
%77 = or i64 %51, 40
%78 = getelementptr inbounds i32, i32* %19, i64 %77
%79 = bitcast i32* %78 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %79
%80 = getelementptr inbounds i32, i32* %78, i64 4
%81 = bitcast i32* %80 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %81
%82 = or i64 %51, 48
%83 = getelementptr inbounds i32, i32* %19, i64 %82
%84 = bitcast i32* %83 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %84
%85 = getelementptr inbounds i32, i32* %83, i64 4
%86 = bitcast i32* %85 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %86
%87 = or i64 %51, 56
%88 = getelementptr inbounds i32, i32* %19, i64 %87
%89 = bitcast i32* %88 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %89
%90 = getelementptr inbounds i32, i32* %88, i64 4
%91 = bitcast i32* %90 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %91
%92 = add nuw i64 %51, 64
%93 = add nuw i64 %52, 8
%94 = icmp eq i64 %93, %49
br i1 %94, label %95, label %50
95: ; preds = %50, %41
%96 = phi i64 [ 0, %41 ], [ %92, %50 ]
%97 = icmp eq i64 %46, 0
br i1 %97, label %108, label %98
98: ; preds = %95, %98
%99 = phi i64 [ %105, %98 ], [ %96, %95 ]
%100 = phi i64 [ %106, %98 ], [ 0, %95 ]
%101 = getelementptr inbounds i32, i32* %19, i64 %99
%102 = bitcast i32* %101 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %102
%103 = getelementptr inbounds i32, i32* %101, i64 4
%104 = bitcast i32* %103 to <4 x i32>*
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, <4 x i32>* %104
%105 = add nuw i64 %99, 8
%106 = add i64 %100, 1
%107 = icmp eq i64 %106, %46
br i1 %107, label %108, label %98
108: ; preds = %98, %95
%109 = icmp eq i64 %42, %39
br i1 %109, label %112, label %110
110: ; preds = %36, %108
%111 = phi i64 [ 0, %36 ], [ %42, %108 ]
br label %116
112: ; preds = %116, %108
br i1 %35, label %113, label %121
113: ; preds = %112
%114 = zext i32 %12 to i64
%115 = shl nuw nsw i64 %114, 2
br label %121
116: ; preds = %110, %116
%117 = phi i64 [ %119, %116 ], [ %111, %110 ]
%118 = getelementptr inbounds i32, i32* %19, i64 %117
store i32 2147483647, i32* %118
%119 = add nuw nsw i64 %117, 1
%120 = icmp eq i64 %119, %39
br i1 %120, label %112, label %116
121: ; preds = %34, %113, %112
%122 = sext i8 %7 to i32
%123 = icmp slt i8 %7, 0
br i1 %123, label %132, label %124
124: ; preds = %121
%125 = sub nsw i32 0, %122
%126 = sext i8 %6 to i32
%127 = sub nsw i32 0, %126
%128 = icmp slt i8 %6, 0
%129 = call i32 @llvm.abs.i32(i32 %126, i1 true)
%130 = call i32 @llvm.abs.i32(i32 %122, i1 true)
%131 = zext i32 %12 to i64
br label %142
132: ; preds = %174, %121
br i1 %35, label %133, label %201
133: ; preds = %132
%134 = sext i8 %6 to i32
%135 = shl nsw i32 %134, 1
%136 = or i32 %135, 1
%137 = sitofp i32 %136 to float
%138 = shl nsw i32 %122, 1
%139 = or i32 %138, 1
%140 = sitofp i32 %139 to float
%141 = zext i32 %12 to i64
br label %177
142: ; preds = %124, %174
%143 = phi i32 [ %125, %124 ], [ %175, %174 ]
br i1 %128, label %174, label %144
144: ; preds = %142
%145 = trunc i32 %143 to i8
br label %146
146: ; preds = %144, %171
%147 = phi i32 [ %127, %144 ], [ %172, %171 ]
%148 = tail call i32 @shift_cmp(i32* %0, i32* %1, i32* %15, i32 %2, i32 %3, i32 %147, i32 %143, i32 %5)
%149 = tail call i32 @gaussian_blur(i32* %15, i32* %17, i32* %21, i32 %2, i32 %3, double %4)
br i1 %35, label %150, label %171
150: ; preds = %146
%151 = trunc i32 %147 to i8
br label %152
152: ; preds = %150, %168
%153 = phi i64 [ 0, %150 ], [ %169, %168 ]
%154 = getelementptr inbounds i32, i32* %17, i64 %153
%155 = load i32, i32* %154
%156 = ashr i32 %155, 8
%157 = getelementptr inbounds i32, i32* %23, i64 %153
%158 = load i32, i32* %157
%159 = add nsw i32 %158, %156
store i32 %159, i32* %157
%160 = load i32, i32* %154
%161 = getelementptr inbounds i32, i32* %19, i64 %153
%162 = load i32, i32* %161
%163 = icmp slt i32 %160, %162
br i1 %163, label %164, label %168
164: ; preds = %152
%165 = getelementptr inbounds i8, i8* %8, i64 %153
store i8 %151, i8* %165
%166 = getelementptr inbounds i8, i8* %9, i64 %153
store i8 %145, i8* %166
%167 = load i32, i32* %154
store i32 %167, i32* %161
br label %168
168: ; preds = %152, %164
%169 = add nuw nsw i64 %153, 1
%170 = icmp eq i64 %169, %131
br i1 %170, label %171, label %152
171: ; preds = %168, %146
%172 = add nsw i32 %147, 1
%173 = icmp eq i32 %147, %129
br i1 %173, label %174, label %146
174: ; preds = %171, %142
%175 = add nsw i32 %143, 1
%176 = icmp eq i32 %143, %130
br i1 %176, label %132, label %142
177: ; preds = %133, %196
%178 = phi i64 [ 0, %133 ], [ %199, %196 ]
%179 = getelementptr inbounds i32, i32* %19, i64 %178
%180 = load i32, i32* %179
%181 = icmp eq i32 %180, 0
br i1 %181, label %196, label %182
182: ; preds = %177
%183 = sitofp i32 %180 to float
%184 = fmul float %137, %183
%185 = fmul float %184, %140
%186 = fpext float %185 to double
%187 = fmul double %186, 3.900000e-03
%188 = fptrunc double %187 to float
%189 = getelementptr inbounds i32, i32* %23, i64 %178
%190 = load i32, i32* %189
%191 = sitofp i32 %190 to float
%192 = fdiv float %188, %191
%193 = fcmp olt float %192, 0.000000e+00
%194 = select i1 %193, float 0.000000e+00, float %192
%195 = fsub float 1.000000e+00, %194
br label %196
196: ; preds = %177, %182
%197 = phi float [ %195, %182 ], [ 1.000000e+00, %177 ]
%198 = getelementptr inbounds float, float* %10, i64 %178
store float %197, float* %198
%199 = add nuw nsw i64 %178, 1
%200 = icmp eq i64 %199, %141
br i1 %200, label %201, label %177
201: ; preds = %196, %132
%202 = tail call i32 @free(i32* %23)
%203 = tail call i32 @free(i32* %21)
%204 = tail call i32 @free(i32* %19)
%205 = tail call i32 @free(i32* %17)
%206 = tail call i32 @free(i32* %15)
br label %207
207: ; preds = %11, %201
%208 = phi i32 [ 0, %201 ], [ 1, %11 ]
ret i32 %208
}