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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ iie_load_PPM(unsigned char ***, char *);
int /*<<< orphan*/ iie_save_PGM(unsigned char **, char *);
int main(int argc, char *argv[]) {
  unsigned char src_image[256][256][3];
  unsigned char red[256][256][3];
  unsigned char green[256][256][3];
  unsigned char blue[256][256][3];
  unsigned char dst_image[256][256];
  int m, n;
  iie_load_PPM(src_image, argv[1]);
  for (m = 0; m < 256; m++) {
    for (n = 0; n < 256; n++) {
      red[m][n][0] = src_image[m][n][0];
      red[m][n][1] = 0;
      red[m][n][2] = 0;
      green[m][n][0] = 0;
      green[m][n][1] = src_image[m][n][1];
      green[m][n][2] = 0;
      blue[m][n][0] = 0;
      blue[m][n][1] = 0;
      blue[m][n][2] = src_image[m][n][2];
    }
  }
  for (m = 0; m < 256; m++) {
    for (n = 0; n < 256; n++) {
      dst_image[m][n] =
          0.299 * red[m][n][0] + 0.587 * green[m][n][1] + 0.114 * blue[m][n][2];
    }
  }
  iie_save_PGM(dst_image, argv[argc - 1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30010(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <iie_load_PPM@plt>
movl   $0x0,-0xd0014(%rbp)
cmpl   $0x100,-0xd0014(%rbp)
jge    139c <main+0x27c>
movl   $0x0,-0xd0018(%rbp)
cmpl   $0x100,-0xd0018(%rbp)
jge    1383 <main+0x263>
movslq -0xd0014(%rbp),%rcx
lea    -0x30010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%cl
movslq -0xd0014(%rbp),%rdx
lea    -0x60010(%rbp),%rax
imul   $0x300,%rdx,%rdx
add    %rdx,%rax
movslq -0xd0018(%rbp),%rdx
imul   $0x3,%rdx,%rdx
add    %rdx,%rax
mov    %cl,(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x60010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x1(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x60010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x2(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x90010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x30010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
mov    0x1(%rax),%cl
movslq -0xd0014(%rbp),%rdx
lea    -0x90010(%rbp),%rax
imul   $0x300,%rdx,%rdx
add    %rdx,%rax
movslq -0xd0018(%rbp),%rdx
imul   $0x3,%rdx,%rdx
add    %rdx,%rax
mov    %cl,0x1(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x90010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x2(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0xc0010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0xc0010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x1(%rax)
movslq -0xd0014(%rbp),%rcx
lea    -0x30010(%rbp),%rax
imul   $0x300,%rcx,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
mov    0x2(%rax),%cl
movslq -0xd0014(%rbp),%rdx
lea    -0xc0010(%rbp),%rax
imul   $0x300,%rdx,%rdx
add    %rdx,%rax
movslq -0xd0018(%rbp),%rdx
imul   $0x3,%rdx,%rdx
add    %rdx,%rax
mov    %cl,0x2(%rax)
mov    -0xd0018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0018(%rbp)
jmp    1171 <main+0x51>
jmp    1388 <main+0x268>
mov    -0xd0014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0014(%rbp)
jmp    1157 <main+0x37>
movl   $0x0,-0xd0014(%rbp)
cmpl   $0x100,-0xd0014(%rbp)
jge    149a <main+0x37a>
movl   $0x0,-0xd0018(%rbp)
cmpl   $0x100,-0xd0018(%rbp)
jge    1481 <main+0x361>
movslq -0xd0014(%rbp),%rax
shl    $0x8,%rax
lea    (%rax,%rax,2),%rax
lea    -0x60010(%rbp,%rax,1),%rdx
ff
movslq -0xd0018(%rbp),%rcx
lea    (%rcx,%rcx,2),%rcx
movzbl (%rdx,%rcx,1),%edx
cvtsi2sd %edx,%xmm1
lea    -0x90010(%rbp,%rax,1),%rdx
ff
movzbl 0x1(%rdx,%rcx,1),%edx
cvtsi2sd %edx,%xmm0
movsd  0xbed(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xbe9(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
lea    -0xc0010(%rbp,%rax,1),%rax
ff
movzbl 0x2(%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
movsd  0xbd0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %al,%dl
movslq -0xd0014(%rbp),%rcx
lea    -0xd0010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0xd0018(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xd0018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0018(%rbp)
jmp    13c0 <main+0x2a0>
jmp    1486 <main+0x366>
mov    -0xd0014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0014(%rbp)
jmp    13a6 <main+0x286>
lea    -0xd0010(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <iie_save_PGM@plt>
xor    %eax,%eax
add    $0xd0020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xd0008,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x8(%rsi),%rsi
lea    0xa0000(%rsp),%rdi
call   1040 <iie_load_PPM@plt>
lea    0x70002(%rsp),%rax
lea    0xa0002(%rsp),%rcx
lea    0x40002(%rsp),%rdx
lea    0x10002(%rsp),%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl -0x2(%rcx,%rbp,1),%ebx
mov    %bl,-0x2(%rax,%rbp,1)
movw   $0x0,-0x1(%rax,%rbp,1)
movb   $0x0,-0x2(%rdx,%rbp,1)
movzbl -0x1(%rcx,%rbp,1),%ebx
mov    %bl,-0x1(%rdx,%rbp,1)
movb   $0x0,(%rdx,%rbp,1)
movw   $0x0,-0x2(%rsi,%rbp,1)
movzbl (%rcx,%rbp,1),%ebx
mov    %bl,(%rsi,%rbp,1)
add    $0x3,%rbp
cmp    $0x300,%rbp
jne    1180 <main+0x60>
add    $0x1,%rdi
add    $0x300,%rax
add    $0x300,%rcx
add    $0x300,%rdx
add    $0x300,%rsi
cmp    $0x100,%rdi
jne    1170 <main+0x50>
lea    0x40004(%rsp),%rax
lea    0x10005(%rsp),%rcx
lea    0x70000(%rsp),%rdx
mov    %rsp,%r8
xor    %r9d,%r9d
pxor   %xmm0,%xmm0
movapd 0xdf1(%rip),%xmm1
movapd 0xdf9(%rip),%xmm2
movapd 0xe01(%rip),%xmm3
movsd  0xe08(%rip),%xmm8
movsd  0xe08(%rip),%xmm5
movsd  0xe08(%rip),%xmm6
nopl   0x0(%rax,%rax,1)
mov    %r8,%rsi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdx,%rbx,1),%ebp
movzbl 0x3(%rdx,%rbx,1),%edi
shl    $0x8,%edi
or     %ebp,%edi
movd   %edi,%xmm7
punpcklbw %xmm0,%xmm7
punpcklwd %xmm0,%xmm7
cvtdq2pd %xmm7,%xmm7
movzbl -0x3(%rax,%rbx,1),%edi
movzbl (%rax,%rbx,1),%ebp
shl    $0x8,%ebp
or     %edi,%ebp
movd   %ebp,%xmm4
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
cvtdq2pd %xmm4,%xmm4
mulpd  %xmm1,%xmm4
mulpd  %xmm2,%xmm7
addpd  %xmm4,%xmm7
movzbl -0x3(%rcx,%rbx,1),%edi
movzbl (%rcx,%rbx,1),%ebp
shl    $0x8,%ebp
or     %edi,%ebp
movd   %ebp,%xmm4
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
cvtdq2pd %xmm4,%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm7,%xmm4
cvttpd2dq %xmm4,%xmm4
packuswb %xmm4,%xmm4
packuswb %xmm4,%xmm4
movd   %xmm4,%edi
mov    %di,(%rsi)
add    $0x6,%rbx
add    $0x2,%rsi
cmp    $0x2fa,%rbx
jne    1250 <main+0x130>
mov    %r9,%rsi
shl    $0x8,%rsi
lea    (%rsi,%rsi,2),%rdi
movzbl 0x702fa(%rsp,%rdi,1),%ebp
xorps  %xmm4,%xmm4
cvtsi2sd %ebp,%xmm4
movzbl 0x402fb(%rsp,%rdi,1),%ebp
xorps  %xmm7,%xmm7
cvtsi2sd %ebp,%xmm7
mulsd  %xmm8,%xmm7
mulsd  %xmm5,%xmm4
addsd  %xmm7,%xmm4
movzbl 0x102fc(%rsp,%rdi,1),%ebp
xorps  %xmm7,%xmm7
cvtsi2sd %ebp,%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
cvttsd2si %xmm7,%ebp
movzbl 0x702fd(%rsp,%rdi,1),%ebx
xorps  %xmm4,%xmm4
cvtsi2sd %ebx,%xmm4
movzbl 0x402fe(%rsp,%rdi,1),%ebx
xorps  %xmm7,%xmm7
cvtsi2sd %ebx,%xmm7
mulsd  %xmm8,%xmm7
mulsd  %xmm5,%xmm4
addsd  %xmm7,%xmm4
movzbl 0x102ff(%rsp,%rdi,1),%edi
xorps  %xmm7,%xmm7
cvtsi2sd %edi,%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
cvttsd2si %xmm7,%edi
mov    %bpl,0xfe(%rsp,%rsi,1)
mov    %dil,0xff(%rsp,%rsi,1)
add    $0x1,%r9
add    $0x300,%rdx
add    $0x300,%rax
add    $0x300,%rcx
add    $0x100,%r8
cmp    $0x100,%r9
jne    1240 <main+0x120>
movslq %r14d,%rax
mov    -0x8(%r15,%rax,8),%rsi
mov    %rsp,%rdi
call   1030 <iie_save_PGM@plt>
xor    %eax,%eax
add    $0xd0008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x [256 x [3 x i8]]]
%7 = alloca [256 x [256 x [3 x i8]]]
%8 = alloca [256 x [256 x [3 x i8]]]
%9 = alloca [256 x [256 x [3 x i8]]]
%10 = alloca [256 x [256 x i8]]
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 0
%14 = bitcast [256 x [3 x i8]]* %13 to i8***
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @iie_load_PPM(i8*** %14, i8* %17)
store i32 0, i32* %11
br label %19
19: ; preds = %118, %2
%20 = load i32, i32* %11
%21 = icmp slt i32 %20, 256
br i1 %21, label %22, label %121
22: ; preds = %19
store i32 0, i32* %12
br label %23
23: ; preds = %114, %22
%24 = load i32, i32* %12
%25 = icmp slt i32 %24, 256
br i1 %25, label %26, label %117
26: ; preds = %23
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %28
%30 = load i32, i32* %12
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %29, i64 0, i64 %31
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %32, i64 0, i64 0
%34 = load i8, i8* %33
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %7, i64 0, i64 %36
%38 = load i32, i32* %12
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %37, i64 0, i64 %39
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %40, i64 0, i64 0
store i8 %34, i8* %41
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %7, i64 0, i64 %43
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %44, i64 0, i64 %46
%48 = getelementptr inbounds [3 x i8], [3 x i8]* %47, i64 0, i64 1
store i8 0, i8* %48
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %7, i64 0, i64 %50
%52 = load i32, i32* %12
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %51, i64 0, i64 %53
%55 = getelementptr inbounds [3 x i8], [3 x i8]* %54, i64 0, i64 2
store i8 0, i8* %55
%56 = load i32, i32* %11
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %8, i64 0, i64 %57
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %58, i64 0, i64 %60
%62 = getelementptr inbounds [3 x i8], [3 x i8]* %61, i64 0, i64 0
store i8 0, i8* %62
%63 = load i32, i32* %11
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %64
%66 = load i32, i32* %12
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %65, i64 0, i64 %67
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %68, i64 0, i64 1
%70 = load i8, i8* %69
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %8, i64 0, i64 %72
%74 = load i32, i32* %12
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %73, i64 0, i64 %75
%77 = getelementptr inbounds [3 x i8], [3 x i8]* %76, i64 0, i64 1
store i8 %70, i8* %77
%78 = load i32, i32* %11
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %8, i64 0, i64 %79
%81 = load i32, i32* %12
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %80, i64 0, i64 %82
%84 = getelementptr inbounds [3 x i8], [3 x i8]* %83, i64 0, i64 2
store i8 0, i8* %84
%85 = load i32, i32* %11
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %9, i64 0, i64 %86
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %87, i64 0, i64 %89
%91 = getelementptr inbounds [3 x i8], [3 x i8]* %90, i64 0, i64 0
store i8 0, i8* %91
%92 = load i32, i32* %11
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %9, i64 0, i64 %93
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %94, i64 0, i64 %96
%98 = getelementptr inbounds [3 x i8], [3 x i8]* %97, i64 0, i64 1
store i8 0, i8* %98
%99 = load i32, i32* %11
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %100
%102 = load i32, i32* %12
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %101, i64 0, i64 %103
%105 = getelementptr inbounds [3 x i8], [3 x i8]* %104, i64 0, i64 2
%106 = load i8, i8* %105
%107 = load i32, i32* %11
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %9, i64 0, i64 %108
%110 = load i32, i32* %12
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %109, i64 0, i64 %111
%113 = getelementptr inbounds [3 x i8], [3 x i8]* %112, i64 0, i64 2
store i8 %106, i8* %113
br label %114
114: ; preds = %26
%115 = load i32, i32* %12
%116 = add nsw i32 %115, 1
store i32 %116, i32* %12
br label %23
117: ; preds = %23
br label %118
118: ; preds = %117
%119 = load i32, i32* %11
%120 = add nsw i32 %119, 1
store i32 %120, i32* %11
br label %19
121: ; preds = %19
store i32 0, i32* %11
br label %122
122: ; preds = %174, %121
%123 = load i32, i32* %11
%124 = icmp slt i32 %123, 256
br i1 %124, label %125, label %177
125: ; preds = %122
store i32 0, i32* %12
br label %126
126: ; preds = %170, %125
%127 = load i32, i32* %12
%128 = icmp slt i32 %127, 256
br i1 %128, label %129, label %173
129: ; preds = %126
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %7, i64 0, i64 %131
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %132, i64 0, i64 %134
%136 = getelementptr inbounds [3 x i8], [3 x i8]* %135, i64 0, i64 0
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = sitofp i32 %138 to double
%140 = load i32, i32* %11
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %8, i64 0, i64 %141
%143 = load i32, i32* %12
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %142, i64 0, i64 %144
%146 = getelementptr inbounds [3 x i8], [3 x i8]* %145, i64 0, i64 1
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = sitofp i32 %148 to double
%150 = fmul double 5.870000e-01, %149
%151 = call double @llvm.fmuladd.f64(double 2.990000e-01, double %139, double %150)
%152 = load i32, i32* %11
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %9, i64 0, i64 %153
%155 = load i32, i32* %12
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [256 x [3 x i8]], [256 x [3 x i8]]* %154, i64 0, i64 %156
%158 = getelementptr inbounds [3 x i8], [3 x i8]* %157, i64 0, i64 2
%159 = load i8, i8* %158
%160 = zext i8 %159 to i32
%161 = sitofp i32 %160 to double
%162 = call double @llvm.fmuladd.f64(double 1.140000e-01, double %161, double %151)
%163 = fptoui double %162 to i8
%164 = load i32, i32* %11
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %10, i64 0, i64 %165
%167 = load i32, i32* %12
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [256 x i8], [256 x i8]* %166, i64 0, i64 %168
store i8 %163, i8* %169
br label %170
170: ; preds = %129
%171 = load i32, i32* %12
%172 = add nsw i32 %171, 1
store i32 %172, i32* %12
br label %126
173: ; preds = %126
br label %174
174: ; preds = %173
%175 = load i32, i32* %11
%176 = add nsw i32 %175, 1
store i32 %176, i32* %11
br label %122
177: ; preds = %122
%178 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %10, i64 0, i64 0
%179 = bitcast [256 x i8]* %178 to i8**
%180 = load i8**, i8*** %5
%181 = load i32, i32* %4
%182 = sub nsw i32 %181, 1
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i8*, i8** %180, i64 %183
%185 = load i8*, i8** %184
%186 = call i32 @iie_save_PGM(i8** %179, i8* %185)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x [256 x [3 x i8]]]
%4 = alloca [256 x [256 x [3 x i8]]]
%5 = alloca [256 x [256 x [3 x i8]]]
%6 = alloca [256 x [256 x [3 x i8]]]
%7 = alloca [256 x [256 x i8]]
%8 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %3, i64 0, i64 0, i64 0, i64 0
%9 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 0, i64 0, i64 0
%10 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 0, i64 0, i64 0
%11 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 0, i64 0, i64 0
%12 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %7, i64 0, i64 0, i64 0
%13 = bitcast [256 x [256 x [3 x i8]]]* %3 to i8***
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @iie_load_PPM(i8*** %13, i8* %15)
br label %17
17: ; preds = %2, %38
%18 = phi i64 [ 0, %2 ], [ %39, %38 ]
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %36, %19 ]
%21 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %3, i64 0, i64 %18, i64 %20, i64 0
%22 = load i8, i8* %21
%23 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %18, i64 %20, i64 0
store i8 %22, i8* %23
%24 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %18, i64 %20, i64 1
store i8 0, i8* %24
%25 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %18, i64 %20, i64 2
store i8 0, i8* %25
%26 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %18, i64 %20, i64 0
store i8 0, i8* %26
%27 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %3, i64 0, i64 %18, i64 %20, i64 1
%28 = load i8, i8* %27
%29 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %18, i64 %20, i64 1
store i8 %28, i8* %29
%30 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %18, i64 %20, i64 2
store i8 0, i8* %30
%31 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %18, i64 %20, i64 0
store i8 0, i8* %31
%32 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %18, i64 %20, i64 1
store i8 0, i8* %32
%33 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %3, i64 0, i64 %18, i64 %20, i64 2
%34 = load i8, i8* %33
%35 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %18, i64 %20, i64 2
store i8 %34, i8* %35
%36 = add nuw nsw i64 %20, 1
%37 = icmp eq i64 %36, 256
br i1 %37, label %38, label %19
38: ; preds = %19
%39 = add nuw nsw i64 %18, 1
%40 = icmp eq i64 %39, 256
br i1 %40, label %41, label %17
41: ; preds = %38, %75
%42 = phi i64 [ %104, %75 ], [ 0, %38 ]
br label %43
43: ; preds = %43, %41
%44 = phi i64 [ 0, %41 ], [ %73, %43 ]
%45 = or i64 %44, 1
%46 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %42, i64 %44, i64 0
%47 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %42, i64 %45, i64 0
%48 = load i8, i8* %46
%49 = load i8, i8* %47
%50 = insertelement <2 x i8> poison, i8 %48, i64 0
%51 = insertelement <2 x i8> %50, i8 %49, i64 1
%52 = uitofp <2 x i8> %51 to <2 x double>
%53 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %42, i64 %44, i64 1
%54 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %42, i64 %45, i64 1
%55 = load i8, i8* %53
%56 = load i8, i8* %54
%57 = insertelement <2 x i8> poison, i8 %55, i64 0
%58 = insertelement <2 x i8> %57, i8 %56, i64 1
%59 = uitofp <2 x i8> %58 to <2 x double>
%60 = fmul <2 x double> %59, <double 5.870000e-01, double 5.870000e-01>
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %52, <2 x double> <double 2.990000e-01, double 2.990000e-01>, <2 x double> %60)
%62 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %42, i64 %44, i64 2
%63 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %42, i64 %45, i64 2
%64 = load i8, i8* %62
%65 = load i8, i8* %63
%66 = insertelement <2 x i8> poison, i8 %64, i64 0
%67 = insertelement <2 x i8> %66, i8 %65, i64 1
%68 = uitofp <2 x i8> %67 to <2 x double>
%69 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %68, <2 x double> <double 1.140000e-01, double 1.140000e-01>, <2 x double> %61)
%70 = fptoui <2 x double> %69 to <2 x i8>
%71 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %7, i64 0, i64 %42, i64 %44
%72 = bitcast i8* %71 to <2 x i8>*
store <2 x i8> %70, <2 x i8>* %72
%73 = add nuw i64 %44, 2
%74 = icmp eq i64 %73, 254
br i1 %74, label %75, label %43
75: ; preds = %43
%76 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %42, i64 254, i64 0
%77 = load i8, i8* %76
%78 = uitofp i8 %77 to double
%79 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %42, i64 254, i64 1
%80 = load i8, i8* %79
%81 = uitofp i8 %80 to double
%82 = fmul double %81, 5.870000e-01
%83 = call double @llvm.fmuladd.f64(double %78, double 2.990000e-01, double %82)
%84 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %42, i64 254, i64 2
%85 = load i8, i8* %84
%86 = uitofp i8 %85 to double
%87 = call double @llvm.fmuladd.f64(double %86, double 1.140000e-01, double %83)
%88 = fptoui double %87 to i8
%89 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %7, i64 0, i64 %42, i64 254
store i8 %88, i8* %89
%90 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %4, i64 0, i64 %42, i64 255, i64 0
%91 = load i8, i8* %90
%92 = uitofp i8 %91 to double
%93 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %5, i64 0, i64 %42, i64 255, i64 1
%94 = load i8, i8* %93
%95 = uitofp i8 %94 to double
%96 = fmul double %95, 5.870000e-01
%97 = call double @llvm.fmuladd.f64(double %92, double 2.990000e-01, double %96)
%98 = getelementptr inbounds [256 x [256 x [3 x i8]]], [256 x [256 x [3 x i8]]]* %6, i64 0, i64 %42, i64 255, i64 2
%99 = load i8, i8* %98
%100 = uitofp i8 %99 to double
%101 = call double @llvm.fmuladd.f64(double %100, double 1.140000e-01, double %97)
%102 = fptoui double %101 to i8
%103 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %7, i64 0, i64 %42, i64 255
store i8 %102, i8* %103
%104 = add nuw nsw i64 %42, 1
%105 = icmp eq i64 %104, 256
br i1 %105, label %106, label %41
106: ; preds = %75
%107 = bitcast [256 x [256 x i8]]* %7 to i8**
%108 = add nsw i32 %0, -1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8*, i8** %1, i64 %109
%111 = load i8*, i8** %110
%112 = call i32 @iie_save_PGM(i8** %107, i8* %111)
ret i32 0
}