void aan_perona_malik(float *red_input, float *green_input, float *blue_input,
                      float *red_output, float *green_output,
                      float *blue_output, int width, int height, float dt,
                      float dh, float lambda, int Niters) {
  int i, j, iter;
  float *red = (float *)malloc(sizeof(float) * width * height);
  float *green = (float *)malloc(sizeof(float) * width * height);
  float *blue = (float *)malloc(sizeof(float) * width * height);
  memcpy(red, red_input, sizeof(float) * width * height);
  memcpy(green, green_input, sizeof(float) * width * height);
  memcpy(blue, blue_input, sizeof(float) * width * height);
  for (iter = 0; iter < Niters; iter++) {
    unsigned char *ured, *ugreen, *ublue;
    float *red_m = canal_a_m(red, width, height, lambda);
    float *green_m = canal_a_m(green, width, height, lambda);
    float *blue_m = canal_a_m(blue, width, height, lambda);
    char imagen[100];
    for (i = 0; i < width; i++)
      for (j = 0; j < height; j++) {
        int idx = width * j + i;
        red_output[idx] = red[idx] + (dt / (dh * dh * 2)) * red_m[idx];
        green_output[idx] = green[idx] + (dt / (dh * dh * 2)) * green_m[idx];
        blue_output[idx] = blue[idx] + (dt / (dh * dh * 2)) * blue_m[idx];
        if (red_output[idx] < 0.0)
          red_output[idx] = 0.0;
        else if (red_output[idx] > 1.0)
          red_output[idx] = 1.0;
        if (green_output[idx] < 0.0)
          green_output[idx] = 0.0;
        else if (green_output[idx] > 1.0)
          green_output[idx] = 1.0;
        if (blue_output[idx] < 0.0)
          blue_output[idx] = 0.0;
        else if (blue_output[idx] > 1.0)
          blue_output[idx] = 1.0;
      }
    sprintf(imagen, "imagen_1%05d.bmp", iter);
    ured = float_to_uchar(red_output, width * height);
    ugreen = float_to_uchar(green_output, width * height);
    ublue = float_to_uchar(blue_output, width * height);
    ami_write_bmp(imagen, ured, ugreen, ublue, width, height);
    free(ured);
    free(ugreen);
    free(ublue);
    free(red_m);
    free(blue_m);
    free(green_m);
    memcpy(red, red_output, sizeof(float) * width * height);
    memcpy(green, green_output, sizeof(float) * width * height);
    memcpy(blue, blue_output, sizeof(float) * width * height);
  }
}


x86 assembly (clang, -O0):
<aan_perona_malik>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movss  %xmm0,-0x34(%rbp)
movss  %xmm1,-0x38(%rbp)
movss  %xmm2,-0x3c(%rbp)
movslq 0x10(%rbp),%rdi
shl    $0x2,%rdi
movslq 0x18(%rbp),%rax
imul   %rax,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq 0x10(%rbp),%rdi
shl    $0x2,%rdi
movslq 0x18(%rbp),%rax
imul   %rax,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq 0x10(%rbp),%rdi
shl    $0x2,%rdi
movslq 0x18(%rbp),%rax
imul   %rax,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    16c4 <aan_perona_malik+0x554>
mov    -0x50(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
cltq
mov    %rax,-0x80(%rbp)
mov    -0x58(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
cltq
mov    %rax,-0x88(%rbp)
mov    -0x60(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
cltq
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    15a1 <aan_perona_malik+0x431>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    158e <aan_perona_malik+0x41e>
mov    0x10(%rbp),%eax
imul   -0x44(%rbp),%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
mulss  -0x38(%rbp),%xmm2
movss  0xcdd(%rip),%xmm3
mulss  %xmm3,%xmm2
divss  %xmm2,%xmm0
mov    -0x80(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x58(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
mulss  -0x38(%rbp),%xmm2
movss  0xc86(%rip),%xmm3
mulss  %xmm3,%xmm2
divss  %xmm2,%xmm0
mov    -0x88(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
mulss  -0x38(%rbp),%xmm2
movss  0xc2c(%rip),%xmm3
mulss  %xmm3,%xmm2
divss  %xmm2,%xmm0
mov    -0x90(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1440 <aan_perona_malik+0x2d0>
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1483 <aan_perona_malik+0x313>
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbac(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    147e <aan_perona_malik+0x30e>
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  0xb8b(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1483 <aan_perona_malik+0x313>
mov    -0x28(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    14bc <aan_perona_malik+0x34c>
mov    -0x28(%rbp),%rax
movslq -0x104(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    14ff <aan_perona_malik+0x38f>
mov    -0x28(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb30(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14fa <aan_perona_malik+0x38a>
mov    -0x28(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  0xb0f(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    14ff <aan_perona_malik+0x38f>
mov    -0x30(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1538 <aan_perona_malik+0x3c8>
mov    -0x30(%rbp),%rax
movslq -0x104(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    157b <aan_perona_malik+0x40b>
mov    -0x30(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xab4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1576 <aan_perona_malik+0x406>
mov    -0x30(%rbp),%rax
movslq -0x104(%rbp),%rcx
movss  0xa93(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    157b <aan_perona_malik+0x40b>
jmp    1580 <aan_perona_malik+0x410>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12e0 <aan_perona_malik+0x170>
jmp    1593 <aan_perona_malik+0x423>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12cd <aan_perona_malik+0x15d>
lea    -0x100(%rbp),%rdi
mov    -0x48(%rbp),%edx
lea    0xa5e(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x20(%rbp),%rdi
mov    0x10(%rbp),%esi
imul   0x18(%rbp),%esi
mov    $0x0,%al
call   1040 <float_to_uchar@plt>
cltq
mov    %rax,-0x68(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x10(%rbp),%esi
imul   0x18(%rbp),%esi
mov    $0x0,%al
call   1040 <float_to_uchar@plt>
cltq
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
imul   0x18(%rbp),%esi
mov    $0x0,%al
call   1040 <float_to_uchar@plt>
cltq
mov    %rax,-0x78(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
mov    $0x0,%al
call   1080 <ami_write_bmp@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
mov    -0x60(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq 0x10(%rbp),%rdx
shl    $0x2,%rdx
movslq 0x18(%rbp),%rax
imul   %rax,%rdx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1254 <aan_perona_malik+0xe4>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aan_perona_malik>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rdx,0x10(%rsp)
mov    %rsi,0x50(%rsp)
mov    %rdi,0x48(%rsp)
movslq 0x128(%rsp),%rcx
movslq 0x120(%rsp),%r13
mov    %r13,0x30(%rsp)
mov    %rcx,0x38(%rsp)
imul   %rcx,%r13
shl    $0x2,%r13
mov    %r13,%rdi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x40(%rsp)
mov    %r13,%rdi
call   1070 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %r13,%rdi
call   1070 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %rbp,%rdi
mov    0x48(%rsp),%rsi
mov    0x120(%rsp),%r12d
mov    %r13,%rdx
call   1050 <memcpy@plt>
mov    0x28(%rsp),%rdi
mov    0x50(%rsp),%rsi
mov    %r13,%rdx
call   1050 <memcpy@plt>
mov    0x20(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    %r13,0x68(%rsp)
mov    %r13,%rdx
mov    0x40(%rsp),%r13
call   1050 <memcpy@plt>
cmpl   $0x0,0x130(%rsp)
jle    154d <aan_perona_malik+0x3dd>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm1
mulss  %xmm1,%xmm1
addss  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x38(%rsp),%rdx
mov    %edx,%eax
imul   %r12d,%eax
mov    %eax,0x5c(%rsp)
mov    0x30(%rsp),%rax
mov    %eax,%ecx
mov    %rcx,0x50(%rsp)
mov    %edx,%ecx
mov    %rcx,0x48(%rsp)
shl    $0x2,%rax
mov    %rax,0x30(%rsp)
movl   $0x0,0x8(%rsp)
jmp    13cf <aan_perona_malik+0x25f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x80(%rsp),%rdi
lea    0xd35(%rip),%rsi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %rbx,%rdi
mov    0x5c(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <float_to_uchar@plt>
cltq
mov    %rax,0x78(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <float_to_uchar@plt>
cltq
mov    %rax,0x60(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <float_to_uchar@plt>
movslq %eax,%rcx
mov    %rcx,0x70(%rsp)
lea    0x80(%rsp),%rdi
mov    0x78(%rsp),%rbp
mov    %rbp,%rsi
mov    0x60(%rsp),%rdx
mov    0x120(%rsp),%r8d
mov    0x38(%rsp),%r9
xor    %eax,%eax
call   1080 <ami_write_bmp@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
mov    0x40(%rsp),%r13
mov    0x120(%rsp),%r12d
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    0x68(%rsp),%rbp
mov    %rbp,%rdx
call   1050 <memcpy@plt>
mov    0x28(%rsp),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1050 <memcpy@plt>
mov    0x20(%rsp),%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1050 <memcpy@plt>
mov    0x8(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x8(%rsp)
cmp    0x130(%rsp),%eax
je     154d <aan_perona_malik+0x3dd>
mov    %r13,%rdi
mov    %r12d,%esi
mov    0x38(%rsp),%rbp
mov    %ebp,%edx
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
mov    %eax,0x10(%rsp)
mov    0x28(%rsp),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
mov    %eax,%r13d
mov    0x20(%rsp),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1060 <canal_a_m@plt>
movslq 0x10(%rsp),%r12
movslq %r13d,%rcx
mov    %rcx,0x10(%rsp)
movslq %eax,%r13
cmpl   $0x0,0x120(%rsp)
movss  0xc(%rsp),%xmm2
mov    %rbp,%r8
mov    0x30(%rsp),%rdi
mov    0x40(%rsp),%rcx
mov    0x28(%rsp),%rbp
mov    0x20(%rsp),%rax
movss  0xba5(%rip),%xmm3
jle    12c0 <aan_perona_malik+0x150>
xor    %r9d,%r9d
xor    %r10d,%r10d
jmp    1483 <aan_perona_malik+0x313>
nopl   0x0(%rax)
add    $0x1,%r10
add    $0x4,%r9
cmp    0x50(%rsp),%r10
je     12c0 <aan_perona_malik+0x150>
test   %r8d,%r8d
jle    1470 <aan_perona_malik+0x300>
mov    0x48(%rsp),%rdx
mov    %r9,%rsi
jmp    14af <aan_perona_malik+0x33f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  %xmm0,(%r14,%rsi,1)
add    %rdi,%rsi
add    $0xffffffffffffffff,%rdx
je     1470 <aan_perona_malik+0x300>
movss  (%r12,%rsi,1),%xmm0
mulss  %xmm2,%xmm0
addss  (%rcx,%rsi,1),%xmm0
movss  %xmm0,(%rbx,%rsi,1)
mov    0x10(%rsp),%r11
movss  (%r11,%rsi,1),%xmm0
mulss  %xmm2,%xmm0
addss  0x0(%rbp,%rsi,1),%xmm0
movss  %xmm0,(%r15,%rsi,1)
movss  0x0(%r13,%rsi,1),%xmm0
mulss  %xmm2,%xmm0
addss  (%rax,%rsi,1),%xmm0
movss  %xmm0,(%r14,%rsi,1)
movss  (%rbx,%rsi,1),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     1509 <aan_perona_malik+0x399>
ucomiss %xmm3,%xmm1
movaps %xmm3,%xmm0
jbe    150e <aan_perona_malik+0x39e>
movss  %xmm0,(%rbx,%rsi,1)
movss  (%r15,%rsi,1),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     1524 <aan_perona_malik+0x3b4>
ucomiss %xmm3,%xmm1
movaps %xmm3,%xmm0
jbe    152a <aan_perona_malik+0x3ba>
movss  %xmm0,(%r15,%rsi,1)
movss  (%r14,%rsi,1),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     14a0 <aan_perona_malik+0x330>
ucomiss %xmm3,%xmm1
movaps %xmm3,%xmm0
ja     14a0 <aan_perona_malik+0x330>
jmp    14a6 <aan_perona_malik+0x336>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"imagen_1%05d.bmp\00"
define void @aan_perona_malik(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* %3, float* %4, float* %5, i32 %6, i32 %7, float %8, float %9, float %10, i32 %11) {
%13 = alloca [100 x i8]
%14 = sext i32 %6 to i64
%15 = shl nsw i64 %14, 2
%16 = sext i32 %7 to i64
%17 = mul i64 %15, %16
%18 = tail call i8* @malloc(i64 %17)
%19 = bitcast i8* %18 to float*
%20 = tail call i8* @malloc(i64 %17)
%21 = bitcast i8* %20 to float*
%22 = tail call i8* @malloc(i64 %17)
%23 = bitcast i8* %22 to float*
%24 = bitcast float* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %18, i8* align 4 %24, i64 %17, i1 false)
%25 = bitcast float* %1 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %20, i8* align 4 %25, i64 %17, i1 false)
%26 = bitcast float* %2 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %22, i8* align 4 %26, i64 %17, i1 false)
%27 = icmp sgt i32 %11, 0
br i1 %27, label %28, label %120
28: ; preds = %12
%29 = fpext float %10 to double
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%31 = icmp sgt i32 %6, 0
%32 = icmp sgt i32 %7, 0
%33 = fmul float %9, %9
%34 = fmul float %33, 2.000000e+00
%35 = fdiv float %8, %34
%36 = mul nsw i32 %7, %6
%37 = bitcast float* %3 to i8*
%38 = bitcast float* %4 to i8*
%39 = bitcast float* %5 to i8*
%40 = zext i32 %6 to i64
%41 = zext i32 %7 to i64
br label %42
42: ; preds = %28, %103
%43 = phi i32 [ 0, %28 ], [ %118, %103 ]
%44 = call i32 (float*, i32, i32, double, ...) bitcast (i32 (...)* @canal_a_m to i32 (float*, i32, i32, double, ...)*)(float* %19, i32 %6, i32 %7, double %29)
%45 = sext i32 %44 to i64
%46 = inttoptr i64 %45 to float*
%47 = call i32 (float*, i32, i32, double, ...) bitcast (i32 (...)* @canal_a_m to i32 (float*, i32, i32, double, ...)*)(float* %21, i32 %6, i32 %7, double %29)
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to float*
%50 = call i32 (float*, i32, i32, double, ...) bitcast (i32 (...)* @canal_a_m to i32 (float*, i32, i32, double, ...)*)(float* %23, i32 %6, i32 %7, double %29)
%51 = sext i32 %50 to i64
%52 = inttoptr i64 %51 to float*
br i1 %31, label %53, label %103
53: ; preds = %42, %100
%54 = phi i64 [ %101, %100 ], [ 0, %42 ]
br i1 %32, label %55, label %100
55: ; preds = %53, %97
%56 = phi i64 [ %98, %97 ], [ 0, %53 ]
%57 = mul nsw i64 %56, %14
%58 = add nsw i64 %57, %54
%59 = getelementptr inbounds float, float* %19, i64 %58
%60 = load float, float* %59
%61 = getelementptr inbounds float, float* %46, i64 %58
%62 = load float, float* %61
%63 = call float @llvm.fmuladd.f32(float %35, float %62, float %60)
%64 = getelementptr inbounds float, float* %3, i64 %58
store float %63, float* %64
%65 = getelementptr inbounds float, float* %21, i64 %58
%66 = load float, float* %65
%67 = getelementptr inbounds float, float* %49, i64 %58
%68 = load float, float* %67
%69 = call float @llvm.fmuladd.f32(float %35, float %68, float %66)
%70 = getelementptr inbounds float, float* %4, i64 %58
store float %69, float* %70
%71 = getelementptr inbounds float, float* %23, i64 %58
%72 = load float, float* %71
%73 = getelementptr inbounds float, float* %52, i64 %58
%74 = load float, float* %73
%75 = call float @llvm.fmuladd.f32(float %35, float %74, float %72)
%76 = getelementptr inbounds float, float* %5, i64 %58
store float %75, float* %76
%77 = load float, float* %64
%78 = fcmp olt float %77, 0.000000e+00
br i1 %78, label %81, label %79
79: ; preds = %55
%80 = fcmp ogt float %77, 1.000000e+00
br i1 %80, label %81, label %83
81: ; preds = %79, %55
%82 = phi float [ 0.000000e+00, %55 ], [ 1.000000e+00, %79 ]
store float %82, float* %64
br label %83
83: ; preds = %81, %79
%84 = load float, float* %70
%85 = fcmp olt float %84, 0.000000e+00
br i1 %85, label %88, label %86
86: ; preds = %83
%87 = fcmp ogt float %84, 1.000000e+00
br i1 %87, label %88, label %90
88: ; preds = %86, %83
%89 = phi float [ 0.000000e+00, %83 ], [ 1.000000e+00, %86 ]
store float %89, float* %70
br label %90
90: ; preds = %88, %86
%91 = load float, float* %76
%92 = fcmp olt float %91, 0.000000e+00
br i1 %92, label %95, label %93
93: ; preds = %90
%94 = fcmp ogt float %91, 1.000000e+00
br i1 %94, label %95, label %97
95: ; preds = %93, %90
%96 = phi float [ 0.000000e+00, %90 ], [ 1.000000e+00, %93 ]
store float %96, float* %76
br label %97
97: ; preds = %95, %93
%98 = add nuw nsw i64 %56, 1
%99 = icmp eq i64 %98, %41
br i1 %99, label %100, label %55
100: ; preds = %97, %53
%101 = add nuw nsw i64 %54, 1
%102 = icmp eq i64 %101, %40
br i1 %102, label %103, label %53
103: ; preds = %100, %42
%104 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %43)
%105 = call i32 (float*, i32, ...) bitcast (i32 (...)* @float_to_uchar to i32 (float*, i32, ...)*)(float* %3, i32 %36)
%106 = sext i32 %105 to i64
%107 = inttoptr i64 %106 to i8*
%108 = call i32 (float*, i32, ...) bitcast (i32 (...)* @float_to_uchar to i32 (float*, i32, ...)*)(float* %4, i32 %36)
%109 = sext i32 %108 to i64
%110 = inttoptr i64 %109 to i8*
%111 = call i32 (float*, i32, ...) bitcast (i32 (...)* @float_to_uchar to i32 (float*, i32, ...)*)(float* %5, i32 %36)
%112 = sext i32 %111 to i64
%113 = inttoptr i64 %112 to i8*
%114 = call i32 (i8*, i8*, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @ami_write_bmp to i32 (i8*, i8*, i8*, i8*, i32, i32, ...)*)(i8* %30, i8* %107, i8* %110, i8* %113, i32 %6, i32 %7)
%115 = inttoptr i64 %45 to i8*
%116 = inttoptr i64 %51 to i8*
%117 = inttoptr i64 %48 to i8*
%118 = add nuw nsw i32 %43, 1
%119 = icmp eq i32 %118, %11
br i1 %119, label %120, label %42
120: ; preds = %103, %12
ret void
}