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

/* Variables and functions */
int /*<<< orphan*/ combination(char **, char **, char **, int);
int /*<<< orphan*/ compare(char **, char **, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ reflection(char **, char **, int);
int /*<<< orphan*/ rotate_180(char **, char **, int);
int /*<<< orphan*/ rotate_270(char **, char **, int);
int /*<<< orphan*/ rotate_90(char **, char **, int);
int main() {
  FILE *fin, *fout;
  int result = 0;
  fin = fopen("transform.in", "r");
  if (!fin) {
    perror("open file transform.in failed");
    return -1;
  }
  char before[10][10];
  char target[10][10];
  char tmp[10][10];
  memset(before, 0, sizeof(before));
  memset(target, 0, sizeof(target));
  memset(target, 0, sizeof(tmp));
  int n;
  fscanf(fin, "%d", &n);
  int i = 0, j;
  for (; i < n; ++i) {
    fscanf(fin, "%s", before[i]);
  }
  for (i = 0; i < n; ++i) {
    fscanf(fin, "%s", target[i]);
  }
  do {
    rotate_90(before, tmp, n);
    if (!compare(tmp, target, n)) {
      result = 1;
      break;
    }
    rotate_180(before, tmp, n);
    if (!compare(tmp, target, n)) {
      result = 2;
      break;
    }
    rotate_270(before, tmp, n);
    if (!compare(tmp, target, n)) {
      result = 3;
      break;
    }
    reflection(before, tmp, n);
    if (!compare(tmp, target, n)) {
      result = 4;
      break;
    }
    if (!combination(before, tmp, target, n)) {
      result = 5;
      break;
    }
    if (!compare(before, target, n)) {
      result = 6;
      break;
    }
    result = 7;
  } while (0);
  fout = fopen("transform.out", "w");
  fprintf(fout, "%d\n", result);
  fclose(fout);
  fclose(fin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe20(%rip),%rdi
lea    0xe26(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1213 <main+0x53>
lea    0xe0d(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x309>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    0xdd9(%rip),%rsi
lea    -0x164(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
movl   $0x0,-0x168(%rbp)
mov    -0x168(%rbp),%eax
cmp    -0x164(%rbp),%eax
jge    12b6 <main+0xf6>
mov    -0x10(%rbp),%rdi
movslq -0x168(%rbp),%rax
lea    -0x80(%rbp),%rdx
imul   $0xa,%rax,%rax
add    %rax,%rdx
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    126c <main+0xac>
movl   $0x0,-0x168(%rbp)
mov    -0x168(%rbp),%eax
cmp    -0x164(%rbp),%eax
jge    130d <main+0x14d>
mov    -0x10(%rbp),%rdi
movslq -0x168(%rbp),%rax
lea    -0xf0(%rbp),%rdx
imul   $0xa,%rax,%rax
add    %rax,%rdx
lea    0xd3e(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    12c0 <main+0x100>
jmp    1312 <main+0x152>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   1050 <rotate_90@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10d0 <compare@plt>
cmp    $0x0,%eax
jne    1356 <main+0x196>
movl   $0x1,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   1040 <rotate_180@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10d0 <compare@plt>
cmp    $0x0,%eax
jne    139a <main+0x1da>
movl   $0x2,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10e0 <rotate_270@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10d0 <compare@plt>
cmp    $0x0,%eax
jne    13de <main+0x21e>
movl   $0x3,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10c0 <reflection@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10d0 <compare@plt>
cmp    $0x0,%eax
jne    1422 <main+0x262>
movl   $0x4,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    -0x164(%rbp),%ecx
call   1080 <combination@plt>
cmp    $0x0,%eax
jne    1454 <main+0x294>
movl   $0x5,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
lea    -0x80(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x164(%rbp),%edx
call   10d0 <compare@plt>
cmp    $0x0,%eax
jne    147f <main+0x2bf>
movl   $0x6,-0x1c(%rbp)
jmp    1486 <main+0x2c6>
movl   $0x7,-0x1c(%rbp)
lea    0xba6(%rip),%rdi
lea    0xbad(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xb98(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x160,%rsp
lea    0xe2a(%rip),%rdi
lea    0xe30(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13cf <main+0x20f>
mov    %rax,%r14
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    0xdfe(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    12a2 <main+0xe2>
lea    0xde3(%rip),%r12
xor    %ebp,%ebp
nop
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rdx
add    $0xa,%rbx
cmp    %rdx,%rbp
jl     1250 <main+0x90>
test   %edx,%edx
jle    12a2 <main+0xe2>
lea    0xdb3(%rip),%rbx
xor    %ebp,%ebp
nop
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rdx
add    $0xa,%r15
cmp    %rdx,%rbp
jl     1280 <main+0xc0>
lea    0x80(%rsp),%rdi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <rotate_90@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <compare@plt>
test   %eax,%eax
je     13b3 <main+0x1f3>
mov    0xc(%rsp),%edx
lea    0x80(%rsp),%rdi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <rotate_180@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <compare@plt>
test   %eax,%eax
je     13ba <main+0x1fa>
mov    0xc(%rsp),%edx
lea    0x80(%rsp),%rdi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rsi
call   10e0 <rotate_270@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <compare@plt>
test   %eax,%eax
je     13c1 <main+0x201>
mov    0xc(%rsp),%edx
lea    0x80(%rsp),%rdi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rsi
call   10c0 <reflection@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <compare@plt>
test   %eax,%eax
je     13c8 <main+0x208>
mov    0xc(%rsp),%ecx
lea    0x80(%rsp),%rdi
lea    0xf0(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1080 <combination@plt>
test   %eax,%eax
je     13e2 <main+0x222>
mov    0xc(%rsp),%edx
lea    0x80(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10d0 <compare@plt>
cmp    $0x1,%eax
mov    $0x7,%ebp
sbb    $0x0,%ebp
jmp    13e7 <main+0x227>
mov    $0x1,%ebp
jmp    13e7 <main+0x227>
mov    $0x2,%ebp
jmp    13e7 <main+0x227>
mov    $0x3,%ebp
jmp    13e7 <main+0x227>
mov    $0x4,%ebp
jmp    13e7 <main+0x227>
lea    0xc39(%rip),%rdi
call   10b0 <perror@plt>
mov    $0xffffffff,%eax
jmp    1420 <main+0x260>
mov    $0x5,%ebp
lea    0xc45(%rip),%rdi
lea    0xc4c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xc3f(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"transform.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [30 x i8] c"open file transform.in failed\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [14 x i8] c"transform.out\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [10 x [10 x i8]]
%2 = alloca [10 x [10 x i8]]
%3 = alloca [10 x [10 x i8]]
%4 = alloca i32
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %80
9: ; preds = %0
%10 = getelementptr inbounds [10 x [10 x i8]], [10 x [10 x i8]]* %1, i64 0, i64 0, i64 0
%11 = getelementptr inbounds [10 x [10 x i8]], [10 x [10 x i8]]* %2, i64 0, i64 0, i64 0
%12 = getelementptr inbounds [10 x [10 x i8]], [10 x [10 x i8]]* %3, i64 0, i64 0, i64 0
%13 = bitcast [10 x [10 x i8]]* %1 to i8**
%14 = call i32 @memset(i8** %13, i32 0, i32 100)
%15 = bitcast [10 x [10 x i8]]* %2 to i8**
%16 = call i32 @memset(i8** %15, i32 0, i32 100)
%17 = call i32 @memset(i8** %15, i32 0, i32 100)
%18 = bitcast i32* %4 to i8*
%19 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 0
br i1 %21, label %24, label %40
22: ; preds = %24
%23 = icmp sgt i32 %29, 0
br i1 %23, label %32, label %40
24: ; preds = %9, %24
%25 = phi i64 [ %28, %24 ], [ 0, %9 ]
%26 = getelementptr inbounds [10 x [10 x i8]], [10 x [10 x i8]]* %1, i64 0, i64 %25, i64 0
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = add nuw nsw i64 %25, 1
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %24, label %22
32: ; preds = %22, %32
%33 = phi i64 [ %36, %32 ], [ 0, %22 ]
%34 = getelementptr inbounds [10 x [10 x i8]], [10 x [10 x i8]]* %2, i64 0, i64 %33, i64 0
%35 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = add nuw nsw i64 %33, 1
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %32, label %40
40: ; preds = %32, %9, %22
%41 = phi i32 [ %29, %22 ], [ %20, %9 ], [ %37, %32 ]
%42 = bitcast [10 x [10 x i8]]* %3 to i8**
%43 = call i32 @rotate_90(i8** %13, i8** %42, i32 %41)
%44 = load i32, i32* %4
%45 = call i32 @compare(i8** %42, i8** %15, i32 %44)
%46 = icmp eq i32 %45, 0
br i1 %46, label %74, label %47
47: ; preds = %40
%48 = load i32, i32* %4
%49 = call i32 @rotate_180(i8** %13, i8** %42, i32 %48)
%50 = load i32, i32* %4
%51 = call i32 @compare(i8** %42, i8** %15, i32 %50)
%52 = icmp eq i32 %51, 0
br i1 %52, label %74, label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = call i32 @rotate_270(i8** %13, i8** %42, i32 %54)
%56 = load i32, i32* %4
%57 = call i32 @compare(i8** %42, i8** %15, i32 %56)
%58 = icmp eq i32 %57, 0
br i1 %58, label %74, label %59
59: ; preds = %53
%60 = load i32, i32* %4
%61 = call i32 @reflection(i8** %13, i8** %42, i32 %60)
%62 = load i32, i32* %4
%63 = call i32 @compare(i8** %42, i8** %15, i32 %62)
%64 = icmp eq i32 %63, 0
br i1 %64, label %74, label %65
65: ; preds = %59
%66 = load i32, i32* %4
%67 = call i32 @combination(i8** %13, i8** %42, i8** %15, i32 %66)
%68 = icmp eq i32 %67, 0
br i1 %68, label %74, label %69
69: ; preds = %65
%70 = load i32, i32* %4
%71 = call i32 @compare(i8** %13, i8** %15, i32 %70)
%72 = icmp eq i32 %71, 0
%73 = select i1 %72, i32 6, i32 7
br label %74
74: ; preds = %69, %65, %59, %53, %47, %40
%75 = phi i32 [ 1, %40 ], [ 2, %47 ], [ 3, %53 ], [ 4, %59 ], [ 5, %65 ], [ %73, %69 ]
%76 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @fprintf(i32* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %75)
%78 = call i32 @fclose(i32* %76)
%79 = call i32 @fclose(i32* %5)
br label %80
80: ; preds = %74, %7
%81 = phi i32 [ 0, %74 ], [ -1, %7 ]
ret i32 %81
}