#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 */
scalar_t__ EOF;
int /*<<< orphan*/ errorf(char *, char const *);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(unsigned char, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char const *, char *);
void write_pgm_float(const char *fname, const float *data, int ncol, int nrow) {
  FILE *f;
  int i, j;
  int v, max, min;
  max = min = 0;
  for (i = 0; i < nrow; i++)
    for (j = 0; j < ncol; j++) {
      v = (int)data[j + i * ncol];
      if (v > max)
        max = v;
      if (v < min)
        min = v;
    }
  if (min < 0)
    fprintf(stderr, "Warning: negative values in '%s'.\n", fname);
  if (max > 255)
    fprintf(stderr, "Warning: values exceeding 255 in '%s'.\n", fname);
  if (strcmp(fname, "-") == 0)
    f = stdout;
  else
    f = fopen(fname, "w");
  if (f == NULL)
    errorf("Error: unable to open output image file ", fname);
  fprintf(f, "P5\n");
  fprintf(f, "%u %u\n", ncol, nrow);
  fprintf(f, "%d\n", 255);
  for (i = 0; i < nrow; i++)
    for (j = 0; j < ncol; j++)
      fputc((unsigned char)data[j + i * ncol], f);
  if (f != stdout && fclose(f) == EOF)
    errorf("Error: unable to close file while writing PGM file ", fname);
}


x86 assembly (clang, -O0):
<write_pgm_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    120f <write_pgm_float+0xaf>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fc <write_pgm_float+0x9c>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cvttss2si (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    11d7 <write_pgm_float+0x77>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11e9 <write_pgm_float+0x89>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11ee <write_pgm_float+0x8e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119e <write_pgm_float+0x3e>
jmp    1201 <write_pgm_float+0xa1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118b <write_pgm_float+0x2b>
cmpl   $0x0,-0x34(%rbp)
jge    1235 <write_pgm_float+0xd5>
mov    0x2db8(%rip),%rax
movslq (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0xff,-0x30(%rbp)
jle    125e <write_pgm_float+0xfe>
mov    0x2d8f(%rip),%rax
movslq (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    128b <write_pgm_float+0x12b>
mov    0x2d51(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    129f <write_pgm_float+0x13f>
mov    -0x8(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12ba <write_pgm_float+0x15a>
mov    -0x8(%rbp),%rsi
lea    0xd9a(%rip),%rdi
call   1070 <errorf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xd9f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xd94(%rip),%rsi
mov    $0xff,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1368 <write_pgm_float+0x208>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1355 <write_pgm_float+0x1f5>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%esi
imul   %esi,%edx
add    %edx,%ecx
movslq %ecx,%rcx
cvttss2si (%rax,%rcx,4),%eax
mov    -0x20(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1315 <write_pgm_float+0x1b5>
jmp    135a <write_pgm_float+0x1fa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1302 <write_pgm_float+0x1a2>
mov    -0x20(%rbp),%rax
mov    0x2c5d(%rip),%rcx
cmp    (%rcx),%rax
je     13a5 <write_pgm_float+0x245>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c5c(%rip),%rcx
cmp    (%rcx),%rax
jne    13a5 <write_pgm_float+0x245>
mov    -0x8(%rbp),%rsi
lea    0xce7(%rip),%rdi
call   1070 <errorf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_pgm_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebx
mov    %edx,%r12d
mov    %rsi,%r13
mov    %rdi,%r14
movslq %edx,%rax
mov    %rax,0x8(%rsp)
mov    %ecx,%eax
mov    %rax,0x10(%rsp)
mov    %edx,%r15d
test   %ecx,%ecx
jle    13b2 <write_pgm_float+0x242>
mov    %ebx,(%rsp)
mov    %r15d,%r8d
and    $0xfffffff8,%r8d
lea    0x10(%r13),%rcx
mov    0x8(%rsp),%rax
lea    0x0(,%rax,4),%r9
lea    0x0(,%r15,4),%rsi
and    $0xffffffffffffffe0,%rsi
xor    %r10d,%r10d
mov    %r13,%rbx
xor    %eax,%eax
xor    %ebp,%ebp
jmp    11f5 <write_pgm_float+0x85>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r10
add    %r9,%rcx
add    %r9,%rbx
cmp    0x10(%rsp),%r10
je     136d <write_pgm_float+0x1fd>
test   %r12d,%r12d
jle    11e0 <write_pgm_float+0x70>
cmp    $0x8,%r12d
jae    1210 <write_pgm_float+0xa0>
xor    %edx,%edx
jmp    1350 <write_pgm_float+0x1e0>
nopw   0x0(%rax,%rax,1)
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm0
movd   %ebp,%xmm1
pshufd $0x0,%xmm1,%xmm2
xor    %eax,%eax
movdqa %xmm0,%xmm1
movdqa %xmm2,%xmm3
nopl   0x0(%rax)
movups -0x10(%rcx,%rax,1),%xmm4
movups (%rcx,%rax,1),%xmm5
cvttps2dq %xmm4,%xmm4
cvttps2dq %xmm5,%xmm5
movdqa %xmm2,%xmm6
pcmpgtd %xmm4,%xmm2
pand   %xmm2,%xmm6
pandn  %xmm4,%xmm2
por    %xmm6,%xmm2
movdqa %xmm3,%xmm6
pcmpgtd %xmm5,%xmm3
pand   %xmm3,%xmm6
pandn  %xmm5,%xmm3
por    %xmm6,%xmm3
movdqa %xmm4,%xmm6
pcmpgtd %xmm0,%xmm6
movdqa %xmm0,%xmm7
pand   %xmm6,%xmm7
pandn  %xmm4,%xmm6
movdqa %xmm6,%xmm0
por    %xmm7,%xmm0
movdqa %xmm5,%xmm4
pcmpgtd %xmm1,%xmm4
movdqa %xmm1,%xmm6
pand   %xmm4,%xmm6
pandn  %xmm5,%xmm4
movdqa %xmm4,%xmm1
por    %xmm6,%xmm1
add    $0x20,%rax
cmp    %rax,%rsi
jne    1230 <write_pgm_float+0xc0>
movdqa %xmm2,%xmm4
pcmpgtd %xmm3,%xmm4
pand   %xmm4,%xmm2
pandn  %xmm3,%xmm4
por    %xmm2,%xmm4
pshufd $0xee,%xmm4,%xmm2
movdqa %xmm4,%xmm3
pcmpgtd %xmm2,%xmm3
pand   %xmm3,%xmm4
pandn  %xmm2,%xmm3
por    %xmm4,%xmm3
pshufd $0x55,%xmm3,%xmm2
movdqa %xmm3,%xmm4
pcmpgtd %xmm2,%xmm4
pand   %xmm4,%xmm3
pandn  %xmm2,%xmm4
por    %xmm3,%xmm4
movd   %xmm4,%ebp
movdqa %xmm1,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
pshufd $0xee,%xmm2,%xmm0
movdqa %xmm0,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
pshufd $0x55,%xmm1,%xmm0
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm1
pandn  %xmm0,%xmm2
por    %xmm1,%xmm2
movd   %xmm2,%eax
mov    %r8,%rdx
cmp    %r15,%r8
je     11e0 <write_pgm_float+0x70>
nopw   0x0(%rax,%rax,1)
cvttss2si (%rbx,%rdx,4),%edi
cmp    %edi,%ebp
cmovl  %edi,%ebp
cmp    %edi,%eax
cmovg  %edi,%eax
add    $0x1,%rdx
cmp    %rdx,%r15
jne    1350 <write_pgm_float+0x1e0>
jmp    11e0 <write_pgm_float+0x70>
test   %eax,%eax
jns    138c <write_pgm_float+0x21c>
mov    0x2c60(%rip),%rax
movslq (%rax),%rdi
lea    0xc7e(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x100,%ebp
mov    (%rsp),%ebx
jl     13b2 <write_pgm_float+0x242>
mov    0x2c3a(%rip),%rax
movslq (%rax),%rdi
lea    0xc7b(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xc92(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     14da <write_pgm_float+0x36a>
lea    0xc7c(%rip),%rsi
mov    %r14,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbp
test   %rbp,%rbp
jne    13f0 <write_pgm_float+0x280>
lea    0xc67(%rip),%rdi
mov    %r14,%rsi
call   1070 <errorf@plt>
mov    %r14,(%rsp)
lea    0xc7d(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1090 <fwrite@plt>
lea    0xc68(%rip),%rsi
mov    %rbp,%rdi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xc59(%rip),%rsi
mov    %rbp,%rdi
mov    $0xff,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %ebx,%ebx
jle    148d <write_pgm_float+0x31d>
shlq   $0x2,0x8(%rsp)
xor    %ebx,%ebx
jmp    1460 <write_pgm_float+0x2f0>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    0x8(%rsp),%r13
cmp    0x10(%rsp),%rbx
je     148d <write_pgm_float+0x31d>
test   %r12d,%r12d
jle    1450 <write_pgm_float+0x2e0>
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
cvttss2si 0x0(%r13,%r14,4),%eax
movzbl %al,%edi
mov    %rbp,%rsi
call   1040 <fputc@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    1470 <write_pgm_float+0x300>
jmp    1450 <write_pgm_float+0x2e0>
mov    0x2b3c(%rip),%rax
cmp    (%rax),%rbp
je     14cb <write_pgm_float+0x35b>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    0x2b40(%rip),%rcx
cmp    (%rcx),%rax
jne    14cb <write_pgm_float+0x35b>
lea    0xbd3(%rip),%rdi
mov    (%rsp),%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <errorf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aef(%rip),%rax
mov    (%rax),%rbp
test   %rbp,%rbp
jne    13f0 <write_pgm_float+0x280>
jmp    13e1 <write_pgm_float+0x271>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Warning: negative values in '%s'.\0A\00"
@.str.1 = [40 x i8] c"Warning: values exceeding 255 in '%s'.\0A\00"
@.str.2 = [2 x i8] c"-\00"
@stdout = global i32* null
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [41 x i8] c"Error: unable to open output image file \00"
@.str.5 = [4 x i8] c"P5\0A\00"
@.str.6 = [7 x i8] c"%u %u\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.8 = [52 x i8] c"Error: unable to close file while writing PGM file \00"
define void @write_pgm_float(i8* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %14
store i32 0, i32* %13
store i32 0, i32* %10
br label %15
15: ; preds = %51, %4
%16 = load i32, i32* %10
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %54
19: ; preds = %15
store i32 0, i32* %11
br label %20
20: ; preds = %47, %19
%21 = load i32, i32* %11
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %50
24: ; preds = %20
%25 = load float*, float** %6
%26 = load i32, i32* %11
%27 = load i32, i32* %10
%28 = load i32, i32* %7
%29 = mul nsw i32 %27, %28
%30 = add nsw i32 %26, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %25, i64 %31
%33 = load float, float* %32
%34 = fptosi float %33 to i32
store i32 %34, i32* %12
%35 = load i32, i32* %12
%36 = load i32, i32* %13
%37 = icmp sgt i32 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %24
%39 = load i32, i32* %12
store i32 %39, i32* %13
br label %40
40: ; preds = %38, %24
%41 = load i32, i32* %12
%42 = load i32, i32* %14
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load i32, i32* %12
store i32 %45, i32* %14
br label %46
46: ; preds = %44, %40
br label %47
47: ; preds = %46
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %20
50: ; preds = %20
br label %51
51: ; preds = %50
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %15
54: ; preds = %15
%55 = load i32, i32* %14
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = sext i32 %58 to i64
%60 = inttoptr i64 %59 to i32*
%61 = load i8*, i8** %5
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %61)
br label %63
63: ; preds = %57, %54
%64 = load i32, i32* %13
%65 = icmp sgt i32 %64, 255
br i1 %65, label %66, label %72
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = sext i32 %67 to i64
%69 = inttoptr i64 %68 to i32*
%70 = load i8*, i8** %5
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %66, %63
%73 = load i8*, i8** %5
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = load i32*, i32** @stdout
store i32* %77, i32** %9
br label %81
78: ; preds = %72
%79 = load i8*, i8** %5
%80 = call i32* @fopen(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %80, i32** %9
br label %81
81: ; preds = %78, %76
%82 = load i32*, i32** %9
%83 = icmp eq i32* %82, null
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i8*, i8** %5
%86 = call i32 @errorf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %85)
br label %87
87: ; preds = %84, %81
%88 = load i32*, i32** %9
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%90 = load i32*, i32** %9
%91 = load i32, i32* %7
%92 = load i32, i32* %8
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %91, i32 %92)
%94 = load i32*, i32** %9
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 255)
store i32 0, i32* %10
br label %96
96: ; preds = %122, %87
%97 = load i32, i32* %10
%98 = load i32, i32* %8
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %125
100: ; preds = %96
store i32 0, i32* %11
br label %101
101: ; preds = %118, %100
%102 = load i32, i32* %11
%103 = load i32, i32* %7
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %121
105: ; preds = %101
%106 = load float*, float** %6
%107 = load i32, i32* %11
%108 = load i32, i32* %10
%109 = load i32, i32* %7
%110 = mul nsw i32 %108, %109
%111 = add nsw i32 %107, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds float, float* %106, i64 %112
%114 = load float, float* %113
%115 = fptoui float %114 to i8
%116 = load i32*, i32** %9
%117 = call i32 @fputc(i8 zeroext %115, i32* %116)
br label %118
118: ; preds = %105
%119 = load i32, i32* %11
%120 = add nsw i32 %119, 1
store i32 %120, i32* %11
br label %101
121: ; preds = %101
br label %122
122: ; preds = %121
%123 = load i32, i32* %10
%124 = add nsw i32 %123, 1
store i32 %124, i32* %10
br label %96
125: ; preds = %96
%126 = load i32*, i32** %9
%127 = load i32*, i32** @stdout
%128 = icmp ne i32* %126, %127
br i1 %128, label %129, label %137
129: ; preds = %125
%130 = load i32*, i32** %9
%131 = call i64 @fclose(i32* %130)
%132 = load i64, i64* @EOF
%133 = icmp eq i64 %131, %132
br i1 %133, label %134, label %137
134: ; preds = %129
%135 = load i8*, i8** %5
%136 = call i32 @errorf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.8, i64 0, i64 0), i8* %135)
br label %137
137: ; preds = %134, %129, %125
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Warning: negative values in '%s'.\0A\00"
@.str.1 = [40 x i8] c"Warning: values exceeding 255 in '%s'.\0A\00"
@.str.2 = [2 x i8] c"-\00"
@stdout = global i32* null
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [41 x i8] c"Error: unable to open output image file \00"
@.str.5 = [4 x i8] c"P5\0A\00"
@.str.6 = [7 x i8] c"%u %u\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.8 = [52 x i8] c"Error: unable to close file while writing PGM file \00"
define void @write_pgm_float(i8* %0, float* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %94
6: ; preds = %4
%7 = icmp sgt i32 %2, 0
%8 = sext i32 %2 to i64
%9 = zext i32 %3 to i64
%10 = zext i32 %2 to i64
%11 = icmp ult i32 %2, 8
%12 = and i64 %10, 4294967288
%13 = icmp eq i64 %12, %10
br label %14
14: ; preds = %6, %75
%15 = phi i64 [ 0, %6 ], [ %78, %75 ]
%16 = phi i32 [ 0, %6 ], [ %77, %75 ]
%17 = phi i32 [ 0, %6 ], [ %76, %75 ]
br i1 %7, label %18, label %75
18: ; preds = %14
%19 = mul nsw i64 %15, %8
br i1 %11, label %57, label %20
20: ; preds = %18
%21 = insertelement <4 x i32> poison, i32 %16, i64 0
%22 = shufflevector <4 x i32> %21, <4 x i32> poison, <4 x i32> zeroinitializer
%23 = insertelement <4 x i32> poison, i32 %17, i64 0
%24 = shufflevector <4 x i32> %23, <4 x i32> poison, <4 x i32> zeroinitializer
br label %25
25: ; preds = %25, %20
%26 = phi i64 [ 0, %20 ], [ %48, %25 ]
%27 = phi <4 x i32> [ %22, %20 ], [ %46, %25 ]
%28 = phi <4 x i32> [ %22, %20 ], [ %47, %25 ]
%29 = phi <4 x i32> [ %24, %20 ], [ %42, %25 ]
%30 = phi <4 x i32> [ %24, %20 ], [ %43, %25 ]
%31 = add nsw i64 %26, %19
%32 = getelementptr inbounds float, float* %1, i64 %31
%33 = bitcast float* %32 to <4 x float>*
%34 = load <4 x float>, <4 x float>* %33
%35 = getelementptr inbounds float, float* %32, i64 4
%36 = bitcast float* %35 to <4 x float>*
%37 = load <4 x float>, <4 x float>* %36
%38 = fptosi <4 x float> %34 to <4 x i32>
%39 = fptosi <4 x float> %37 to <4 x i32>
%40 = icmp slt <4 x i32> %29, %38
%41 = icmp slt <4 x i32> %30, %39
%42 = select <4 x i1> %40, <4 x i32> %38, <4 x i32> %29
%43 = select <4 x i1> %41, <4 x i32> %39, <4 x i32> %30
%44 = icmp sgt <4 x i32> %27, %38
%45 = icmp sgt <4 x i32> %28, %39
%46 = select <4 x i1> %44, <4 x i32> %38, <4 x i32> %27
%47 = select <4 x i1> %45, <4 x i32> %39, <4 x i32> %28
%48 = add nuw i64 %26, 8
%49 = icmp eq i64 %48, %12
br i1 %49, label %50, label %25
50: ; preds = %25
%51 = icmp sgt <4 x i32> %42, %43
%52 = select <4 x i1> %51, <4 x i32> %42, <4 x i32> %43
%53 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %52)
%54 = icmp slt <4 x i32> %46, %47
%55 = select <4 x i1> %54, <4 x i32> %46, <4 x i32> %47
%56 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %55)
br i1 %13, label %75, label %57
57: ; preds = %18, %50
%58 = phi i64 [ 0, %18 ], [ %12, %50 ]
%59 = phi i32 [ %16, %18 ], [ %56, %50 ]
%60 = phi i32 [ %17, %18 ], [ %53, %50 ]
br label %61
61: ; preds = %57, %61
%62 = phi i64 [ %73, %61 ], [ %58, %57 ]
%63 = phi i32 [ %72, %61 ], [ %59, %57 ]
%64 = phi i32 [ %70, %61 ], [ %60, %57 ]
%65 = add nsw i64 %62, %19
%66 = getelementptr inbounds float, float* %1, i64 %65
%67 = load float, float* %66
%68 = fptosi float %67 to i32
%69 = icmp slt i32 %64, %68
%70 = select i1 %69, i32 %68, i32 %64
%71 = icmp sgt i32 %63, %68
%72 = select i1 %71, i32 %68, i32 %63
%73 = add nuw nsw i64 %62, 1
%74 = icmp eq i64 %73, %10
br i1 %74, label %75, label %61
75: ; preds = %61, %50, %14
%76 = phi i32 [ %17, %14 ], [ %53, %50 ], [ %70, %61 ]
%77 = phi i32 [ %16, %14 ], [ %56, %50 ], [ %72, %61 ]
%78 = add nuw nsw i64 %15, 1
%79 = icmp eq i64 %78, %9
br i1 %79, label %80, label %14
80: ; preds = %75
%81 = icmp slt i32 %77, 0
br i1 %81, label %82, label %87
82: ; preds = %80
%83 = load i32, i32* @stderr
%84 = sext i32 %83 to i64
%85 = inttoptr i64 %84 to i32*
%86 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %87
87: ; preds = %82, %80
%88 = icmp sgt i32 %76, 255
br i1 %88, label %89, label %94
89: ; preds = %87
%90 = load i32, i32* @stderr
%91 = sext i32 %90 to i64
%92 = inttoptr i64 %91 to i32*
%93 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %94
94: ; preds = %4, %89, %87
%95 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = load i32*, i32** @stdout
br label %101
99: ; preds = %94
%100 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %101
101: ; preds = %99, %97
%102 = phi i32* [ %98, %97 ], [ %100, %99 ]
%103 = icmp eq i32* %102, null
br i1 %103, label %104, label %106
104: ; preds = %101
%105 = tail call i32 @errorf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %106
106: ; preds = %104, %101
%107 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 3, i64 1, i32* %102)
%108 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %102, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %2, i32 %3)
%109 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 255)
br i1 %5, label %110, label %131
110: ; preds = %106
%111 = icmp sgt i32 %2, 0
%112 = sext i32 %2 to i64
%113 = zext i32 %3 to i64
%114 = zext i32 %2 to i64
br label %115
115: ; preds = %110, %128
%116 = phi i64 [ 0, %110 ], [ %129, %128 ]
br i1 %111, label %117, label %128
117: ; preds = %115
%118 = mul nsw i64 %116, %112
br label %119
119: ; preds = %117, %119
%120 = phi i64 [ 0, %117 ], [ %126, %119 ]
%121 = add nsw i64 %120, %118
%122 = getelementptr inbounds float, float* %1, i64 %121
%123 = load float, float* %122
%124 = fptoui float %123 to i8
%125 = tail call i32 @fputc(i8 zeroext %124, i32* %102)
%126 = add nuw nsw i64 %120, 1
%127 = icmp eq i64 %126, %114
br i1 %127, label %128, label %119
128: ; preds = %119, %115
%129 = add nuw nsw i64 %116, 1
%130 = icmp eq i64 %129, %113
br i1 %130, label %131, label %115
131: ; preds = %128, %106
%132 = load i32*, i32** @stdout
%133 = icmp eq i32* %102, %132
br i1 %133, label %140, label %134
134: ; preds = %131
%135 = tail call i64 @fclose(i32* %102)
%136 = load i64, i64* @EOF
%137 = icmp eq i64 %135, %136
br i1 %137, label %138, label %140
138: ; preds = %134
%139 = tail call i32 @errorf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.8, i64 0, i64 0), i8* %0)
br label %140
140: ; preds = %138, %134, %131
ret void
}