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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int /*<<< orphan*/ *stdout;
void generate_c_source(char *id, char *header_dir, int width, int height,
                       const unsigned short *t_bitmap, int t_width,
                       int t_height, int t_depth) {
  FILE *f;
  FILE *fh;
  int i, a;
  char header_name[1024];
  if (!id || !id[0])
    id = "bitmap";
  f = stdout;
  if (header_dir && header_dir[0]) {
    snprintf(header_name, sizeof(header_name), "%s/%s.h", header_dir, id);
    fh = fopen(header_name, "w+");
    if (fh == NULL) {
      printf("error - can't open '%s'\n", header_name);
      return;
    }
    fprintf(fh,
            "#define BMPHEIGHT_%s %d\n"
            "#define BMPWIDTH_%s %d\n",
            id, height, id, width);
    if (t_depth <= 8)
      fprintf(fh, "extern const unsigned char %s[];\n", id);
    else
      fprintf(fh, "extern const unsigned short %s[];\n", id);
    fclose(fh);
  } else {
    fprintf(f,
            "#define BMPHEIGHT_%s %d\n"
            "#define BMPWIDTH_%s %d\n",
            id, height, id, width);
  }
  if (t_depth <= 8)
    fprintf(f, "const unsigned char %s[] = {\n", id);
  else
    fprintf(f, "const unsigned short %s[] = {\n", id);
  for (i = 0; i < t_height; i++) {
    for (a = 0; a < t_width; a++) {
      if (t_depth <= 8)
        fprintf(f, "0x%02x,%c", t_bitmap[i * t_width + a],
                (a + 1) % 13 ? ' ' : '\n');
      else
        fprintf(f, "0x%04x,%c", t_bitmap[i * t_width + a],
                (a + 1) % 10 ? ' ' : '\n');
    }
    fprintf(f, "\n");
  }
  fprintf(f, "\n};\n");
}


x86 assembly (clang, -O0):
<generate_c_source>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118f <generate_c_source+0x3f>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    119a <generate_c_source+0x4a>
lea    0xe6a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1287 <generate_c_source+0x137>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1287 <generate_c_source+0x137>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    $0x400,%esi
lea    0xe29(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x440(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    121d <generate_c_source+0xcd>
lea    -0x440(%rbp),%rsi
lea    0xdff(%rip),%rdi
call   1040 <printf@plt>
jmp    1403 <generate_c_source+0x2b3>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%r8
mov    -0x14(%rbp),%r9d
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x8,0x18(%rbp)
jg     1263 <generate_c_source+0x113>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe04(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1279 <generate_c_source+0x129>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe0b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
jmp    12a8 <generate_c_source+0x158>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%r8
mov    -0x14(%rbp),%r9d
lea    0xd8a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x8,0x18(%rbp)
jg     12cd <generate_c_source+0x17d>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xddf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12e3 <generate_c_source+0x193>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xde2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    13f1 <generate_c_source+0x2a1>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13d1 <generate_c_source+0x281>
cmpl   $0x8,0x18(%rbp)
jg     136b <generate_c_source+0x21b>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,2),%eax
mov    %eax,-0x444(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    -0x444(%rbp),%edx
mov    $0xa,%ecx
mov    $0x20,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xd7e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13be <generate_c_source+0x26e>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,2),%eax
mov    %eax,-0x448(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    -0x448(%rbp),%edx
mov    $0xa,%ecx
mov    $0x20,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xd30(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13c3 <generate_c_source+0x273>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12fd <generate_c_source+0x1ad>
mov    -0x30(%rbp),%rdi
lea    0xc4d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12ea <generate_c_source+0x19a>
mov    -0x30(%rbp),%rdi
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_c_source>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %r9d,0x4(%rsp)
mov    %r8,%r13
mov    %ecx,%r14d
mov    %edx,%r9d
mov    %rsi,%rcx
test   %rdi,%rdi
je     119f <generate_c_source+0x2f>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
jne    11a6 <generate_c_source+0x36>
lea    0xe5a(%rip),%r15
mov    0x468(%rsp),%ebx
mov    0x2e2c(%rip),%rax
mov    (%rax),%r12
test   %rcx,%rcx
je     1253 <generate_c_source+0xe3>
cmpb   $0x0,(%rcx)
je     1253 <generate_c_source+0xe3>
mov    %r9d,%ebx
lea    0xe34(%rip),%rdx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r15,%r8
call   1050 <snprintf@plt>
lea    0xe20(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1381 <generate_c_source+0x211>
mov    %rax,%rbp
lea    0xe21(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %r15,%r8
mov    %ebx,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x468(%rsp),%ebx
cmp    $0x9,%ebx
lea    0xe2a(%rip),%rax
lea    0xe45(%rip),%rsi
cmovl  %rax,%rsi
mov    %rbp,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
jmp    126d <generate_c_source+0xfd>
lea    0xdd1(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x460(%rsp),%ebp
cmp    $0x9,%ebx
lea    0xe22(%rip),%rax
lea    0xe39(%rip),%rsi
cmovl  %rax,%rsi
mov    %r12,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %ebp,%ebp
jle    1356 <generate_c_source+0x1e6>
xor    %eax,%eax
cmp    $0x9,%ebx
setl   %al
movslq 0x4(%rsp),%rcx
mov    %ebp,%edx
mov    %rdx,0x8(%rsp)
mov    %ecx,%r14d
lea    0xa(%rax,%rax,2),%r15d
lea    0xe1c(%rip),%rax
lea    0xe1f(%rip),%rbp
cmovl  %rax,%rbp
add    %rcx,%rcx
mov    %rcx,0x10(%rsp)
xor    %eax,%eax
jmp    1302 <generate_c_source+0x192>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x18(%rsp),%rax
add    $0x1,%rax
add    0x10(%rsp),%r13
cmp    0x8(%rsp),%rax
je     1356 <generate_c_source+0x1e6>
mov    %rax,0x18(%rsp)
cmpl   $0x0,0x4(%rsp)
jle    12e0 <generate_c_source+0x170>
xor    %esi,%esi
jmp    133b <generate_c_source+0x1cb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzwl 0x0(%r13,%rsi,2),%edx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rsi
cmp    %rbx,%r14
je     12e0 <generate_c_source+0x170>
lea    0x1(%rsi),%rbx
mov    %ebx,%eax
xor    %edx,%edx
div    %r15d
mov    $0xa,%ecx
test   %edx,%edx
je     1320 <generate_c_source+0x1b0>
mov    $0x20,%ecx
jmp    1320 <generate_c_source+0x1b0>
lea    0xd94(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc8a(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1040 <printf@plt>
jmp    136f <generate_c_source+0x1ff>

LLVM IR (-O0):
@.str = [7 x i8] c"bitmap\00"
@stdout = global i32* null
@.str.1 = [8 x i8] c"%s/%s.h\00"
@.str.2 = [3 x i8] c"w+\00"
@.str.3 = [25 x i8] c"error - can't open '%s'\0A\00"
@.str.4 = [48 x i8] c"#define BMPHEIGHT_%s %d\0A#define BMPWIDTH_%s %d\0A\00"
@.str.5 = [34 x i8] c"extern const unsigned char %s[];\0A\00"
@.str.6 = [35 x i8] c"extern const unsigned short %s[];\0A\00"
@.str.7 = [30 x i8] c"const unsigned char %s[] = {\0A\00"
@.str.8 = [31 x i8] c"const unsigned short %s[] = {\0A\00"
@.str.9 = [10 x i8] c"0x%02x,%c\00"
@.str.10 = [10 x i8] c"0x%04x,%c\00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [5 x i8] c"\0A};\0A\00"
define void @generate_c_source(i8* %0, i8* %1, i32 %2, i32 %3, i16* %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i16*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i32
%21 = alloca [1024 x i8]
store i8* %0, i8** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i16* %4, i16** %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%22 = load i8*, i8** %9
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %29
24: ; preds = %8
%25 = load i8*, i8** %9
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %24, %8
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %9
br label %30
30: ; preds = %29, %24
%31 = load i32*, i32** @stdout
store i32* %31, i32** %17
%32 = load i8*, i8** %10
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %72
34: ; preds = %30
%35 = load i8*, i8** %10
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %72
40: ; preds = %34
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%42 = load i8*, i8** %10
%43 = load i8*, i8** %9
%44 = call i32 @snprintf(i8* %41, i32 1024, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %42, i8* %43)
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %46, i32** %18
%47 = load i32*, i32** %18
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %52
49: ; preds = %40
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%51 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %50)
br label %154
52: ; preds = %40
%53 = load i32*, i32** %18
%54 = load i8*, i8** %9
%55 = load i32, i32* %12
%56 = load i8*, i8** %9
%57 = load i32, i32* %11
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %54, i32 %55, i8* %56, i32 %57)
%59 = load i32, i32* %16
%60 = icmp sle i32 %59, 8
br i1 %60, label %61, label %65
61: ; preds = %52
%62 = load i32*, i32** %18
%63 = load i8*, i8** %9
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %63)
br label %69
65: ; preds = %52
%66 = load i32*, i32** %18
%67 = load i8*, i8** %9
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i8* %67)
br label %69
69: ; preds = %65, %61
%70 = load i32*, i32** %18
%71 = call i32 @fclose(i32* %70)
br label %79
72: ; preds = %34, %30
%73 = load i32*, i32** %17
%74 = load i8*, i8** %9
%75 = load i32, i32* %12
%76 = load i8*, i8** %9
%77 = load i32, i32* %11
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %74, i32 %75, i8* %76, i32 %77)
br label %79
79: ; preds = %72, %69
%80 = load i32, i32* %16
%81 = icmp sle i32 %80, 8
br i1 %81, label %82, label %86
82: ; preds = %79
%83 = load i32*, i32** %17
%84 = load i8*, i8** %9
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %84)
br label %90
86: ; preds = %79
%87 = load i32*, i32** %17
%88 = load i8*, i8** %9
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %88)
br label %90
90: ; preds = %86, %82
store i32 0, i32* %19
br label %91
91: ; preds = %148, %90
%92 = load i32, i32* %19
%93 = load i32, i32* %15
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %151
95: ; preds = %91
store i32 0, i32* %20
br label %96
96: ; preds = %142, %95
%97 = load i32, i32* %20
%98 = load i32, i32* %14
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %145
100: ; preds = %96
%101 = load i32, i32* %16
%102 = icmp sle i32 %101, 8
br i1 %102, label %103, label %122
103: ; preds = %100
%104 = load i32*, i32** %17
%105 = load i16*, i16** %13
%106 = load i32, i32* %19
%107 = load i32, i32* %14
%108 = mul nsw i32 %106, %107
%109 = load i32, i32* %20
%110 = add nsw i32 %108, %109
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i16, i16* %105, i64 %111
%113 = load i16, i16* %112
%114 = zext i16 %113 to i32
%115 = load i32, i32* %20
%116 = add nsw i32 %115, 1
%117 = srem i32 %116, 13
%118 = icmp ne i32 %117, 0
%119 = zext i1 %118 to i64
%120 = select i1 %118, i32 32, i32 10
%121 = call i32 (i32*, i8*, ...) @fprintf(i32* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %114, i32 %120)
br label %141
122: ; preds = %100
%123 = load i32*, i32** %17
%124 = load i16*, i16** %13
%125 = load i32, i32* %19
%126 = load i32, i32* %14
%127 = mul nsw i32 %125, %126
%128 = load i32, i32* %20
%129 = add nsw i32 %127, %128
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i16, i16* %124, i64 %130
%132 = load i16, i16* %131
%133 = zext i16 %132 to i32
%134 = load i32, i32* %20
%135 = add nsw i32 %134, 1
%136 = srem i32 %135, 10
%137 = icmp ne i32 %136, 0
%138 = zext i1 %137 to i64
%139 = select i1 %137, i32 32, i32 10
%140 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %133, i32 %139)
br label %141
141: ; preds = %122, %103
br label %142
142: ; preds = %141
%143 = load i32, i32* %20
%144 = add nsw i32 %143, 1
store i32 %144, i32* %20
br label %96
145: ; preds = %96
%146 = load i32*, i32** %17
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %148
148: ; preds = %145
%149 = load i32, i32* %19
%150 = add nsw i32 %149, 1
store i32 %150, i32* %19
br label %91
151: ; preds = %91
%152 = load i32*, i32** %17
%153 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %154
154: ; preds = %151, %49
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"bitmap\00"
@stdout = global i32* null
@.str.1 = [8 x i8] c"%s/%s.h\00"
@.str.2 = [3 x i8] c"w+\00"
@.str.3 = [25 x i8] c"error - can't open '%s'\0A\00"
@.str.4 = [48 x i8] c"#define BMPHEIGHT_%s %d\0A#define BMPWIDTH_%s %d\0A\00"
@.str.5 = [34 x i8] c"extern const unsigned char %s[];\0A\00"
@.str.6 = [35 x i8] c"extern const unsigned short %s[];\0A\00"
@.str.7 = [30 x i8] c"const unsigned char %s[] = {\0A\00"
@.str.8 = [31 x i8] c"const unsigned short %s[] = {\0A\00"
@.str.9 = [10 x i8] c"0x%02x,%c\00"
@.str.10 = [10 x i8] c"0x%04x,%c\00"
@.str.12 = [5 x i8] c"\0A};\0A\00"
define void @generate_c_source(i8* %0, i8* %1, i32 %2, i32 %3, i16* nocapture %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca [1024 x i8]
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%11 = icmp eq i8* %0, null
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = load i8, i8* %0
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %8
br label %16
16: ; preds = %15, %12
%17 = phi i8* [ %0, %12 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %15 ]
%18 = load i32*, i32** @stdout
%19 = icmp eq i8* %1, null
br i1 %19, label %35, label %20
20: ; preds = %16
%21 = load i8, i8* %1
%22 = icmp eq i8 %21, 0
br i1 %22, label %35, label %23
23: ; preds = %20
%24 = call i32 @snprintf(i8* %10, i32 1024, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %17)
%25 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %72
29: ; preds = %23
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %17, i32 %3, i8* %17, i32 %2)
%31 = icmp slt i32 %7, 9
%32 = select i1 %31, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0)
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* %32, i8* %17)
%34 = call i32 @fclose(i32* %25)
br label %37
35: ; preds = %20, %16
%36 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %17, i32 %3, i8* %17, i32 %2)
br label %37
37: ; preds = %35, %29
%38 = icmp slt i32 %7, 9
%39 = select i1 %38, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0)
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* %39, i8* %17)
%41 = icmp sgt i32 %6, 0
br i1 %41, label %42, label %70
42: ; preds = %37
%43 = icmp sgt i32 %5, 0
%44 = sext i32 %5 to i64
%45 = zext i32 %6 to i64
%46 = zext i32 %5 to i64
%47 = select i1 %38, i32 13, i32 10
%48 = select i1 %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0)
br label %49
49: ; preds = %42, %66
%50 = phi i64 [ 0, %42 ], [ %68, %66 ]
br i1 %43, label %51, label %66
51: ; preds = %49
%52 = mul nsw i64 %50, %44
br label %53
53: ; preds = %51, %53
%54 = phi i64 [ 0, %51 ], [ %59, %53 ]
%55 = add nsw i64 %54, %52
%56 = getelementptr inbounds i16, i16* %4, i64 %55
%57 = load i16, i16* %56
%58 = zext i16 %57 to i32
%59 = add nuw nsw i64 %54, 1
%60 = trunc i64 %59 to i32
%61 = urem i32 %60, %47
%62 = icmp eq i32 %61, 0
%63 = select i1 %62, i32 10, i32 32
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* %48, i32 %58, i32 %63)
%65 = icmp eq i64 %59, %46
br i1 %65, label %66, label %53
66: ; preds = %53, %49
%67 = call i32 @fputc(i32 10, i32* %18)
%68 = add nuw nsw i64 %50, 1
%69 = icmp eq i64 %68, %45
br i1 %69, label %70, label %49
70: ; preds = %66, %37
%71 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i64 4, i64 1, i32* %18)
br label %72
72: ; preds = %70, %27
ret void
}