#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 uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, ...);
size_t fwrite(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
void ppm_write(char *outfile_name, char format_flag, uint8_t *buf, int width,
               int height) {
  if (NULL == buf) {
    fprintf(stderr, "ERROR: The buffer passed to ppm_write was NULL\n");
    exit(EXIT_FAILURE);
  }
  FILE *output_file = fopen(outfile_name, "w");
  if (NULL == output_file) {
    fprintf(stderr, "ERROR: Output file could not be opened for writing\n");
    exit(EXIT_FAILURE);
  }
  if (format_flag != '3' && format_flag != '6') {
    fprintf(stderr,
            "ERROR: The format flag passed to ppm_write must be '3' or '6'\n");
    exit(EXIT_FAILURE);
  }
  if (0 >
      fprintf(output_file, "P%c\n%d %d\n255\n", format_flag, width, height)) {
    fprintf(stderr,
            "ERROR: An error occurred while writing to the output file 1\n");
    exit(EXIT_FAILURE);
  }
  int buf_len = sizeof(uint8_t) * width * height * 3;
  if (format_flag == '3') {
    for (int i = 0; i < buf_len; i++) {
      if (i % width == 0 && 0 > fprintf(output_file, "\n")) {
        fprintf(
            stderr,
            "ERROR: An error occurred while writing to the output file 2\n");
        exit(EXIT_FAILURE);
      }
      if (0 > fprintf(output_file, "%u ", buf[i])) {
        fprintf(
            stderr,
            "ERROR: An error occurred while writing to the output file 3\n");
        exit(EXIT_FAILURE);
      }
    }
  }
  if (format_flag == '6' &&
      !((size_t)buf_len ==
        fwrite(buf, sizeof(uint8_t), buf_len, output_file))) {
    fprintf(stderr,
            "ERROR: An error occurred while writing to the output file 4\n");
    exit(EXIT_FAILURE);
  }
  fclose(output_file);
  return;
}


x86 assembly (clang, -O0):
<ppm_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    119f <ppm_write+0x4f>
mov    0x2e60(%rip),%rax
mov    (%rax),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
jne    11e5 <ppm_write+0x95>
mov    0x2e1a(%rip),%rax
mov    (%rax),%rdi
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x33,%eax
je     1225 <ppm_write+0xd5>
movsbl -0x9(%rbp),%eax
cmp    $0x36,%eax
je     1225 <ppm_write+0xd5>
mov    0x2dda(%rip),%rax
mov    (%rax),%rdi
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x28(%rbp),%rdi
movsbl -0x9(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1276 <ppm_write+0x126>
mov    0x2d89(%rip),%rax
mov    (%rax),%rdi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
imul   $0x3,%rax,%rax
mov    %eax,-0x2c(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x33,%eax
jne    136c <ppm_write+0x21c>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1367 <ppm_write+0x217>
mov    -0x30(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
cmp    $0x0,%edx
jne    1303 <ppm_write+0x1b3>
mov    -0x28(%rbp),%rdi
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1303 <ppm_write+0x1b3>
mov    0x2cfc(%rip),%rax
mov    (%rax),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1354 <ppm_write+0x204>
mov    0x2cab(%rip),%rax
mov    (%rax),%rdi
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    1359 <ppm_write+0x209>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12a1 <ppm_write+0x151>
jmp    136c <ppm_write+0x21c>
movsbl -0x9(%rbp),%eax
cmp    $0x36,%eax
jne    13cc <ppm_write+0x27c>
movslq -0x2c(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x4,%esi
call   1070 <fwrite@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     13cc <ppm_write+0x27c>
mov    0x2c33(%rip),%rax
mov    (%rax),%rdi
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c13(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppm_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     128b <ppm_write+0x13b>
mov    %r8d,%ebp
mov    %ecx,%r12d
mov    %rdx,%r14
mov    %esi,%r15d
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     12a3 <ppm_write+0x153>
mov    %rax,%rbx
cmp    $0x33,%r15b
je     1198 <ppm_write+0x48>
cmp    $0x36,%r15b
jne    12ce <ppm_write+0x17e>
movzbl %r15b,%edx
lea    0xf02(%rip),%rsi
mov    %rbx,%rdi
mov    %r12d,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rax,%rax
js     12bb <ppm_write+0x16b>
imul   %r12d,%ebp
shl    $0x2,%ebp
lea    0x0(%rbp,%rbp,2),%eax
cmp    $0x36,%r15b
je     1231 <ppm_write+0xe1>
cmp    $0x33,%r15b
jne    124f <ppm_write+0xff>
test   %eax,%eax
jle    124f <ppm_write+0xff>
mov    %eax,%r15d
lea    0xf4d(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%eax
cltd
idiv   %r12d
test   %edx,%edx
jne    1210 <ppm_write+0xc0>
mov    %rbx,%rdi
lea    0xe9f(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rax,%rax
js     1278 <ppm_write+0x128>
mov    (%r14,%rbp,4),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rax,%rax
js     1265 <ppm_write+0x115>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    11f0 <ppm_write+0xa0>
jmp    124f <ppm_write+0xff>
movslq %eax,%rbp
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
cmp    %rbp,%rax
jne    12e6 <ppm_write+0x196>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%rcx
lea    0xebc(%rip),%rdi
jmp    12f7 <ppm_write+0x1a7>
mov    0x2d61(%rip),%rax
mov    (%rax),%rcx
lea    0xe68(%rip),%rdi
jmp    12f7 <ppm_write+0x1a7>
mov    0x2d4e(%rip),%rax
mov    (%rax),%rcx
lea    0xd64(%rip),%rdi
mov    $0x2f,%esi
jmp    12fc <ppm_write+0x1ac>
mov    0x2d36(%rip),%rax
mov    (%rax),%rcx
lea    0xd7e(%rip),%rdi
mov    $0x33,%esi
jmp    12fc <ppm_write+0x1ac>
mov    0x2d1e(%rip),%rax
mov    (%rax),%rcx
lea    0xde8(%rip),%rdi
jmp    12f7 <ppm_write+0x1a7>
mov    0x2d0b(%rip),%rax
mov    (%rax),%rcx
lea    0xd87(%rip),%rdi
mov    $0x3e,%esi
jmp    12fc <ppm_write+0x1ac>
mov    0x2cf3(%rip),%rax
mov    (%rax),%rcx
lea    0xe78(%rip),%rdi
mov    $0x3c,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [48 x i8] c"ERROR: The buffer passed to ppm_write was NULL\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [52 x i8] c"ERROR: Output file could not be opened for writing\0A\00"
@.str.3 = [63 x i8] c"ERROR: The format flag passed to ppm_write must be '3' or '6'\0A\00"
@.str.4 = [15 x i8] c"P%c\0A%d %d\0A255\0A\00"
@.str.5 = [61 x i8] c"ERROR: An error occurred while writing to the output file 1\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [61 x i8] c"ERROR: An error occurred while writing to the output file 2\0A\00"
@.str.8 = [4 x i8] c"%u \00"
@.str.9 = [61 x i8] c"ERROR: An error occurred while writing to the output file 3\0A\00"
@.str.10 = [61 x i8] c"ERROR: An error occurred while writing to the output file 4\0A\00"
define void @ppm_write(i8* %0, i8 signext %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %6
store i8 %1, i8* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load i32*, i32** %8
%15 = icmp eq i32* null, %14
br i1 %15, label %16, label %21
16: ; preds = %5
%17 = load i32*, i32** @stderr
%18 = call i64 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %5
%22 = load i8*, i8** %6
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %11
%24 = load i32*, i32** %11
%25 = icmp eq i32* null, %24
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32*, i32** @stderr
%28 = call i64 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %21
%32 = load i8, i8* %7
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 51
br i1 %34, label %35, label %44
35: ; preds = %31
%36 = load i8, i8* %7
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 54
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i32*, i32** @stderr
%41 = call i64 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %35, %31
%45 = load i32*, i32** %11
%46 = load i8, i8* %7
%47 = sext i8 %46 to i32
%48 = load i32, i32* %9
%49 = load i32, i32* %10
%50 = call i64 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %48, i32 %49)
%51 = icmp sgt i64 0, %50
br i1 %51, label %52, label %57
52: ; preds = %44
%53 = load i32*, i32** @stderr
%54 = call i64 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %44
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = mul i64 4, %59
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = mul i64 %60, %62
%64 = mul i64 %63, 3
%65 = trunc i64 %64 to i32
store i32 %65, i32* %12
%66 = load i8, i8* %7
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 51
br i1 %68, label %69, label %107
69: ; preds = %57
store i32 0, i32* %13
br label %70
70: ; preds = %103, %69
%71 = load i32, i32* %13
%72 = load i32, i32* %12
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %106
74: ; preds = %70
%75 = load i32, i32* %13
%76 = load i32, i32* %9
%77 = srem i32 %75, %76
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %88
79: ; preds = %74
%80 = load i32*, i32** %11
%81 = call i64 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%82 = icmp sgt i64 0, %81
br i1 %82, label %83, label %88
83: ; preds = %79
%84 = load i32*, i32** @stderr
%85 = call i64 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
%86 = load i32, i32* @EXIT_FAILURE
%87 = call i32 @exit(i32 %86)
unreachable
88: ; preds = %79, %74
%89 = load i32*, i32** %11
%90 = load i32*, i32** %8
%91 = load i32, i32* %13
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %90, i64 %92
%94 = load i32, i32* %93
%95 = call i64 (i32*, i8*, ...) @fprintf(i32* %89, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %94)
%96 = icmp sgt i64 0, %95
br i1 %96, label %97, label %102
97: ; preds = %88
%98 = load i32*, i32** @stderr
%99 = call i64 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %88
br label %103
103: ; preds = %102
%104 = load i32, i32* %13
%105 = add nsw i32 %104, 1
store i32 %105, i32* %13
br label %70
106: ; preds = %70
br label %107
107: ; preds = %106, %57
%108 = load i8, i8* %7
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 54
br i1 %110, label %111, label %124
111: ; preds = %107
%112 = load i32, i32* %12
%113 = sext i32 %112 to i64
%114 = load i32*, i32** %8
%115 = load i32, i32* %12
%116 = load i32*, i32** %11
%117 = call i64 @fwrite(i32* %114, i32 4, i32 %115, i32* %116)
%118 = icmp eq i64 %113, %117
br i1 %118, label %124, label %119
119: ; preds = %111
%120 = load i32*, i32** @stderr
%121 = call i64 (i32*, i8*, ...) @fprintf(i32* %120, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0))
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %111, %107
%125 = load i32*, i32** %11
%126 = call i32 @fclose(i32* %125)
ret void
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [48 x i8] c"ERROR: The buffer passed to ppm_write was NULL\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [52 x i8] c"ERROR: Output file could not be opened for writing\0A\00"
@.str.3 = [63 x i8] c"ERROR: The format flag passed to ppm_write must be '3' or '6'\0A\00"
@.str.4 = [15 x i8] c"P%c\0A%d %d\0A255\0A\00"
@.str.5 = [61 x i8] c"ERROR: An error occurred while writing to the output file 1\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [61 x i8] c"ERROR: An error occurred while writing to the output file 2\0A\00"
@.str.8 = [4 x i8] c"%u \00"
@.str.9 = [61 x i8] c"ERROR: An error occurred while writing to the output file 3\0A\00"
@.str.10 = [61 x i8] c"ERROR: An error occurred while writing to the output file 4\0A\00"
define void @ppm_write(i8* nocapture %0, i8 signext %1, i32* %2, i32 %3, i32 %4) {
%6 = icmp eq i32* %2, null
br i1 %6, label %7, label %12
7: ; preds = %5
%8 = load i32*, i32** @stderr
%9 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 47, i64 1, i32* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %5
%13 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32*, i32** @stderr
%17 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i64 51, i64 1, i32* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %12
switch i8 %1, label %21 [
i8 54, label %26
i8 51, label %26
]
21: ; preds = %20
%22 = load i32*, i32** @stderr
%23 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), i64 62, i64 1, i32* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %20, %20
%27 = zext i8 %1 to i32
%28 = tail call i64 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %27, i32 %3, i32 %4)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i32*, i32** @stderr
%32 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i64 60, i64 1, i32* %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = tail call i32 @exit(i32 %33)
unreachable
35: ; preds = %26
%36 = mul i32 %3, 12
%37 = mul i32 %36, %4
switch i8 %1, label %77 [
i8 51, label %38
i8 54, label %68
]
38: ; preds = %35
%39 = icmp sgt i32 %37, 0
br i1 %39, label %40, label %77
40: ; preds = %38
%41 = zext i32 %37 to i64
br label %44
42: ; preds = %57
%43 = icmp eq i64 %62, %41
br i1 %43, label %77, label %44
44: ; preds = %40, %42
%45 = phi i64 [ 0, %40 ], [ %62, %42 ]
%46 = trunc i64 %45 to i32
%47 = srem i32 %46, %3
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %44
%50 = tail call i64 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp slt i64 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = load i32*, i32** @stderr
%54 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i64 60, i64 1, i32* %53)
%55 = load i32, i32* @EXIT_FAILURE
%56 = tail call i32 @exit(i32 %55)
unreachable
57: ; preds = %49, %44
%58 = getelementptr inbounds i32, i32* %2, i64 %45
%59 = load i32, i32* %58
%60 = tail call i64 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %59)
%61 = icmp slt i64 %60, 0
%62 = add nuw nsw i64 %45, 1
br i1 %61, label %63, label %42
63: ; preds = %57
%64 = load i32*, i32** @stderr
%65 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0), i64 60, i64 1, i32* %64)
%66 = load i32, i32* @EXIT_FAILURE
%67 = tail call i32 @exit(i32 %66)
unreachable
68: ; preds = %35
%69 = sext i32 %37 to i64
%70 = tail call i64 @fwrite(i32* %2, i32 4, i32 %37, i32* %13)
%71 = icmp eq i64 %70, %69
br i1 %71, label %77, label %72
72: ; preds = %68
%73 = load i32*, i32** @stderr
%74 = tail call i64 bitcast (i64 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0), i64 60, i64 1, i32* %73)
%75 = load i32, i32* @EXIT_FAILURE
%76 = tail call i32 @exit(i32 %75)
unreachable
77: ; preds = %42, %38, %35, %68
%78 = tail call i32 @fclose(i32* %13)
ret void
}