#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*/ copy_2d(char **, char **, int);
scalar_t__ equal_2d(char **, char **, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ free_2d(char **, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
char **malloc_2d(int);
int /*<<< orphan*/ r_180(char **, int);
int /*<<< orphan*/ r_270(char **, int);
int /*<<< orphan*/ r_90(char **, int);
int /*<<< orphan*/ r_reflection(char **, char **, int);
int main() {
  FILE *fin = fopen("transform.in", "r");
  FILE *fout = fopen("transform.out", "w");
  int i, j;
  int n;
  fscanf(fin, "%d", &n);
  char **arr = malloc_2d(n);
  char **arr2 = malloc_2d(n);
  char **arr3 = malloc_2d(n);
  for (i = 0; i < n; i++)
    fscanf(fin, "%s", arr[i]);
  for (i = 0; i < n; i++)
    fscanf(fin, "%s", arr2[i]);
  copy_2d(arr, arr3, n);
  r_90(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 1);
    goto end;
  }
  copy_2d(arr, arr3, n);
  r_180(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 2);
    goto end;
  }
  copy_2d(arr, arr3, n);
  r_270(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 3);
    goto end;
  }
  r_reflection(arr, arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 4);
    goto end;
  }
  r_reflection(arr, arr3, n);
  r_90(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 5);
    goto end;
  }
  r_90(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 5);
    goto end;
  }
  r_90(arr3, n);
  if (equal_2d(arr2, arr3, n)) {
    fprintf(fout, "%d\n", 5);
    goto end;
  }
  if (equal_2d(arr, arr2, n)) {
    fprintf(fout, "%d\n", 6);
    goto end;
  }
  fprintf(fout, "%d\n", 7);
end:
  free_2d(arr, n);
  free_2d(arr2, n);
  free_2d(arr3, n);
  fclose(fin);
  fclose(fout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe2a(%rip),%rdi
lea    0xe30(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe22(%rip),%rdi
lea    0xe29(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x24(%rbp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1276 <main+0xb6>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdc1(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    123e <main+0x7e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12b5 <main+0xf5>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    127d <main+0xbd>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10b0 <copy_2d@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1080 <r_90@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     1305 <main+0x145>
mov    -0x18(%rbp),%rdi
lea    0xd2f(%rip),%rsi
mov    $0x1,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10b0 <copy_2d@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <r_180@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     1355 <main+0x195>
mov    -0x18(%rbp),%rdi
lea    0xcdf(%rip),%rsi
mov    $0x2,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10b0 <copy_2d@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10d0 <r_270@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     13a5 <main+0x1e5>
mov    -0x18(%rbp),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x3,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1060 <r_reflection@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     13e9 <main+0x229>
mov    -0x18(%rbp),%rdi
lea    0xc4b(%rip),%rsi
mov    $0x4,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1060 <r_reflection@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1080 <r_90@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     1439 <main+0x279>
mov    -0x18(%rbp),%rdi
lea    0xbfb(%rip),%rsi
mov    $0x5,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1080 <r_90@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     1479 <main+0x2b9>
mov    -0x18(%rbp),%rdi
lea    0xbbb(%rip),%rsi
mov    $0x5,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1080 <r_90@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     14b9 <main+0x2f9>
mov    -0x18(%rbp),%rdi
lea    0xb7b(%rip),%rsi
mov    $0x5,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10a0 <equal_2d@plt>
cmp    $0x0,%rax
je     14ed <main+0x32d>
mov    -0x18(%rbp),%rdi
lea    0xb47(%rip),%rsi
mov    $0x6,%edx
call   1090 <fprintf@plt>
jmp    1502 <main+0x342>
mov    -0x18(%rbp),%rdi
lea    0xb2d(%rip),%rsi
mov    $0x7,%edx
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10c0 <free_2d@plt>
mov    -0x38(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10c0 <free_2d@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10c0 <free_2d@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe2b(%rip),%rdi
lea    0xe31(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r13
lea    0xe24(%rip),%rdi
lea    0xe2b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r14
lea    0xe1e(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0xc(%rsp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,%r15
mov    0xc(%rsp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,%r12
mov    0xc(%rsp),%edi
call   1030 <malloc_2d@plt>
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    129f <main+0xdf>
mov    %r14,%rbx
lea    0xdda(%rip),%rbp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    (%r15,%r14,8),%rdx
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%r14
movslq 0xc(%rsp),%rdx
cmp    %rdx,%r14
jl     1250 <main+0x90>
test   %edx,%edx
mov    %rbx,%r14
jle    129f <main+0xdf>
lea    0xda5(%rip),%rbp
xor    %ebx,%ebx
nop
mov    (%r12,%rbx,8),%rdx
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rdx
cmp    %rdx,%rbx
jl     1280 <main+0xc0>
mov    %r15,%rdi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   10b0 <copy_2d@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <r_90@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   10b0 <copy_2d@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <r_180@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
mov    $0x2,%ebp
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   10b0 <copy_2d@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   10d0 <r_270@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
mov    $0x3,%ebp
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <r_reflection@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
mov    $0x4,%ebp
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <r_reflection@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <r_90@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
mov    $0x5,%ebp
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <r_90@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <r_90@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <equal_2d@plt>
test   %rax,%rax
jne    1403 <main+0x243>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <equal_2d@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
or     $0x6,%ebp
lea    0xc1b(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
call   1090 <fprintf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   10c0 <free_2d@plt>
mov    0xc(%rsp),%esi
mov    %r12,%rdi
call   10c0 <free_2d@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   10c0 <free_2d@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <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 = [13 x i8] c"transform.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"transform.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i8**
store i32 0, i32* %1
%10 = 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* %10, i32** %2
%11 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %11, i32** %3
%12 = load i32*, i32** %2
%13 = call i32 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = call i8** @malloc_2d(i32 %14)
store i8** %15, i8*** %7
%16 = load i32, i32* %6
%17 = call i8** @malloc_2d(i32 %16)
store i8** %17, i8*** %8
%18 = load i32, i32* %6
%19 = call i8** @malloc_2d(i32 %18)
store i8** %19, i8*** %9
store i32 0, i32* %4
br label %20
20: ; preds = %32, %0
%21 = load i32, i32* %4
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %35
24: ; preds = %20
%25 = load i32*, i32** %2
%26 = load i8**, i8*** %7
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 (i32*, i8*, ...) @fscanf(i32* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %24
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %20
35: ; preds = %20
store i32 0, i32* %4
br label %36
36: ; preds = %48, %35
%37 = load i32, i32* %4
%38 = load i32, i32* %6
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = load i32*, i32** %2
%42 = load i8**, i8*** %8
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 (i32*, i8*, ...) @fscanf(i32* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %40
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %36
51: ; preds = %36
%52 = load i8**, i8*** %7
%53 = load i8**, i8*** %9
%54 = load i32, i32* %6
%55 = call i32 @copy_2d(i8** %52, i8** %53, i32 %54)
%56 = load i8**, i8*** %9
%57 = load i32, i32* %6
%58 = call i32 @r_90(i8** %56, i32 %57)
%59 = load i8**, i8*** %8
%60 = load i8**, i8*** %9
%61 = load i32, i32* %6
%62 = call i64 @equal_2d(i8** %59, i8** %60, i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %51
%65 = load i32*, i32** %3
%66 = call i32 @fprintf(i32* %65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
br label %164
67: ; preds = %51
%68 = load i8**, i8*** %7
%69 = load i8**, i8*** %9
%70 = load i32, i32* %6
%71 = call i32 @copy_2d(i8** %68, i8** %69, i32 %70)
%72 = load i8**, i8*** %9
%73 = load i32, i32* %6
%74 = call i32 @r_180(i8** %72, i32 %73)
%75 = load i8**, i8*** %8
%76 = load i8**, i8*** %9
%77 = load i32, i32* %6
%78 = call i64 @equal_2d(i8** %75, i8** %76, i32 %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %67
%81 = load i32*, i32** %3
%82 = call i32 @fprintf(i32* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 2)
br label %164
83: ; preds = %67
%84 = load i8**, i8*** %7
%85 = load i8**, i8*** %9
%86 = load i32, i32* %6
%87 = call i32 @copy_2d(i8** %84, i8** %85, i32 %86)
%88 = load i8**, i8*** %9
%89 = load i32, i32* %6
%90 = call i32 @r_270(i8** %88, i32 %89)
%91 = load i8**, i8*** %8
%92 = load i8**, i8*** %9
%93 = load i32, i32* %6
%94 = call i64 @equal_2d(i8** %91, i8** %92, i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %83
%97 = load i32*, i32** %3
%98 = call i32 @fprintf(i32* %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
br label %164
99: ; preds = %83
%100 = load i8**, i8*** %7
%101 = load i8**, i8*** %9
%102 = load i32, i32* %6
%103 = call i32 @r_reflection(i8** %100, i8** %101, i32 %102)
%104 = load i8**, i8*** %8
%105 = load i8**, i8*** %9
%106 = load i32, i32* %6
%107 = call i64 @equal_2d(i8** %104, i8** %105, i32 %106)
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %112
109: ; preds = %99
%110 = load i32*, i32** %3
%111 = call i32 @fprintf(i32* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %164
112: ; preds = %99
%113 = load i8**, i8*** %7
%114 = load i8**, i8*** %9
%115 = load i32, i32* %6
%116 = call i32 @r_reflection(i8** %113, i8** %114, i32 %115)
%117 = load i8**, i8*** %9
%118 = load i32, i32* %6
%119 = call i32 @r_90(i8** %117, i32 %118)
%120 = load i8**, i8*** %8
%121 = load i8**, i8*** %9
%122 = load i32, i32* %6
%123 = call i64 @equal_2d(i8** %120, i8** %121, i32 %122)
%124 = icmp ne i64 %123, 0
br i1 %124, label %125, label %128
125: ; preds = %112
%126 = load i32*, i32** %3
%127 = call i32 @fprintf(i32* %126, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 5)
br label %164
128: ; preds = %112
%129 = load i8**, i8*** %9
%130 = load i32, i32* %6
%131 = call i32 @r_90(i8** %129, i32 %130)
%132 = load i8**, i8*** %8
%133 = load i8**, i8*** %9
%134 = load i32, i32* %6
%135 = call i64 @equal_2d(i8** %132, i8** %133, i32 %134)
%136 = icmp ne i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %128
%138 = load i32*, i32** %3
%139 = call i32 @fprintf(i32* %138, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 5)
br label %164
140: ; preds = %128
%141 = load i8**, i8*** %9
%142 = load i32, i32* %6
%143 = call i32 @r_90(i8** %141, i32 %142)
%144 = load i8**, i8*** %8
%145 = load i8**, i8*** %9
%146 = load i32, i32* %6
%147 = call i64 @equal_2d(i8** %144, i8** %145, i32 %146)
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %140
%150 = load i32*, i32** %3
%151 = call i32 @fprintf(i32* %150, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 5)
br label %164
152: ; preds = %140
%153 = load i8**, i8*** %7
%154 = load i8**, i8*** %8
%155 = load i32, i32* %6
%156 = call i64 @equal_2d(i8** %153, i8** %154, i32 %155)
%157 = icmp ne i64 %156, 0
br i1 %157, label %158, label %161
158: ; preds = %152
%159 = load i32*, i32** %3
%160 = call i32 @fprintf(i32* %159, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 6)
br label %164
161: ; preds = %152
%162 = load i32*, i32** %3
%163 = call i32 @fprintf(i32* %162, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 7)
br label %164
164: ; preds = %161, %158, %149, %137, %125, %109, %96, %80, %64
%165 = load i8**, i8*** %7
%166 = load i32, i32* %6
%167 = call i32 @free_2d(i8** %165, i32 %166)
%168 = load i8**, i8*** %8
%169 = load i32, i32* %6
%170 = call i32 @free_2d(i8** %168, i32 %169)
%171 = load i8**, i8*** %9
%172 = load i32, i32* %6
%173 = call i32 @free_2d(i8** %171, i32 %172)
%174 = load i32*, i32** %2
%175 = call i32 @fclose(i32* %174)
%176 = load i32*, i32** %3
%177 = call i32 @fclose(i32* %176)
%178 = load i32, i32* %1
ret i32 %178
}

LLVM IR (-O2):
@.str = [13 x i8] c"transform.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"transform.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = 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))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i32*, i8*, ...) @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i8** @malloc_2d(i32 %6)
%8 = load i32, i32* %1
%9 = call i8** @malloc_2d(i32 %8)
%10 = load i32, i32* %1
%11 = call i8** @malloc_2d(i32 %10)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %16, label %34
14: ; preds = %16
%15 = icmp sgt i32 %22, 0
br i1 %15, label %25, label %34
16: ; preds = %0, %16
%17 = phi i64 [ %21, %16 ], [ 0, %0 ]
%18 = getelementptr inbounds i8*, i8** %7, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i32*, i8*, ...) @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = add nuw nsw i64 %17, 1
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %16, label %14
25: ; preds = %14, %25
%26 = phi i64 [ %30, %25 ], [ 0, %14 ]
%27 = getelementptr inbounds i8*, i8** %9, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %28)
%30 = add nuw nsw i64 %26, 1
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %25, label %34
34: ; preds = %25, %0, %14
%35 = phi i32 [ %22, %14 ], [ %12, %0 ], [ %31, %25 ]
%36 = call i32 @copy_2d(i8** %7, i8** %11, i32 %35)
%37 = load i32, i32* %1
%38 = call i32 @r_90(i8** %11, i32 %37)
%39 = load i32, i32* %1
%40 = call i64 @equal_2d(i8** %9, i8** %11, i32 %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %89
42: ; preds = %34
%43 = load i32, i32* %1
%44 = call i32 @copy_2d(i8** %7, i8** %11, i32 %43)
%45 = load i32, i32* %1
%46 = call i32 @r_180(i8** %11, i32 %45)
%47 = load i32, i32* %1
%48 = call i64 @equal_2d(i8** %9, i8** %11, i32 %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %89
50: ; preds = %42
%51 = load i32, i32* %1
%52 = call i32 @copy_2d(i8** %7, i8** %11, i32 %51)
%53 = load i32, i32* %1
%54 = call i32 @r_270(i8** %11, i32 %53)
%55 = load i32, i32* %1
%56 = call i64 @equal_2d(i8** %9, i8** %11, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %89
58: ; preds = %50
%59 = load i32, i32* %1
%60 = call i32 @r_reflection(i8** %7, i8** %11, i32 %59)
%61 = load i32, i32* %1
%62 = call i64 @equal_2d(i8** %9, i8** %11, i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %89
64: ; preds = %58
%65 = load i32, i32* %1
%66 = call i32 @r_reflection(i8** %7, i8** %11, i32 %65)
%67 = load i32, i32* %1
%68 = call i32 @r_90(i8** %11, i32 %67)
%69 = load i32, i32* %1
%70 = call i64 @equal_2d(i8** %9, i8** %11, i32 %69)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %89
72: ; preds = %64
%73 = load i32, i32* %1
%74 = call i32 @r_90(i8** %11, i32 %73)
%75 = load i32, i32* %1
%76 = call i64 @equal_2d(i8** %9, i8** %11, i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %89
78: ; preds = %72
%79 = load i32, i32* %1
%80 = call i32 @r_90(i8** %11, i32 %79)
%81 = load i32, i32* %1
%82 = call i64 @equal_2d(i8** %9, i8** %11, i32 %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %89
84: ; preds = %78
%85 = load i32, i32* %1
%86 = call i64 @equal_2d(i8** %7, i8** %9, i32 %85)
%87 = icmp eq i64 %86, 0
%88 = select i1 %87, i32 7, i32 6
br label %89
89: ; preds = %84, %78, %72, %64, %58, %50, %42, %34
%90 = phi i32 [ 1, %34 ], [ 2, %42 ], [ 3, %50 ], [ 4, %58 ], [ 5, %64 ], [ 5, %72 ], [ 5, %78 ], [ %88, %84 ]
%91 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %90)
%92 = load i32, i32* %1
%93 = call i32 @free_2d(i8** %7, i32 %92)
%94 = load i32, i32* %1
%95 = call i32 @free_2d(i8** %9, i32 %94)
%96 = load i32, i32* %1
%97 = call i32 @free_2d(i8** %11, i32 %96)
%98 = call i32 @fclose(i32* %2)
%99 = call i32 @fclose(i32* %3)
ret i32 0
}