#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ memset(char ***, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, int, int);
int main(int argc, char *argv[]) {
  FILE *in[8][2];
  FILE *out;
  char filename[8][2][100];
  int sample;
  int cpus_num[8] = {2, 4, 8, 16, 24, 32, 40, 48};
  int cpus_u[2] = {6, 7, 8};
  int i, j;
  int flag = 0;
  memset(filename, 0, 100 * 8 * 2);
  if (argc < 3)
    exit(0);
  for (i = 0; i < 8; i++) {
    sprintf(filename[i][j], "out_%s_%d_0.%d", argv[1], cpus_num[i], cpus_u[j]);
    in[i][j] = fopen(filename[i][j], "r");
  }
  out = fopen(argv[1], "w");
  while (1) {
    for (i = 0; i < 8; i++) {
      for (j = 0; j < 2; j++) {
        if (fscanf(in[i][j], "%d", &sample) != 1) {
          if (i == 8 - 1) {
            flag = 1;
            break;
          } else
            fprintf(out, "       ");
        } else
          fprintf(out, "%7d", sample);
        fprintf(out, "\t");
      }
      if (i == 8 - 1)
        fprintf(out, "\n");
      else
        fprintf(out, "\t");
    }
    if (flag)
      break;
  }
  fclose(out);
  for (i = 0; i < 8; i++)
    for (j = 0; j < 2; j++)
      fclose(in[i][j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x730,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x710(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x708(%rbp)
mov    0xe64(%rip),%rax
mov    %rax,-0x700(%rbp)
mov    0xe5e(%rip),%rax
mov    %rax,-0x6f8(%rbp)
mov    0xe58(%rip),%rax
mov    %rax,-0x718(%rbp)
movl   $0x0,-0x724(%rbp)
lea    -0x6e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x640,%edx
call   1040 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
jge    11fd <main+0x8d>
xor    %edi,%edi
call   1090 <exit@plt>
movl   $0x0,-0x71c(%rbp)
cmpl   $0x8,-0x71c(%rbp)
jge    12d4 <main+0x164>
movslq -0x71c(%rbp),%rax
lea    -0x6e0(%rbp),%rdi
imul   $0xc8,%rax,%rax
add    %rax,%rdi
movslq -0x720(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
movslq -0x71c(%rbp),%rax
mov    -0x710(%rbp,%rax,4),%ecx
movslq -0x720(%rbp),%rax
mov    -0x718(%rbp,%rax,4),%r8d
ff
lea    0xdc2(%rip),%rsi
call   1080 <sprintf@plt>
movslq -0x71c(%rbp),%rax
lea    -0x6e0(%rbp),%rdi
imul   $0xc8,%rax,%rax
add    %rax,%rdi
movslq -0x720(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
lea    0xd9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rdx
movslq -0x71c(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x720(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x71c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x71c(%rbp)
jmp    1207 <main+0x97>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd56(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x71c(%rbp)
cmpl   $0x8,-0x71c(%rbp)
jge    1428 <main+0x2b8>
movl   $0x0,-0x720(%rbp)
cmpl   $0x2,-0x720(%rbp)
jge    13d3 <main+0x263>
movslq -0x71c(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x720(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcf0(%rip),%rsi
lea    -0x6e4(%rbp),%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     138f <main+0x21f>
cmpl   $0x7,-0x71c(%rbp)
jne    1375 <main+0x205>
movl   $0x1,-0x724(%rbp)
jmp    13d3 <main+0x263>
mov    -0x98(%rbp),%rdi
lea    0xcb8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13aa <main+0x23a>
mov    -0x98(%rbp),%rdi
mov    -0x6e4(%rbp),%edx
lea    0xca0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x98(%rbp),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x720(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x720(%rbp)
jmp    1310 <main+0x1a0>
cmpl   $0x7,-0x71c(%rbp)
jne    13fa <main+0x28a>
mov    -0x98(%rbp),%rdi
lea    0xc5b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    140f <main+0x29f>
mov    -0x98(%rbp),%rdi
lea    0xc3f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1414 <main+0x2a4>
mov    -0x71c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x71c(%rbp)
jmp    12f9 <main+0x189>
cmpl   $0x0,-0x724(%rbp)
je     143a <main+0x2ca>
jmp    143f <main+0x2cf>
jmp    12ef <main+0x17f>
mov    -0x98(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x71c(%rbp)
cmpl   $0x8,-0x71c(%rbp)
jge    14cb <main+0x35b>
movl   $0x0,-0x720(%rbp)
cmpl   $0x2,-0x720(%rbp)
jge    14b2 <main+0x342>
movslq -0x71c(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x720(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <fclose@plt>
mov    -0x720(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x720(%rbp)
jmp    146c <main+0x2fc>
jmp    14b7 <main+0x347>
mov    -0x71c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x71c(%rbp)
jmp    1455 <main+0x2e5>
xor    %eax,%eax
add    $0x730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6e8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xa0(%rsp),%rdi
xor    %esi,%esi
mov    $0x640,%edx
call   1040 <memset@plt>
cmp    $0x3,%ebp
jl     1565 <main+0x3d5>
mov    0x8(%rbx),%rdx
lea    0xe32(%rip),%r15
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x2,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
lea    0xe1c(%rip),%r12
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x20(%rsp)
lea    0x168(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x4,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x30(%rsp)
lea    0x230(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x8,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x40(%rsp)
lea    0x2f8(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x10,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x50(%rsp)
lea    0x3c0(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x18,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x60(%rsp)
lea    0x488(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x20,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x70(%rsp)
lea    0x550(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x28,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x18(%rsp)
mov    %rax,0x80(%rsp)
lea    0x618(%rsp),%rbp
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x30,%ecx
mov    $0x6,%r8d
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <fopen@plt>
mov    %rax,0x10(%rsp)
mov    %rax,0x90(%rsp)
mov    0x8(%rbx),%rdi
lea    0xc95(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xc81(%rip),%r12
lea    0xc(%rsp),%r13
lea    0xc84(%rip),%rbp
jmp    13ad <main+0x21d>
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
xor    %r14d,%r14d
jmp    13f5 <main+0x265>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
cmp    $0x7,%r14
je     13a0 <main+0x210>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%r14
mov    %r14,%r15
shl    $0x4,%r15
mov    0x20(%rsp,%r15,1),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
jne    1430 <main+0x2a0>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    144f <main+0x2bf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x7,%r14
je     14a6 <main+0x316>
mov    $0x7,%esi
mov    $0x1,%edx
lea    0xbcc(%rip),%rdi
mov    %rbx,%rcx
call   10b0 <fwrite@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    0x28(%rsp,%r15,1),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     13c0 <main+0x230>
cmp    $0x7,%r14
je     14a6 <main+0x316>
mov    $0x7,%esi
mov    $0x1,%edx
lea    0xb87(%rip),%rdi
mov    %rbx,%rcx
call   10b0 <fwrite@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
jmp    13e4 <main+0x254>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x28(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x30(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x38(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x40(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x48(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x50(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x58(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x60(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x68(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x70(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x78(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x18(%rsp),%rdi
call   1030 <fclose@plt>
call   1030 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1030 <fclose@plt>
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x6e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@__const.main.cpus_num = [8 x i32] [i32 2, i32 4, i32 8, i32 16, i32 24, i32 32, i32 40, i32 48]
@__const.main.cpus_u = [2 x i32] [i32 6, i32 7]
@.str = [15 x i8] c"out_%s_%d_0.%d\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [8 x i8] c" \00"
@.str.5 = [4 x i8] c"%7d\00"
@.str.6 = [2 x i8] c"\09\00"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x [2 x i32*]]
%7 = alloca i32*
%8 = alloca [8 x [2 x [100 x i8]]]
%9 = alloca i32
%10 = alloca [8 x i32]
%11 = alloca [2 x i32]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [8 x i32]* %10 to i8*
%16 = bitcast [2 x i32]* %11 to i8*
store i32 0, i32* %14
%17 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %8, i64 0, i64 0
%18 = bitcast [2 x [100 x i8]]* %17 to i8***
%19 = call i32 @memset(i8*** %18, i32 0, i32 1600)
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
store i32 0, i32* %12
br label %25
25: ; preds = %62, %24
%26 = load i32, i32* %12
%27 = icmp slt i32 %26, 8
br i1 %27, label %28, label %65
28: ; preds = %25
%29 = load i32, i32* %12
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %8, i64 0, i64 %30
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [2 x [100 x i8]], [2 x [100 x i8]]* %31, i64 0, i64 %33
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %38, i32 %42, i32 %46)
%48 = load i32, i32* %12
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %8, i64 0, i64 %49
%51 = load i32, i32* %13
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [2 x [100 x i8]], [2 x [100 x i8]]* %50, i64 0, i64 %52
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %53, i64 0, i64 0
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%56 = load i32, i32* %12
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %6, i64 0, i64 %57
%59 = load i32, i32* %13
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [2 x i32*], [2 x i32*]* %58, i64 0, i64 %60
store i32* %55, i32** %61
br label %62
62: ; preds = %28
%63 = load i32, i32* %12
%64 = add nsw i32 %63, 1
store i32 %64, i32* %12
br label %25
65: ; preds = %25
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 1
%68 = load i8*, i8** %67
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %69, i32** %7
br label %70
70: ; preds = %65, %123
store i32 0, i32* %12
br label %71
71: ; preds = %116, %70
%72 = load i32, i32* %12
%73 = icmp slt i32 %72, 8
br i1 %73, label %74, label %119
74: ; preds = %71
store i32 0, i32* %13
br label %75
75: ; preds = %103, %74
%76 = load i32, i32* %13
%77 = icmp slt i32 %76, 2
br i1 %77, label %78, label %106
78: ; preds = %75
%79 = load i32, i32* %12
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %6, i64 0, i64 %80
%82 = load i32, i32* %13
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [2 x i32*], [2 x i32*]* %81, i64 0, i64 %83
%85 = load i32*, i32** %84
%86 = call i32 @fscanf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %9)
%87 = icmp ne i32 %86, 1
br i1 %87, label %88, label %96
88: ; preds = %78
%89 = load i32, i32* %12
%90 = icmp eq i32 %89, 7
br i1 %90, label %91, label %92
91: ; preds = %88
store i32 1, i32* %14
br label %106
92: ; preds = %88
%93 = load i32*, i32** %7
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %95
95: ; preds = %92
br label %100
96: ; preds = %78
%97 = load i32*, i32** %7
%98 = load i32, i32* %9
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %98)
br label %100
100: ; preds = %96, %95
%101 = load i32*, i32** %7
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %103
103: ; preds = %100
%104 = load i32, i32* %13
%105 = add nsw i32 %104, 1
store i32 %105, i32* %13
br label %75
106: ; preds = %91, %75
%107 = load i32, i32* %12
%108 = icmp eq i32 %107, 7
br i1 %108, label %109, label %112
109: ; preds = %106
%110 = load i32*, i32** %7
%111 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %115
112: ; preds = %106
%113 = load i32*, i32** %7
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %115
115: ; preds = %112, %109
br label %116
116: ; preds = %115
%117 = load i32, i32* %12
%118 = add nsw i32 %117, 1
store i32 %118, i32* %12
br label %71
119: ; preds = %71
%120 = load i32, i32* %14
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %119
br label %124
123: ; preds = %119
br label %70
124: ; preds = %122
%125 = load i32*, i32** %7
%126 = call i32 @fclose(i32* %125)
store i32 0, i32* %12
br label %127
127: ; preds = %147, %124
%128 = load i32, i32* %12
%129 = icmp slt i32 %128, 8
br i1 %129, label %130, label %150
130: ; preds = %127
store i32 0, i32* %13
br label %131
131: ; preds = %143, %130
%132 = load i32, i32* %13
%133 = icmp slt i32 %132, 2
br i1 %133, label %134, label %146
134: ; preds = %131
%135 = load i32, i32* %12
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %6, i64 0, i64 %136
%138 = load i32, i32* %13
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [2 x i32*], [2 x i32*]* %137, i64 0, i64 %139
%141 = load i32*, i32** %140
%142 = call i32 @fclose(i32* %141)
br label %143
143: ; preds = %134
%144 = load i32, i32* %13
%145 = add nsw i32 %144, 1
store i32 %145, i32* %13
br label %131
146: ; preds = %131
br label %147
147: ; preds = %146
%148 = load i32, i32* %12
%149 = add nsw i32 %148, 1
store i32 %149, i32* %12
br label %127
150: ; preds = %127
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"out_%s_%d_0.%d\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [8 x i8] c" \00"
@.str.5 = [4 x i8] c"%7d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x [2 x i32*]]
%4 = alloca [8 x [2 x [100 x i8]]]
%5 = alloca i32
%6 = bitcast [8 x [2 x i32*]]* %3 to i8*
%7 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 0, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
%9 = bitcast [8 x [2 x [100 x i8]]]* %4 to i8***
%10 = call i32 @memset(i8*** %9, i32 0, i32 1600)
%11 = icmp slt i32 %0, 3
br i1 %11, label %55, label %12
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %14, i32 2, i32 6)
%16 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 0, i64 0
store i32* %16, i32** %17
%18 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 1, i64 0, i64 0
%19 = load i8*, i8** %13
%20 = call i32 @sprintf(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %19, i32 4, i32 6)
%21 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 1, i64 0
store i32* %21, i32** %22
%23 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 2, i64 0, i64 0
%24 = load i8*, i8** %13
%25 = call i32 @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %24, i32 8, i32 6)
%26 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 2, i64 0
store i32* %26, i32** %27
%28 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 3, i64 0, i64 0
%29 = load i8*, i8** %13
%30 = call i32 @sprintf(i8* %28, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %29, i32 16, i32 6)
%31 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 3, i64 0
store i32* %31, i32** %32
%33 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 4, i64 0, i64 0
%34 = load i8*, i8** %13
%35 = call i32 @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %34, i32 24, i32 6)
%36 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 4, i64 0
store i32* %36, i32** %37
%38 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 5, i64 0, i64 0
%39 = load i8*, i8** %13
%40 = call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %39, i32 32, i32 6)
%41 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%42 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 5, i64 0
store i32* %41, i32** %42
%43 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 6, i64 0, i64 0
%44 = load i8*, i8** %13
%45 = call i32 @sprintf(i8* %43, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %44, i32 40, i32 6)
%46 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%47 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 6, i64 0
store i32* %46, i32** %47
%48 = getelementptr inbounds [8 x [2 x [100 x i8]]], [8 x [2 x [100 x i8]]]* %4, i64 0, i64 7, i64 0, i64 0
%49 = load i8*, i8** %13
%50 = call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %49, i32 48, i32 6)
%51 = call i32* @fopen(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%52 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 7, i64 0
store i32* %51, i32** %52
%53 = load i8*, i8** %13
%54 = call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %57
55: ; preds = %2
%56 = call i32 @exit(i32 0)
unreachable
57: ; preds = %87, %12
%58 = phi i64 [ 0, %12 ], [ %88, %87 ]
%59 = icmp eq i64 %58, 7
%60 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 %58, i64 0
%61 = load i32*, i32** %60
%62 = call i32 @fscanf(i32* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%63 = icmp eq i32 %62, 1
br i1 %63, label %67, label %64
64: ; preds = %57
br i1 %59, label %91, label %65
65: ; preds = %64
%66 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i64 7, i64 1, i32* %54)
br label %70
67: ; preds = %57
%68 = load i32, i32* %5
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %67, %65
%71 = call i32 @fputc(i32 9, i32* %54)
%72 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 %58, i64 1
%73 = load i32*, i32** %72
%74 = call i32 @fscanf(i32* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%75 = icmp eq i32 %74, 1
br i1 %75, label %80, label %76
76: ; preds = %70
br i1 %59, label %91, label %77
77: ; preds = %76
%78 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i64 7, i64 1, i32* %54)
%79 = call i32 @fputc(i32 9, i32* %54)
br label %84
80: ; preds = %70
%81 = load i32, i32* %5
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %81)
%83 = call i32 @fputc(i32 9, i32* %54)
br i1 %59, label %89, label %84
84: ; preds = %80, %77
%85 = call i32 @fputc(i32 9, i32* %54)
%86 = add nuw nsw i64 %58, 1
br label %87
87: ; preds = %84, %89
%88 = phi i64 [ %86, %84 ], [ 0, %89 ]
br label %57
89: ; preds = %80
%90 = call i32 @fputc(i32 10, i32* %54)
br label %87
91: ; preds = %76, %64
%92 = call i32 @fputc(i32 10, i32* %54)
%93 = call i32 @fclose(i32* %54)
%94 = load i32*, i32** %17
%95 = call i32 @fclose(i32* %94)
%96 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 0, i64 1
%97 = load i32*, i32** %96
%98 = call i32 @fclose(i32* %97)
%99 = load i32*, i32** %22
%100 = call i32 @fclose(i32* %99)
%101 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 1, i64 1
%102 = load i32*, i32** %101
%103 = call i32 @fclose(i32* %102)
%104 = load i32*, i32** %27
%105 = call i32 @fclose(i32* %104)
%106 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 2, i64 1
%107 = load i32*, i32** %106
%108 = call i32 @fclose(i32* %107)
%109 = load i32*, i32** %32
%110 = call i32 @fclose(i32* %109)
%111 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 3, i64 1
%112 = load i32*, i32** %111
%113 = call i32 @fclose(i32* %112)
%114 = load i32*, i32** %37
%115 = call i32 @fclose(i32* %114)
%116 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 4, i64 1
%117 = load i32*, i32** %116
%118 = call i32 @fclose(i32* %117)
%119 = load i32*, i32** %42
%120 = call i32 @fclose(i32* %119)
%121 = getelementptr inbounds [8 x [2 x i32*]], [8 x [2 x i32*]]* %3, i64 0, i64 5, i64 1
%122 = load i32*, i32** %121
%123 = call i32 @fclose(i32* %122)
%124 = call i32 @fclose(i32* %46)
%125 = call i32 @fclose(i32* undef)
%126 = call i32 @fclose(i32* %51)
%127 = call i32 @fclose(i32* undef)
ret i32 0
}