#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int write_front_gmv(char *fn, int nV, double *vertex, int nF, int *face,
                    int *facematerial) {
  int i, mmax = 0, unkmat = 0;
  FILE *f;
  f = fopen(fn, "w");
  fprintf(f, "gmvinput ascii\n\nnodev %d\n", nV);
  for (i = 0; i < nV; i++) {
    fprintf(f, "  %20.15lf %20.15lf %20.15lf\n", vertex[3 * i + 0],
            vertex[3 * i + 1], vertex[3 * i + 2]);
  }
  fprintf(f, "\ncells %d\n", nF);
  for (i = 0; i < nF; i++) {
    fprintf(f, " tri 3\n  %d %d %d\n", face[3 * i + 0], face[3 * i + 1],
            face[3 * i + 2]);
    if (mmax < facematerial[i])
      mmax = facematerial[i];
    if (facematerial[i] == 0)
      unkmat = 1;
  }
  if (nF) {
    fprintf(f, "\nmaterial %d 0\n", mmax + unkmat);
    for (i = 0; i < mmax; i++)
      fprintf(f, "mat%d\n", i + 1);
    if (unkmat)
      fprintf(f, "unknown\n");
    for (i = 0; i < nF; i++) {
      fprintf(f, " %d", (facematerial[i]) ? facematerial[i] : mmax + unkmat);
    }
  }
  fprintf(f, "\nendgmv");
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<write_front_gmv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f1 <write_front_gmv+0xc1>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe40(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118c <write_front_gmv+0x5c>
mov    -0x48(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12ad <write_front_gmv+0x17d>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%esi
add    $0x2,%esi
movslq %esi,%rsi
mov    (%rax,%rsi,4),%r8d
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%eax
mov    -0x30(%rbp),%rcx
movslq -0x34(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1281 <write_front_gmv+0x151>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    129a <write_front_gmv+0x16a>
movl   $0x1,-0x3c(%rbp)
jmp    129f <write_front_gmv+0x16f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120d <write_front_gmv+0xdd>
cmpl   $0x0,-0x1c(%rbp)
je     1395 <write_front_gmv+0x265>
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%edx
add    -0x3c(%rbp),%edx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1308 <write_front_gmv+0x1d8>
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%edx
add    $0x1,%edx
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d6 <write_front_gmv+0x1a6>
cmpl   $0x0,-0x3c(%rbp)
je     1324 <write_front_gmv+0x1f4>
mov    -0x48(%rbp),%rdi
lea    0xd52(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1390 <write_front_gmv+0x260>
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1364 <write_front_gmv+0x234>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
jmp    136d <write_front_gmv+0x23d>
mov    -0x38(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xcfd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    132b <write_front_gmv+0x1fb>
jmp    1395 <write_front_gmv+0x265>
mov    -0x48(%rbp),%rdi
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_front_gmv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%rbp
mov    %ecx,0x4(%rsp)
mov    %rdx,%rbx
mov    %esi,%r13d
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
lea    0xe8c(%rip),%rsi
mov    %rax,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r13d,%r13d
jle    11ca <write_front_gmv+0x8a>
mov    %r13d,%eax
shl    $0x3,%rax
lea    (%rax,%rax,2),%r15
xor    %r13d,%r13d
lea    0xe7f(%rip),%r14
nopl   (%rax)
movsd  (%rbx,%r13,1),%xmm0
movsd  0x8(%rbx,%r13,1),%xmm1
movsd  0x10(%rbx,%r13,1),%xmm2
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
add    $0x18,%r13
cmp    %r13,%r15
jne    11a0 <write_front_gmv+0x60>
lea    0xe69(%rip),%rsi
mov    %r12,%rdi
mov    0x4(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%r15d
mov    $0x0,%edx
test   %ebx,%ebx
mov    0x10(%rsp),%rcx
mov    %r12,%r14
mov    $0x0,%r13d
jle    125d <write_front_gmv+0x11d>
add    $0x8,%rbp
xor    %ebx,%ebx
xor    %edx,%edx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %rdx,0x8(%rsp)
mov    -0x8(%rbp),%edx
mov    %rcx,%r12
mov    -0x4(%rbp),%ecx
mov    0x0(%rbp),%r8d
mov    %r14,%rdi
lea    0xe19(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdx
mov    %r12,%rcx
mov    (%r12,%rbx,4),%eax
cmp    %eax,%r13d
cmovl  %eax,%r13d
test   %eax,%eax
mov    $0x1,%esi
cmove  %esi,%edx
add    $0x1,%rbx
add    $0xc,%rbp
cmp    %rbx,%r15
jne    1210 <write_front_gmv+0xd0>
cmpl   $0x0,0x4(%rsp)
mov    %r14,%r12
je     1320 <write_front_gmv+0x1e0>
mov    %r13,%rbx
mov    %rdx,%r13
add    %ebx,%edx
lea    0xdde(%rip),%rsi
mov    %r12,%rdi
mov    %edx,0x8(%rsp)
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebx,%ebx
jle    12c1 <write_front_gmv+0x181>
neg    %ebx
mov    $0x1,%ebp
lea    0xdce(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    12a0 <write_front_gmv+0x160>
test   %r13d,%r13d
je     12df <write_front_gmv+0x19f>
lea    0xda2(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
cmpl   $0x0,0x4(%rsp)
mov    0x10(%rsp),%r13
mov    0x8(%rsp),%ebx
jle    1320 <write_front_gmv+0x1e0>
lea    0xd82(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,4),%edx
test   %edx,%edx
cmove  %ebx,%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1300 <write_front_gmv+0x1c0>
lea    0xd55(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [26 x i8] c"gmvinput ascii\0A\0Anodev %d\0A\00"
@.str.2 = [30 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.3 = [11 x i8] c"\0Acells %d\0A\00"
@.str.4 = [19 x i8] c" tri 3\0A %d %d %d\0A\00"
@.str.5 = [16 x i8] c"\0Amaterial %d 0\0A\00"
@.str.6 = [7 x i8] c"mat%d\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
@.str.8 = [4 x i8] c" %d\00"
@.str.9 = [8 x i8] c"\0Aendgmv\00"
define i32 @write_front_gmv(i8* %0, i32 %1, double* %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
store i8* %0, i8** %7
store i32 %1, i32* %8
store double* %2, double** %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
store i32 0, i32* %14
store i32 0, i32* %15
%17 = load i8*, i8** %7
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %16
%19 = load i32*, i32** %16
%20 = load i32, i32* %8
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i32 0, i32* %13
br label %22
22: ; preds = %50, %6
%23 = load i32, i32* %13
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %53
26: ; preds = %22
%27 = load i32*, i32** %16
%28 = load double*, double** %9
%29 = load i32, i32* %13
%30 = mul nsw i32 3, %29
%31 = add nsw i32 %30, 0
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %28, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %9
%36 = load i32, i32* %13
%37 = mul nsw i32 3, %36
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %35, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %9
%43 = load i32, i32* %13
%44 = mul nsw i32 3, %43
%45 = add nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %42, i64 %46
%48 = load double, double* %47
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %34, double %41, double %48)
br label %50
50: ; preds = %26
%51 = load i32, i32* %13
%52 = add nsw i32 %51, 1
store i32 %52, i32* %13
br label %22
53: ; preds = %22
%54 = load i32*, i32** %16
%55 = load i32, i32* %10
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %55)
store i32 0, i32* %13
br label %57
57: ; preds = %107, %53
%58 = load i32, i32* %13
%59 = load i32, i32* %10
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %110
61: ; preds = %57
%62 = load i32*, i32** %16
%63 = load i32*, i32** %11
%64 = load i32, i32* %13
%65 = mul nsw i32 3, %64
%66 = add nsw i32 %65, 0
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %63, i64 %67
%69 = load i32, i32* %68
%70 = load i32*, i32** %11
%71 = load i32, i32* %13
%72 = mul nsw i32 3, %71
%73 = add nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %70, i64 %74
%76 = load i32, i32* %75
%77 = load i32*, i32** %11
%78 = load i32, i32* %13
%79 = mul nsw i32 3, %78
%80 = add nsw i32 %79, 2
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %77, i64 %81
%83 = load i32, i32* %82
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %69, i32 %76, i32 %83)
%85 = load i32, i32* %14
%86 = load i32*, i32** %12
%87 = load i32, i32* %13
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
%90 = load i32, i32* %89
%91 = icmp slt i32 %85, %90
br i1 %91, label %92, label %98
92: ; preds = %61
%93 = load i32*, i32** %12
%94 = load i32, i32* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %93, i64 %95
%97 = load i32, i32* %96
store i32 %97, i32* %14
br label %98
98: ; preds = %92, %61
%99 = load i32*, i32** %12
%100 = load i32, i32* %13
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %99, i64 %101
%103 = load i32, i32* %102
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %98
store i32 1, i32* %15
br label %106
106: ; preds = %105, %98
br label %107
107: ; preds = %106
%108 = load i32, i32* %13
%109 = add nsw i32 %108, 1
store i32 %109, i32* %13
br label %57
110: ; preds = %57
%111 = load i32, i32* %10
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %167
113: ; preds = %110
%114 = load i32*, i32** %16
%115 = load i32, i32* %14
%116 = load i32, i32* %15
%117 = add nsw i32 %115, %116
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %117)
store i32 0, i32* %13
br label %119
119: ; preds = %128, %113
%120 = load i32, i32* %13
%121 = load i32, i32* %14
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %131
123: ; preds = %119
%124 = load i32*, i32** %16
%125 = load i32, i32* %13
%126 = add nsw i32 %125, 1
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %126)
br label %128
128: ; preds = %123
%129 = load i32, i32* %13
%130 = add nsw i32 %129, 1
store i32 %130, i32* %13
br label %119
131: ; preds = %119
%132 = load i32, i32* %15
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %131
%135 = load i32*, i32** %16
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %137
137: ; preds = %134, %131
store i32 0, i32* %13
br label %138
138: ; preds = %163, %137
%139 = load i32, i32* %13
%140 = load i32, i32* %10
%141 = icmp slt i32 %139, %140
br i1 %141, label %142, label %166
142: ; preds = %138
%143 = load i32*, i32** %16
%144 = load i32*, i32** %12
%145 = load i32, i32* %13
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i32, i32* %144, i64 %146
%148 = load i32, i32* %147
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %156
150: ; preds = %142
%151 = load i32*, i32** %12
%152 = load i32, i32* %13
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i32, i32* %151, i64 %153
%155 = load i32, i32* %154
br label %160
156: ; preds = %142
%157 = load i32, i32* %14
%158 = load i32, i32* %15
%159 = add nsw i32 %157, %158
br label %160
160: ; preds = %156, %150
%161 = phi i32 [ %155, %150 ], [ %159, %156 ]
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %161)
br label %163
163: ; preds = %160
%164 = load i32, i32* %13
%165 = add nsw i32 %164, 1
store i32 %165, i32* %13
br label %138
166: ; preds = %138
br label %167
167: ; preds = %166, %110
%168 = load i32*, i32** %16
%169 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%170 = load i32*, i32** %16
%171 = call i32 @fclose(i32* %170)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [26 x i8] c"gmvinput ascii\0A\0Anodev %d\0A\00"
@.str.2 = [30 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.3 = [11 x i8] c"\0Acells %d\0A\00"
@.str.4 = [19 x i8] c" tri 3\0A %d %d %d\0A\00"
@.str.5 = [16 x i8] c"\0Amaterial %d 0\0A\00"
@.str.6 = [7 x i8] c"mat%d\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
@.str.8 = [4 x i8] c" %d\00"
@.str.9 = [8 x i8] c"\0Aendgmv\00"
define i32 @write_front_gmv(i8* nocapture %0, i32 %1, double* nocapture %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %24, %12 ]
%14 = mul nuw nsw i64 %13, 3
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = load double, double* %15
%17 = add nuw nsw i64 %14, 1
%18 = getelementptr inbounds double, double* %2, i64 %17
%19 = load double, double* %18
%20 = add nuw nsw i64 %14, 2
%21 = getelementptr inbounds double, double* %2, i64 %20
%22 = load double, double* %21
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %16, double %19, double %22)
%24 = add nuw nsw i64 %13, 1
%25 = icmp eq i64 %24, %11
br i1 %25, label %26, label %12
26: ; preds = %12, %6
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %3)
%28 = icmp sgt i32 %3, 0
br i1 %28, label %29, label %53
29: ; preds = %26
%30 = zext i32 %3 to i64
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 0, %29 ], [ %51, %31 ]
%33 = phi i32 [ 0, %29 ], [ %50, %31 ]
%34 = phi i32 [ 0, %29 ], [ %48, %31 ]
%35 = mul nuw nsw i64 %32, 3
%36 = getelementptr inbounds i32, i32* %4, i64 %35
%37 = load i32, i32* %36
%38 = add nuw nsw i64 %35, 1
%39 = getelementptr inbounds i32, i32* %4, i64 %38
%40 = load i32, i32* %39
%41 = add nuw nsw i64 %35, 2
%42 = getelementptr inbounds i32, i32* %4, i64 %41
%43 = load i32, i32* %42
%44 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %37, i32 %40, i32 %43)
%45 = getelementptr inbounds i32, i32* %5, i64 %32
%46 = load i32, i32* %45
%47 = icmp slt i32 %34, %46
%48 = select i1 %47, i32 %46, i32 %34
%49 = icmp eq i32 %46, 0
%50 = select i1 %49, i32 1, i32 %33
%51 = add nuw nsw i64 %32, 1
%52 = icmp eq i64 %51, %30
br i1 %52, label %53, label %31
53: ; preds = %31, %26
%54 = phi i32 [ 0, %26 ], [ %48, %31 ]
%55 = phi i32 [ 0, %26 ], [ %50, %31 ]
%56 = icmp eq i32 %3, 0
br i1 %56, label %82, label %57
57: ; preds = %53
%58 = add nsw i32 %55, %54
%59 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %58)
%60 = icmp sgt i32 %54, 0
br i1 %60, label %61, label %66
61: ; preds = %57, %61
%62 = phi i32 [ %63, %61 ], [ 0, %57 ]
%63 = add nuw nsw i32 %62, 1
%64 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %63)
%65 = icmp eq i32 %63, %54
br i1 %65, label %66, label %61
66: ; preds = %61, %57
%67 = icmp eq i32 %55, 0
br i1 %67, label %70, label %68
68: ; preds = %66
%69 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 8, i64 1, i32* %7)
br label %70
70: ; preds = %68, %66
br i1 %28, label %71, label %82
71: ; preds = %70
%72 = zext i32 %3 to i64
br label %73
73: ; preds = %71, %73
%74 = phi i64 [ 0, %71 ], [ %80, %73 ]
%75 = getelementptr inbounds i32, i32* %5, i64 %74
%76 = load i32, i32* %75
%77 = icmp eq i32 %76, 0
%78 = select i1 %77, i32 %58, i32 %76
%79 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %78)
%80 = add nuw nsw i64 %74, 1
%81 = icmp eq i64 %80, %72
br i1 %81, label %82, label %73
82: ; preds = %73, %70, %53
%83 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i64 7, i64 1, i32* %7)
%84 = tail call i32 @fclose(i32* %7)
ret i32 0
}