#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*/ FILE;

/* Variables and functions */
double DBL_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void write_image(FILE *f, double *u, unsigned sizex, unsigned sizey) {
  unsigned char r[1024], g[1024], b[1024];
  int i, j, k;
  double min, max;
  j = 1023;
  for (i = 0; i < 256; i++) {
    r[j] = 255;
    g[j] = i;
    b[j] = 0;
    j--;
  }
  for (i = 0; i < 256; i++) {
    r[j] = 255 - i;
    g[j] = 255;
    b[j] = 0;
    j--;
  }
  for (i = 0; i < 256; i++) {
    r[j] = 0;
    g[j] = 255;
    b[j] = i;
    j--;
  }
  for (i = 0; i < 256; i++) {
    r[j] = 0;
    g[j] = 255 - i;
    b[j] = 255;
    j--;
  }
  min = DBL_MAX;
  max = -DBL_MAX;
  for (i = 0; i < sizey; i++) {
    for (j = 0; j < sizex; j++) {
      if (u[i * sizex + j] > max)
        max = u[i * sizex + j];
      if (u[i * sizex + j] < min)
        min = u[i * sizex + j];
    }
  }
  fprintf(f, "P3\n");
  fprintf(f, "%u %u\n", sizex, sizey);
  fprintf(f, "%u\n", 255);
  for (i = 0; i < sizey; i++) {
    for (j = 0; j < sizex; j++) {
      k = (int)(1024.0 * (u[i * sizex + j] - min) / (max - min));
      fprintf(f, "%d %d %d  ", r[k], g[k], b[k]);
    }
    fprintf(f, "\n");
  }
}


x86 assembly (clang, -O0):
<write_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x3ff,-0xc28(%rbp)
movl   $0x0,-0xc24(%rbp)
cmpl   $0x100,-0xc24(%rbp)
jge    11a4 <write_image+0x94>
movslq -0xc28(%rbp),%rax
movb   $0xff,-0x420(%rbp,%rax,1)
ff
mov    -0xc24(%rbp),%eax
mov    %al,%cl
movslq -0xc28(%rbp),%rax
mov    %cl,-0x820(%rbp,%rax,1)
movslq -0xc28(%rbp),%rax
movb   $0x0,-0xc20(%rbp,%rax,1)
mov    -0xc28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc28(%rbp)
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    113d <write_image+0x2d>
movl   $0x0,-0xc24(%rbp)
cmpl   $0x100,-0xc24(%rbp)
jge    121a <write_image+0x10a>
mov    $0xff,%eax
sub    -0xc24(%rbp),%eax
mov    %al,%cl
movslq -0xc28(%rbp),%rax
mov    %cl,-0x420(%rbp,%rax,1)
movslq -0xc28(%rbp),%rax
movb   $0xff,-0x820(%rbp,%rax,1)
ff
movslq -0xc28(%rbp),%rax
movb   $0x0,-0xc20(%rbp,%rax,1)
mov    -0xc28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc28(%rbp)
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    11ae <write_image+0x9e>
movl   $0x0,-0xc24(%rbp)
cmpl   $0x100,-0xc24(%rbp)
jge    128b <write_image+0x17b>
movslq -0xc28(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
movslq -0xc28(%rbp),%rax
movb   $0xff,-0x820(%rbp,%rax,1)
ff
mov    -0xc24(%rbp),%eax
mov    %al,%cl
movslq -0xc28(%rbp),%rax
mov    %cl,-0xc20(%rbp,%rax,1)
mov    -0xc28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc28(%rbp)
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    1224 <write_image+0x114>
movl   $0x0,-0xc24(%rbp)
cmpl   $0x100,-0xc24(%rbp)
jge    1301 <write_image+0x1f1>
movslq -0xc28(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
mov    $0xff,%eax
sub    -0xc24(%rbp),%eax
mov    %al,%cl
movslq -0xc28(%rbp),%rax
mov    %cl,-0x820(%rbp,%rax,1)
movslq -0xc28(%rbp),%rax
movb   $0xff,-0xc20(%rbp,%rax,1)
ff
mov    -0xc28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc28(%rbp)
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    1295 <write_image+0x185>
mov    0x2cd8(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc38(%rbp)
ff
mov    0x2cc5(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc40(%rbp)
ff
movl   $0x0,-0xc24(%rbp)
mov    -0xc24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    143e <write_image+0x32e>
movl   $0x0,-0xc28(%rbp)
mov    -0xc28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1425 <write_image+0x315>
mov    -0x10(%rbp),%rax
mov    -0xc24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0xc28(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0xc40(%rbp),%xmm0
ff
jbe    13bc <write_image+0x2ac>
mov    -0x10(%rbp),%rax
mov    -0xc24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0xc28(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc40(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0xc24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0xc28(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0xc38(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    140c <write_image+0x2fc>
mov    -0x10(%rbp),%rax
mov    -0xc24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0xc28(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc38(%rbp)
ff
jmp    1411 <write_image+0x301>
mov    -0xc28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc28(%rbp)
jmp    1361 <write_image+0x251>
jmp    142a <write_image+0x31a>
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    1348 <write_image+0x238>
mov    -0x8(%rbp),%rdi
lea    0xbbf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xbab(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xb9c(%rip),%rsi
mov    $0xff,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0xc24(%rbp)
mov    -0xc24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1578 <write_image+0x468>
movl   $0x0,-0xc28(%rbp)
mov    -0xc28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1552 <write_image+0x442>
mov    -0x10(%rbp),%rax
mov    -0xc24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0xc28(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0xc38(%rbp),%xmm1
ff
movsd  0xb24(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0xc40(%rbp),%xmm1
ff
subsd  -0xc38(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc2c(%rbp),%rax
movzbl -0x420(%rbp,%rax,1),%edx
ff
movslq -0xc2c(%rbp),%rax
movzbl -0x820(%rbp,%rax,1),%ecx
ff
movslq -0xc2c(%rbp),%rax
movzbl -0xc20(%rbp,%rax,1),%r8d
ff ff
lea    0xadc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc28(%rbp)
jmp    14a2 <write_image+0x392>
mov    -0x8(%rbp),%rdi
lea    0xaad(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc24(%rbp)
jmp    1489 <write_image+0x379>
add    $0xc40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_image>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc58,%rsp
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rdi,%r12
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x750(%rsp)
movdqa %xmm0,0x760(%rsp)
movdqa %xmm0,0x770(%rsp)
movdqa %xmm0,0x780(%rsp)
movdqa %xmm0,0x790(%rsp)
movdqa %xmm0,0x7a0(%rsp)
movdqa %xmm0,0x7b0(%rsp)
movdqa %xmm0,0x7c0(%rsp)
movdqa %xmm0,0x7d0(%rsp)
movdqa %xmm0,0x7e0(%rsp)
movdqa %xmm0,0x7f0(%rsp)
movdqa %xmm0,0x800(%rsp)
movdqa %xmm0,0x810(%rsp)
movdqa %xmm0,0x820(%rsp)
movdqa %xmm0,0x830(%rsp)
movdqa %xmm0,0x840(%rsp)
pxor   %xmm2,%xmm2
movdqa %xmm2,0x350(%rsp)
movdqa %xmm2,0x360(%rsp)
movdqa %xmm2,0x370(%rsp)
movdqa %xmm2,0x380(%rsp)
movdqa %xmm2,0x390(%rsp)
movdqa %xmm2,0x3a0(%rsp)
movdqa %xmm2,0x3b0(%rsp)
movdqa %xmm2,0x3c0(%rsp)
movdqa %xmm2,0x3d0(%rsp)
movdqa %xmm2,0x3e0(%rsp)
movdqa %xmm2,0x3f0(%rsp)
movdqa %xmm2,0x400(%rsp)
movdqa %xmm2,0x410(%rsp)
movdqa %xmm2,0x420(%rsp)
movdqa %xmm2,0x430(%rsp)
movdqa %xmm2,0x440(%rsp)
movdqa 0xd86(%rip),%xmm3
xor    %eax,%eax
movdqa 0xd8c(%rip),%xmm0
movdqa 0xd94(%rip),%xmm1
nopl   0x0(%rax)
movdqa %xmm3,%xmm4
punpcklbw %xmm2,%xmm4
pshufd $0x4e,%xmm4,%xmm4
pshuflw $0x1b,%xmm4,%xmm4
pshufhw $0x1b,%xmm4,%xmm4
movdqa %xmm3,%xmm5
punpckhbw %xmm2,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
packuswb %xmm4,%xmm5
movdqa %xmm5,0xc40(%rsp,%rax,1)
movdqa %xmm3,%xmm4
paddb  %xmm0,%xmm4
movdqa %xmm4,%xmm5
punpcklbw %xmm2,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
punpckhbw %xmm2,%xmm4
pshufd $0x4e,%xmm4,%xmm4
pshuflw $0x1b,%xmm4,%xmm4
pshufhw $0x1b,%xmm4,%xmm4
packuswb %xmm5,%xmm4
movdqa %xmm4,0xc30(%rsp,%rax,1)
paddb  %xmm1,%xmm3
add    $0xffffffffffffffe0,%rax
cmp    $0xffffffffffffff00,%rax
jne    1290 <write_image+0x160>
pcmpeqd %xmm2,%xmm2
movdqa %xmm2,0xb40(%rsp)
movdqa %xmm2,0xb30(%rsp)
movdqa %xmm2,0xb20(%rsp)
movdqa %xmm2,0xb10(%rsp)
movdqa %xmm2,0xb00(%rsp)
movdqa %xmm2,0xaf0(%rsp)
movdqa %xmm2,0xae0(%rsp)
movdqa %xmm2,0xad0(%rsp)
movdqa %xmm2,0xac0(%rsp)
movdqa %xmm2,0xab0(%rsp)
movdqa %xmm2,0xaa0(%rsp)
movdqa %xmm2,0xa90(%rsp)
movdqa %xmm2,0xa80(%rsp)
movdqa %xmm2,0xa70(%rsp)
movdqa %xmm2,0xa60(%rsp)
movdqa %xmm2,0xa50(%rsp)
pxor   %xmm3,%xmm3
movdqa %xmm3,0x250(%rsp)
movdqa %xmm3,0x260(%rsp)
movdqa %xmm3,0x270(%rsp)
movdqa %xmm3,0x280(%rsp)
movdqa %xmm3,0x290(%rsp)
movdqa %xmm3,0x2a0(%rsp)
movdqa %xmm3,0x2b0(%rsp)
movdqa %xmm3,0x2c0(%rsp)
movdqa %xmm3,0x2d0(%rsp)
movdqa %xmm3,0x2e0(%rsp)
movdqa %xmm3,0x2f0(%rsp)
movdqa %xmm3,0x300(%rsp)
movdqa %xmm3,0x310(%rsp)
movdqa %xmm3,0x320(%rsp)
movdqa %xmm3,0x330(%rsp)
movdqa %xmm3,0x340(%rsp)
movdqa 0xbb2(%rip),%xmm4
mov    $0x2f0,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm4,%xmm5
pxor   %xmm2,%xmm5
movdqa %xmm5,%xmm6
punpcklbw %xmm3,%xmm6
pshufd $0x4e,%xmm6,%xmm6
pshuflw $0x1b,%xmm6,%xmm6
pshufhw $0x1b,%xmm6,%xmm6
punpckhbw %xmm3,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
packuswb %xmm6,%xmm5
movdqa %xmm5,0x450(%rsp,%rax,1)
paddb  %xmm0,%xmm4
add    $0xfffffffffffffff0,%rax
cmp    $0x1f0,%rax
jne    1460 <write_image+0x330>
pxor   %xmm2,%xmm2
movdqa %xmm2,0x640(%rsp)
movdqa %xmm2,0x630(%rsp)
movdqa %xmm2,0x620(%rsp)
movdqa %xmm2,0x610(%rsp)
movdqa %xmm2,0x600(%rsp)
movdqa %xmm2,0x5f0(%rsp)
movdqa %xmm2,0x5e0(%rsp)
movdqa %xmm2,0x5d0(%rsp)
movdqa %xmm2,0x5c0(%rsp)
movdqa %xmm2,0x5b0(%rsp)
movdqa %xmm2,0x5a0(%rsp)
movdqa %xmm2,0x590(%rsp)
movdqa %xmm2,0x580(%rsp)
movdqa %xmm2,0x570(%rsp)
movdqa %xmm2,0x560(%rsp)
movdqa %xmm2,0x550(%rsp)
pcmpeqd %xmm3,%xmm3
movdqa %xmm3,0x950(%rsp)
movdqa %xmm3,0x960(%rsp)
movdqa %xmm3,0x970(%rsp)
movdqa %xmm3,0x980(%rsp)
movdqa %xmm3,0x990(%rsp)
movdqa %xmm3,0x9a0(%rsp)
movdqa %xmm3,0x9b0(%rsp)
movdqa %xmm3,0x9c0(%rsp)
movdqa %xmm3,0x9d0(%rsp)
movdqa %xmm3,0x9e0(%rsp)
movdqa %xmm3,0x9f0(%rsp)
movdqa %xmm3,0xa00(%rsp)
movdqa %xmm3,0xa10(%rsp)
movdqa %xmm3,0xa20(%rsp)
movdqa %xmm3,0xa30(%rsp)
movdqa %xmm3,0xa40(%rsp)
movdqa 0xa21(%rip),%xmm3
mov    $0x1f0,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm3,%xmm4
punpcklbw %xmm2,%xmm4
pshufd $0x4e,%xmm4,%xmm4
pshuflw $0x1b,%xmm4,%xmm4
pshufhw $0x1b,%xmm4,%xmm4
movdqa %xmm3,%xmm5
punpckhbw %xmm2,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
packuswb %xmm4,%xmm5
movdqa %xmm5,0x50(%rsp,%rax,1)
movdqa %xmm3,%xmm4
paddb  %xmm0,%xmm4
movdqa %xmm4,%xmm5
punpcklbw %xmm2,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
punpckhbw %xmm2,%xmm4
pshufd $0x4e,%xmm4,%xmm4
pshuflw $0x1b,%xmm4,%xmm4
pshufhw $0x1b,%xmm4,%xmm4
packuswb %xmm5,%xmm4
movdqa %xmm4,0x40(%rsp,%rax,1)
paddb  %xmm1,%xmm3
add    $0xffffffffffffffe0,%rax
cmp    $0xf0,%rax
jne    15f0 <write_image+0x4c0>
pxor   %xmm1,%xmm1
movdqa %xmm1,0x540(%rsp)
movdqa %xmm1,0x530(%rsp)
movdqa %xmm1,0x520(%rsp)
movdqa %xmm1,0x510(%rsp)
movdqa %xmm1,0x500(%rsp)
movdqa %xmm1,0x4f0(%rsp)
movdqa %xmm1,0x4e0(%rsp)
movdqa %xmm1,0x4d0(%rsp)
movdqa %xmm1,0x4c0(%rsp)
movdqa %xmm1,0x4b0(%rsp)
movdqa %xmm1,0x4a0(%rsp)
movdqa %xmm1,0x490(%rsp)
movdqa %xmm1,0x480(%rsp)
movdqa %xmm1,0x470(%rsp)
movdqa %xmm1,0x460(%rsp)
movdqa %xmm1,0x450(%rsp)
pcmpeqd %xmm2,%xmm2
movdqa %xmm2,0x50(%rsp)
movdqa %xmm2,0x60(%rsp)
movdqa %xmm2,0x70(%rsp)
movdqa %xmm2,0x80(%rsp)
movdqa %xmm2,0x90(%rsp)
movdqa %xmm2,0xa0(%rsp)
movdqa %xmm2,0xb0(%rsp)
movdqa %xmm2,0xc0(%rsp)
movdqa %xmm2,0xd0(%rsp)
movdqa %xmm2,0xe0(%rsp)
movdqa %xmm2,0xf0(%rsp)
movdqa %xmm2,0x100(%rsp)
movdqa %xmm2,0x110(%rsp)
movdqa %xmm2,0x120(%rsp)
movdqa %xmm2,0x130(%rsp)
movdqa %xmm2,0x140(%rsp)
movdqa 0x861(%rip),%xmm3
mov    $0x100,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm3,%xmm4
pxor   %xmm2,%xmm4
movdqa %xmm4,%xmm5
punpcklbw %xmm1,%xmm5
pshufd $0x4e,%xmm5,%xmm5
pshuflw $0x1b,%xmm5,%xmm5
pshufhw $0x1b,%xmm5,%xmm5
punpckhbw %xmm1,%xmm4
pshufd $0x4e,%xmm4,%xmm4
pshuflw $0x1b,%xmm4,%xmm4
pshufhw $0x1b,%xmm4,%xmm4
packuswb %xmm5,%xmm4
movdqa %xmm4,0x840(%rsp,%rax,1)
paddb  %xmm0,%xmm3
add    $0xfffffffffffffff0,%rax
jne    17b0 <write_image+0x680>
mov    0x27e0(%rip),%rax
movsd  (%rax),%xmm2
movapd 0x824(%rip),%xmm3
xorpd  %xmm2,%xmm3
mov    %r15d,%r8d
test   %r14d,%r14d
je     18bf <write_image+0x78f>
mov    %r8d,%eax
and    $0xfffffffe,%eax
xor    %ecx,%ecx
mov    $0x1,%edx
jmp    183f <write_image+0x70f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
add    %r15d,%edx
cmp    %r14d,%ecx
je     18bf <write_image+0x78f>
test   %r15d,%r15d
je     1830 <write_image+0x700>
cmp    $0x1,%r15d
jne    1850 <write_image+0x720>
xor    %ebx,%ebx
jmp    1893 <write_image+0x763>
xchg   %ax,%ax
mov    %edx,%edi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x1(%rdi),%ebp
movsd  (%rsi,%rbp,8),%xmm0
movapd %xmm0,%xmm1
maxsd  %xmm3,%xmm1
minsd  %xmm2,%xmm0
mov    %edi,%ebp
movsd  (%rsi,%rbp,8),%xmm2
movapd %xmm2,%xmm3
maxsd  %xmm1,%xmm3
minsd  %xmm0,%xmm2
add    $0x2,%rbx
add    $0x2,%edi
cmp    %rbx,%rax
jne    1860 <write_image+0x730>
test   $0x1,%r8b
je     1830 <write_image+0x700>
mov    %ecx,%edi
imul   %r15d,%edi
add    %edi,%ebx
movsd  (%rsi,%rbx,8),%xmm0
movapd %xmm0,%xmm1
maxsd  %xmm3,%xmm1
minsd  %xmm2,%xmm0
movapd %xmm0,%xmm2
movapd %xmm1,%xmm3
jmp    1830 <write_image+0x700>
movapd %xmm3,0x10(%rsp)
mov    %r8,0x38(%rsp)
movapd %xmm2,0x20(%rsp)
mov    %rsi,0x40(%rsp)
lea    0x76c(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
lea    0x757(%rip),%rsi
mov    %r12,%rdi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0x743(%rip),%rsi
mov    %r12,0x48(%rsp)
mov    %r12,%rdi
mov    $0xff,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14d,%r14d
je     1a21 <write_image+0x8f1>
movapd 0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
lea    0x711(%rip),%rbp
movl   $0x0,0x4(%rsp)
xor    %r13d,%r13d
mov    %r14d,0xc(%rsp)
mov    %r15d,0x8(%rsp)
mov    0x48(%rsp),%rbx
mov    0x40(%rsp),%r12
jmp    1999 <write_image+0x869>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%r13d
mov    0x8(%rsp),%r15d
add    %r15d,0x4(%rsp)
mov    0xc(%rsp),%r14d
cmp    %r14d,%r13d
je     1a21 <write_image+0x8f1>
test   %r15d,%r15d
movapd 0x20(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
movsd  0x690(%rip),%xmm3
je     1970 <write_image+0x840>
mov    0x38(%rsp),%r15
mov    0x4(%rsp),%r14d
nopl   0x0(%rax)
mov    %r14d,%eax
movsd  (%r12,%rax,8),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
cltq
movzbl 0x450(%rsp,%rax,1),%edx
movzbl 0x850(%rsp,%rax,1),%ecx
movzbl 0x50(%rsp,%rax,1),%r8d
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
movsd  0x63a(%rip),%xmm3
movapd 0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
add    $0x1,%r14d
add    $0xffffffffffffffff,%r15
jne    19c0 <write_image+0x890>
jmp    1970 <write_image+0x840>
add    $0xc58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@DBL_MAX = global double 0.000000e+00
@.str = [4 x i8] c"P3\0A\00"
@.str.1 = [7 x i8] c"%u %u\0A\00"
@.str.2 = [4 x i8] c"%u\0A\00"
@.str.3 = [11 x i8] c"%d %d %d \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @write_image(i32* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
store i32* %0, i32** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1023, i32* %13
store i32 0, i32* %12
br label %17
17: ; preds = %34, %4
%18 = load i32, i32* %12
%19 = icmp slt i32 %18, 256
br i1 %19, label %20, label %37
20: ; preds = %17
%21 = load i32, i32* %13
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %22
store i8 -1, i8* %23
%24 = load i32, i32* %12
%25 = trunc i32 %24 to i8
%26 = load i32, i32* %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %27
store i8 %25, i8* %28
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %30
store i8 0, i8* %31
%32 = load i32, i32* %13
%33 = add nsw i32 %32, -1
store i32 %33, i32* %13
br label %34
34: ; preds = %20
%35 = load i32, i32* %12
%36 = add nsw i32 %35, 1
store i32 %36, i32* %12
br label %17
37: ; preds = %17
store i32 0, i32* %12
br label %38
38: ; preds = %56, %37
%39 = load i32, i32* %12
%40 = icmp slt i32 %39, 256
br i1 %40, label %41, label %59
41: ; preds = %38
%42 = load i32, i32* %12
%43 = sub nsw i32 255, %42
%44 = trunc i32 %43 to i8
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %46
store i8 %44, i8* %47
%48 = load i32, i32* %13
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %49
store i8 -1, i8* %50
%51 = load i32, i32* %13
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %52
store i8 0, i8* %53
%54 = load i32, i32* %13
%55 = add nsw i32 %54, -1
store i32 %55, i32* %13
br label %56
56: ; preds = %41
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
store i32 %58, i32* %12
br label %38
59: ; preds = %38
store i32 0, i32* %12
br label %60
60: ; preds = %77, %59
%61 = load i32, i32* %12
%62 = icmp slt i32 %61, 256
br i1 %62, label %63, label %80
63: ; preds = %60
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %65
store i8 0, i8* %66
%67 = load i32, i32* %13
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %68
store i8 -1, i8* %69
%70 = load i32, i32* %12
%71 = trunc i32 %70 to i8
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %73
store i8 %71, i8* %74
%75 = load i32, i32* %13
%76 = add nsw i32 %75, -1
store i32 %76, i32* %13
br label %77
77: ; preds = %63
%78 = load i32, i32* %12
%79 = add nsw i32 %78, 1
store i32 %79, i32* %12
br label %60
80: ; preds = %60
store i32 0, i32* %12
br label %81
81: ; preds = %99, %80
%82 = load i32, i32* %12
%83 = icmp slt i32 %82, 256
br i1 %83, label %84, label %102
84: ; preds = %81
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %86
store i8 0, i8* %87
%88 = load i32, i32* %12
%89 = sub nsw i32 255, %88
%90 = trunc i32 %89 to i8
%91 = load i32, i32* %13
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %92
store i8 %90, i8* %93
%94 = load i32, i32* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %95
store i8 -1, i8* %96
%97 = load i32, i32* %13
%98 = add nsw i32 %97, -1
store i32 %98, i32* %13
br label %99
99: ; preds = %84
%100 = load i32, i32* %12
%101 = add nsw i32 %100, 1
store i32 %101, i32* %12
br label %81
102: ; preds = %81
%103 = load double, double* @DBL_MAX
store double %103, double* %15
%104 = load double, double* @DBL_MAX
%105 = fneg double %104
store double %105, double* %16
store i32 0, i32* %12
br label %106
106: ; preds = %164, %102
%107 = load i32, i32* %12
%108 = load i32, i32* %8
%109 = icmp ult i32 %107, %108
br i1 %109, label %110, label %167
110: ; preds = %106
store i32 0, i32* %13
br label %111
111: ; preds = %160, %110
%112 = load i32, i32* %13
%113 = load i32, i32* %7
%114 = icmp ult i32 %112, %113
br i1 %114, label %115, label %163
115: ; preds = %111
%116 = load double*, double** %6
%117 = load i32, i32* %12
%118 = load i32, i32* %7
%119 = mul i32 %117, %118
%120 = load i32, i32* %13
%121 = add i32 %119, %120
%122 = zext i32 %121 to i64
%123 = getelementptr inbounds double, double* %116, i64 %122
%124 = load double, double* %123
%125 = load double, double* %16
%126 = fcmp ogt double %124, %125
br i1 %126, label %127, label %137
127: ; preds = %115
%128 = load double*, double** %6
%129 = load i32, i32* %12
%130 = load i32, i32* %7
%131 = mul i32 %129, %130
%132 = load i32, i32* %13
%133 = add i32 %131, %132
%134 = zext i32 %133 to i64
%135 = getelementptr inbounds double, double* %128, i64 %134
%136 = load double, double* %135
store double %136, double* %16
br label %137
137: ; preds = %127, %115
%138 = load double*, double** %6
%139 = load i32, i32* %12
%140 = load i32, i32* %7
%141 = mul i32 %139, %140
%142 = load i32, i32* %13
%143 = add i32 %141, %142
%144 = zext i32 %143 to i64
%145 = getelementptr inbounds double, double* %138, i64 %144
%146 = load double, double* %145
%147 = load double, double* %15
%148 = fcmp olt double %146, %147
br i1 %148, label %149, label %159
149: ; preds = %137
%150 = load double*, double** %6
%151 = load i32, i32* %12
%152 = load i32, i32* %7
%153 = mul i32 %151, %152
%154 = load i32, i32* %13
%155 = add i32 %153, %154
%156 = zext i32 %155 to i64
%157 = getelementptr inbounds double, double* %150, i64 %156
%158 = load double, double* %157
store double %158, double* %15
br label %159
159: ; preds = %149, %137
br label %160
160: ; preds = %159
%161 = load i32, i32* %13
%162 = add nsw i32 %161, 1
store i32 %162, i32* %13
br label %111
163: ; preds = %111
br label %164
164: ; preds = %163
%165 = load i32, i32* %12
%166 = add nsw i32 %165, 1
store i32 %166, i32* %12
br label %106
167: ; preds = %106
%168 = load i32*, i32** %5
%169 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%170 = load i32*, i32** %5
%171 = load i32, i32* %7
%172 = load i32, i32* %8
%173 = call i32 (i32*, i8*, ...) @fprintf(i32* %170, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %171, i32 %172)
%174 = load i32*, i32** %5
%175 = call i32 (i32*, i8*, ...) @fprintf(i32* %174, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 255)
store i32 0, i32* %12
br label %176
176: ; preds = %226, %167
%177 = load i32, i32* %12
%178 = load i32, i32* %8
%179 = icmp ult i32 %177, %178
br i1 %179, label %180, label %229
180: ; preds = %176
store i32 0, i32* %13
br label %181
181: ; preds = %220, %180
%182 = load i32, i32* %13
%183 = load i32, i32* %7
%184 = icmp ult i32 %182, %183
br i1 %184, label %185, label %223
185: ; preds = %181
%186 = load double*, double** %6
%187 = load i32, i32* %12
%188 = load i32, i32* %7
%189 = mul i32 %187, %188
%190 = load i32, i32* %13
%191 = add i32 %189, %190
%192 = zext i32 %191 to i64
%193 = getelementptr inbounds double, double* %186, i64 %192
%194 = load double, double* %193
%195 = load double, double* %15
%196 = fsub double %194, %195
%197 = fmul double 1.024000e+03, %196
%198 = load double, double* %16
%199 = load double, double* %15
%200 = fsub double %198, %199
%201 = fdiv double %197, %200
%202 = fptosi double %201 to i32
store i32 %202, i32* %14
%203 = load i32*, i32** %5
%204 = load i32, i32* %14
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %205
%207 = load i8, i8* %206
%208 = zext i8 %207 to i32
%209 = load i32, i32* %14
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %210
%212 = load i8, i8* %211
%213 = zext i8 %212 to i32
%214 = load i32, i32* %14
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %215
%217 = load i8, i8* %216
%218 = zext i8 %217 to i32
%219 = call i32 (i32*, i8*, ...) @fprintf(i32* %203, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %208, i32 %213, i32 %218)
br label %220
220: ; preds = %185
%221 = load i32, i32* %13
%222 = add nsw i32 %221, 1
store i32 %222, i32* %13
br label %181
223: ; preds = %181
%224 = load i32*, i32** %5
%225 = call i32 (i32*, i8*, ...) @fprintf(i32* %224, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %226
226: ; preds = %223
%227 = load i32, i32* %12
%228 = add nsw i32 %227, 1
store i32 %228, i32* %12
br label %176
229: ; preds = %176
ret void
}

LLVM IR (-O2):
@DBL_MAX = global double 0.000000e+00
@.str = [4 x i8] c"P3\0A\00"
@.str.1 = [7 x i8] c"%u %u\0A\00"
@.str.2 = [4 x i8] c"%u\0A\00"
@.str.3 = [11 x i8] c"%d %d %d \00"
define void @write_image(i32* nocapture %0, double* nocapture %1, i32 %2, i32 %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 768
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 768
br label %15
15: ; preds = %15, %4
%16 = phi i64 [ 0, %4 ], [ %29, %15 ]
%17 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %4 ], [ %30, %15 ]
%18 = sub nuw nsw i64 1023, %16
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %18
%20 = shufflevector <16 x i8> %17, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%21 = getelementptr inbounds i8, i8* %19, i64 -15
%22 = bitcast i8* %21 to <16 x i8>*
store <16 x i8> %20, <16 x i8>* %22
%23 = add <16 x i8> %17, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%24 = sub nsw i64 1007, %16
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %24
%26 = shufflevector <16 x i8> %23, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%27 = getelementptr inbounds i8, i8* %25, i64 -15
%28 = bitcast i8* %27 to <16 x i8>*
store <16 x i8> %26, <16 x i8>* %28
%29 = add nuw nsw i64 %16, 32
%30 = add <16 x i8> %17, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%31 = icmp eq i64 %29, 256
br i1 %31, label %32, label %15
32: ; preds = %15
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 512
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 512
br label %35
35: ; preds = %35, %32
%36 = phi i64 [ 0, %32 ], [ %44, %35 ]
%37 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %32 ], [ %45, %35 ]
%38 = sub i64 767, %36
%39 = xor <16 x i8> %37, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %38
%41 = shufflevector <16 x i8> %39, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%42 = getelementptr inbounds i8, i8* %40, i64 -15
%43 = bitcast i8* %42 to <16 x i8>*
store <16 x i8> %41, <16 x i8>* %43
%44 = add nuw i64 %36, 16
%45 = add <16 x i8> %37, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%46 = icmp eq i64 %44, 256
br i1 %46, label %47, label %35
47: ; preds = %35
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 256
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 256
br label %50
50: ; preds = %50, %47
%51 = phi i64 [ 0, %47 ], [ %64, %50 ]
%52 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %47 ], [ %65, %50 ]
%53 = sub nuw nsw i64 511, %51
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %53
%55 = shufflevector <16 x i8> %52, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%56 = getelementptr inbounds i8, i8* %54, i64 -15
%57 = bitcast i8* %56 to <16 x i8>*
store <16 x i8> %55, <16 x i8>* %57
%58 = add <16 x i8> %52, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%59 = sub nsw i64 495, %51
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %59
%61 = shufflevector <16 x i8> %58, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%62 = getelementptr inbounds i8, i8* %60, i64 -15
%63 = bitcast i8* %62 to <16 x i8>*
store <16 x i8> %61, <16 x i8>* %63
%64 = add nuw nsw i64 %51, 32
%65 = add <16 x i8> %52, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%66 = icmp eq i64 %64, 256
br i1 %66, label %67, label %50
67: ; preds = %50
br label %68
68: ; preds = %68, %67
%69 = phi i64 [ 0, %67 ], [ %77, %68 ]
%70 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %67 ], [ %78, %68 ]
%71 = sub i64 255, %69
%72 = xor <16 x i8> %70, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %71
%74 = shufflevector <16 x i8> %72, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%75 = getelementptr inbounds i8, i8* %73, i64 -15
%76 = bitcast i8* %75 to <16 x i8>*
store <16 x i8> %74, <16 x i8>* %76
%77 = add nuw i64 %69, 16
%78 = add <16 x i8> %70, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%79 = icmp eq i64 %77, 256
br i1 %79, label %80, label %68
80: ; preds = %68
%81 = load double, double* @DBL_MAX
%82 = fneg double %81
%83 = icmp eq i32 %3, 0
br i1 %83, label %145, label %84
84: ; preds = %80
%85 = icmp eq i32 %2, 0
%86 = zext i32 %2 to i64
%87 = and i64 %86, 1
%88 = icmp eq i32 %2, 1
%89 = and i64 %86, 4294967294
%90 = icmp eq i64 %87, 0
br label %91
91: ; preds = %84, %140
%92 = phi double [ %82, %84 ], [ %142, %140 ]
%93 = phi double [ %81, %84 ], [ %141, %140 ]
%94 = phi i32 [ 0, %84 ], [ %143, %140 ]
br i1 %85, label %140, label %95
95: ; preds = %91
%96 = mul i32 %94, %2
br i1 %88, label %124, label %97
97: ; preds = %95, %97
%98 = phi i64 [ %121, %97 ], [ 0, %95 ]
%99 = phi double [ %118, %97 ], [ %92, %95 ]
%100 = phi double [ %120, %97 ], [ %93, %95 ]
%101 = phi i64 [ %122, %97 ], [ 0, %95 ]
%102 = trunc i64 %98 to i32
%103 = add i32 %96, %102
%104 = zext i32 %103 to i64
%105 = getelementptr inbounds double, double* %1, i64 %104
%106 = load double, double* %105
%107 = fcmp ogt double %106, %99
%108 = select i1 %107, double %106, double %99
%109 = fcmp olt double %106, %100
%110 = select i1 %109, double %106, double %100
%111 = trunc i64 %98 to i32
%112 = or i32 %111, 1
%113 = add i32 %96, %112
%114 = zext i32 %113 to i64
%115 = getelementptr inbounds double, double* %1, i64 %114
%116 = load double, double* %115
%117 = fcmp ogt double %116, %108
%118 = select i1 %117, double %116, double %108
%119 = fcmp olt double %116, %110
%120 = select i1 %119, double %116, double %110
%121 = add nuw nsw i64 %98, 2
%122 = add i64 %101, 2
%123 = icmp eq i64 %122, %89
br i1 %123, label %124, label %97
124: ; preds = %97, %95
%125 = phi double [ undef, %95 ], [ %118, %97 ]
%126 = phi double [ undef, %95 ], [ %120, %97 ]
%127 = phi i64 [ 0, %95 ], [ %121, %97 ]
%128 = phi double [ %92, %95 ], [ %118, %97 ]
%129 = phi double [ %93, %95 ], [ %120, %97 ]
br i1 %90, label %140, label %130
130: ; preds = %124
%131 = trunc i64 %127 to i32
%132 = add i32 %96, %131
%133 = zext i32 %132 to i64
%134 = getelementptr inbounds double, double* %1, i64 %133
%135 = load double, double* %134
%136 = fcmp ogt double %135, %128
%137 = select i1 %136, double %135, double %128
%138 = fcmp olt double %135, %129
%139 = select i1 %138, double %135, double %129
br label %140
140: ; preds = %130, %124, %91
%141 = phi double [ %93, %91 ], [ %126, %124 ], [ %139, %130 ]
%142 = phi double [ %92, %91 ], [ %125, %124 ], [ %137, %130 ]
%143 = add nuw nsw i32 %94, 1
%144 = icmp eq i32 %143, %3
br i1 %144, label %145, label %91
145: ; preds = %140, %80
%146 = phi double [ %81, %80 ], [ %141, %140 ]
%147 = phi double [ %82, %80 ], [ %142, %140 ]
%148 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3, i64 1, i32* %0)
%149 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
%150 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 255)
br i1 %83, label %187, label %151
151: ; preds = %145
%152 = icmp eq i32 %2, 0
%153 = fsub double %147, %146
%154 = zext i32 %2 to i64
br label %155
155: ; preds = %151, %183
%156 = phi i32 [ 0, %151 ], [ %185, %183 ]
br i1 %152, label %183, label %157
157: ; preds = %155
%158 = mul i32 %156, %2
br label %159
159: ; preds = %157, %159
%160 = phi i64 [ 0, %157 ], [ %181, %159 ]
%161 = trunc i64 %160 to i32
%162 = add i32 %158, %161
%163 = zext i32 %162 to i64
%164 = getelementptr inbounds double, double* %1, i64 %163
%165 = load double, double* %164
%166 = fsub double %165, %146
%167 = fmul double %166, 1.024000e+03
%168 = fdiv double %167, %153
%169 = fptosi double %168 to i32
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %170
%172 = load i8, i8* %171
%173 = zext i8 %172 to i32
%174 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %170
%175 = load i8, i8* %174
%176 = zext i8 %175 to i32
%177 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %170
%178 = load i8, i8* %177
%179 = zext i8 %178 to i32
%180 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %173, i32 %176, i32 %179)
%181 = add nuw nsw i64 %160, 1
%182 = icmp eq i64 %181, %154
br i1 %182, label %183, label %159
183: ; preds = %159, %155
%184 = tail call i32 @fputc(i32 10, i32* %0)
%185 = add nuw i32 %156, 1
%186 = icmp eq i32 %185, %3
br i1 %186, label %187, label %155
187: ; preds = %183, %145
ret void
}