#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, c, t[101][3] = {0};
  scanf("%d\n", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &c);
    t[i][0] =
        (t[i - 1][0] > (t[i - 1][1] > t[i - 1][2] ? t[i - 1][2] : t[i - 1][1])
             ? (t[i - 1][1] > t[i - 1][2] ? t[i - 1][2] : t[i - 1][1])
             : t[i - 1][0]) +
        1;
    if (!c) {
      t[i][1] = 101;
      t[i][2] = 101;
    } else if (c == 3) {
      t[i][1] = (t[i - 1][0] > t[i - 1][2] ? t[i - 1][2] : t[i - 1][0]);
      t[i][2] = (t[i - 1][0] > t[i - 1][1] ? t[i - 1][1] : t[i - 1][0]);
    } else {
      t[i][c] = (t[i - 1][0] > t[i - 1][3 - c] ? t[i - 1][3 - c] : t[i - 1][0]);
      t[i][3 - c] = 101;
    }
  }
  printf("%d\n", (t[n][0] > (t[n][1] > t[n][2] ? t[n][2] : t[n][1])
                      ? (t[n][1] > t[n][2] ? t[n][2] : t[n][1])
                      : t[n][0]));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x500,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x4bc,%edx
call   1040 <memset@plt>
lea    0xea4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1574 <main+0x444>
lea    0xe85(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4d4(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
jle    1206 <main+0xd6>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4d8(%rbp)
jmp    1226 <main+0xf6>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4d8(%rbp)
mov    -0x4d4(%rbp),%eax
mov    -0x4d8(%rbp),%ecx
cmp    %ecx,%eax
jle    12ca <main+0x19a>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
jle    1299 <main+0x169>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4dc(%rbp)
jmp    12b9 <main+0x189>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4dc(%rbp)
mov    -0x4dc(%rbp),%eax
mov    %eax,-0x4e0(%rbp)
jmp    12e9 <main+0x1b9>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4e0(%rbp)
mov    -0x4e0(%rbp),%ecx
add    $0x1,%ecx
movslq -0xc(%rbp),%rdx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x10(%rbp)
jne    1347 <main+0x217>
movslq -0xc(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movl   $0x65,0x4(%rax)
movslq -0xc(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movl   $0x65,0x8(%rax)
jmp    1561 <main+0x431>
cmpl   $0x3,-0x10(%rbp)
jne    1486 <main+0x356>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
jle    13af <main+0x27f>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4e4(%rbp)
jmp    13ce <main+0x29e>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4e4(%rbp)
mov    -0x4e4(%rbp),%ecx
movslq -0xc(%rbp),%rdx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x4(%rcx),%eax
jle    1447 <main+0x317>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4e8(%rbp)
jmp    1466 <main+0x336>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4e8(%rbp)
mov    -0x4e8(%rbp),%ecx
movslq -0xc(%rbp),%rdx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
jmp    155c <main+0x42c>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
mov    $0x3,%edx
sub    -0x10(%rbp),%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    14fa <main+0x3ca>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    $0x3,%ecx
sub    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4ec(%rbp)
jmp    1519 <main+0x3e9>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4ec(%rbp)
mov    -0x4ec(%rbp),%edx
movslq -0xc(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0xc(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    $0x3,%ecx
sub    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x65,(%rax,%rcx,4)
jmp    1561 <main+0x431>
jmp    1566 <main+0x436>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116c <main+0x3c>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4f0(%rbp)
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
movslq -0x8(%rbp),%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
jle    15de <main+0x4ae>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4f4(%rbp)
jmp    15f9 <main+0x4c9>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4f4(%rbp)
mov    -0x4f0(%rbp),%eax
mov    -0x4f4(%rbp),%ecx
cmp    %ecx,%eax
jle    1689 <main+0x559>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
movslq -0x8(%rbp),%rdx
lea    -0x4d0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
jle    165d <main+0x52d>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4f8(%rbp)
jmp    1678 <main+0x548>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4f8(%rbp)
mov    -0x4f8(%rbp),%eax
mov    %eax,-0x4fc(%rbp)
jmp    16a3 <main+0x573>
movslq -0x8(%rbp),%rcx
lea    -0x4d0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x4fc(%rbp)
mov    -0x4fc(%rbp),%esi
lea    0x950(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x500,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4d8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x4bc,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1224 <main+0xf4>
lea    0x1c(%rsp),%rbx
xor    %r12d,%r12d
lea    0xe89(%rip),%r14
lea    0xc(%rsp),%r15
jmp    11c7 <main+0x97>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3,%ecx
sub    %rdx,%rcx
mov    %rdx,%rsi
shl    $0x2,%rsi
neg    %rsi
mov    (%rbx,%rsi,1),%esi
cmp    %esi,%eax
cmovg  %esi,%eax
mov    %eax,(%rbx,%rdx,4)
mov    $0x65,%eax
mov    %eax,(%rbx,%rcx,4)
movslq 0x8(%rsp),%rax
add    $0xc,%rbx
add    $0x1,%r12
cmp    %rax,%r12
jge    1224 <main+0xf4>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbx),%ecx
mov    -0x4(%rbx),%esi
cmp    %esi,%ecx
mov    %ecx,%edx
cmovg  %esi,%edx
mov    -0xc(%rbx),%eax
cmp    %edx,%eax
cmovle %eax,%edx
add    $0x1,%edx
mov    %edx,(%rbx)
movslq 0xc(%rsp),%rdx
cmp    $0x3,%rdx
je     1210 <main+0xe0>
test   %edx,%edx
jne    1190 <main+0x60>
movl   $0x65,0x4(%rbx)
mov    $0x65,%eax
mov    $0x2,%ecx
jmp    11b2 <main+0x82>
xchg   %ax,%ax
cmp    %esi,%eax
cmovle %eax,%esi
mov    %esi,0x4(%rbx)
cmp    %ecx,%eax
cmovg  %ecx,%eax
mov    $0x2,%ecx
jmp    11b2 <main+0x82>
cltq
lea    (%rax,%rax,2),%rax
mov    0x14(%rsp,%rax,4),%esi
mov    0x18(%rsp,%rax,4),%ecx
cmp    %ecx,%esi
cmovg  %ecx,%esi
mov    0x10(%rsp,%rax,4),%eax
cmp    %esi,%eax
cmovle %eax,%esi
lea    0xdb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4d8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [101 x [3 x i32]]
store i32 0, i32* %1
%6 = bitcast [101 x [3 x i32]]* %5 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %8
8: ; preds = %226, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %229
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %16
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 0
%19 = load i32, i32* %18
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %22
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %23, i64 0, i64 1
%25 = load i32, i32* %24
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %28
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %29, i64 0, i64 2
%31 = load i32, i32* %30
%32 = icmp sgt i32 %25, %31
br i1 %32, label %33, label %40
33: ; preds = %12
%34 = load i32, i32* %3
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %36
%38 = getelementptr inbounds [3 x i32], [3 x i32]* %37, i64 0, i64 2
%39 = load i32, i32* %38
br label %47
40: ; preds = %12
%41 = load i32, i32* %3
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %43
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %44, i64 0, i64 1
%46 = load i32, i32* %45
br label %47
47: ; preds = %40, %33
%48 = phi i32 [ %39, %33 ], [ %46, %40 ]
%49 = icmp sgt i32 %19, %48
br i1 %49, label %50, label %80
50: ; preds = %47
%51 = load i32, i32* %3
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %53
%55 = getelementptr inbounds [3 x i32], [3 x i32]* %54, i64 0, i64 1
%56 = load i32, i32* %55
%57 = load i32, i32* %3
%58 = sub nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %59
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %60, i64 0, i64 2
%62 = load i32, i32* %61
%63 = icmp sgt i32 %56, %62
br i1 %63, label %64, label %71
64: ; preds = %50
%65 = load i32, i32* %3
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %67
%69 = getelementptr inbounds [3 x i32], [3 x i32]* %68, i64 0, i64 2
%70 = load i32, i32* %69
br label %78
71: ; preds = %50
%72 = load i32, i32* %3
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %74
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %75, i64 0, i64 1
%77 = load i32, i32* %76
br label %78
78: ; preds = %71, %64
%79 = phi i32 [ %70, %64 ], [ %77, %71 ]
br label %87
80: ; preds = %47
%81 = load i32, i32* %3
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %83
%85 = getelementptr inbounds [3 x i32], [3 x i32]* %84, i64 0, i64 0
%86 = load i32, i32* %85
br label %87
87: ; preds = %80, %78
%88 = phi i32 [ %79, %78 ], [ %86, %80 ]
%89 = add nsw i32 %88, 1
%90 = load i32, i32* %3
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %91
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %92, i64 0, i64 0
store i32 %89, i32* %93
%94 = load i32, i32* %4
%95 = icmp ne i32 %94, 0
br i1 %95, label %105, label %96
96: ; preds = %87
%97 = load i32, i32* %3
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %98
%100 = getelementptr inbounds [3 x i32], [3 x i32]* %99, i64 0, i64 1
store i32 101, i32* %100
%101 = load i32, i32* %3
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %102
%104 = getelementptr inbounds [3 x i32], [3 x i32]* %103, i64 0, i64 2
store i32 101, i32* %104
br label %225
105: ; preds = %87
%106 = load i32, i32* %4
%107 = icmp eq i32 %106, 3
br i1 %107, label %108, label %175
108: ; preds = %105
%109 = load i32, i32* %3
%110 = sub nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %111
%113 = getelementptr inbounds [3 x i32], [3 x i32]* %112, i64 0, i64 0
%114 = load i32, i32* %113
%115 = load i32, i32* %3
%116 = sub nsw i32 %115, 1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %117
%119 = getelementptr inbounds [3 x i32], [3 x i32]* %118, i64 0, i64 2
%120 = load i32, i32* %119
%121 = icmp sgt i32 %114, %120
br i1 %121, label %122, label %129
122: ; preds = %108
%123 = load i32, i32* %3
%124 = sub nsw i32 %123, 1
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %125
%127 = getelementptr inbounds [3 x i32], [3 x i32]* %126, i64 0, i64 2
%128 = load i32, i32* %127
br label %136
129: ; preds = %108
%130 = load i32, i32* %3
%131 = sub nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %132
%134 = getelementptr inbounds [3 x i32], [3 x i32]* %133, i64 0, i64 0
%135 = load i32, i32* %134
br label %136
136: ; preds = %129, %122
%137 = phi i32 [ %128, %122 ], [ %135, %129 ]
%138 = load i32, i32* %3
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %139
%141 = getelementptr inbounds [3 x i32], [3 x i32]* %140, i64 0, i64 1
store i32 %137, i32* %141
%142 = load i32, i32* %3
%143 = sub nsw i32 %142, 1
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %144
%146 = getelementptr inbounds [3 x i32], [3 x i32]* %145, i64 0, i64 0
%147 = load i32, i32* %146
%148 = load i32, i32* %3
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %150
%152 = getelementptr inbounds [3 x i32], [3 x i32]* %151, i64 0, i64 1
%153 = load i32, i32* %152
%154 = icmp sgt i32 %147, %153
br i1 %154, label %155, label %162
155: ; preds = %136
%156 = load i32, i32* %3
%157 = sub nsw i32 %156, 1
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %158
%160 = getelementptr inbounds [3 x i32], [3 x i32]* %159, i64 0, i64 1
%161 = load i32, i32* %160
br label %169
162: ; preds = %136
%163 = load i32, i32* %3
%164 = sub nsw i32 %163, 1
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %165
%167 = getelementptr inbounds [3 x i32], [3 x i32]* %166, i64 0, i64 0
%168 = load i32, i32* %167
br label %169
169: ; preds = %162, %155
%170 = phi i32 [ %161, %155 ], [ %168, %162 ]
%171 = load i32, i32* %3
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %172
%174 = getelementptr inbounds [3 x i32], [3 x i32]* %173, i64 0, i64 2
store i32 %170, i32* %174
br label %224
175: ; preds = %105
%176 = load i32, i32* %3
%177 = sub nsw i32 %176, 1
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %178
%180 = getelementptr inbounds [3 x i32], [3 x i32]* %179, i64 0, i64 0
%181 = load i32, i32* %180
%182 = load i32, i32* %3
%183 = sub nsw i32 %182, 1
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %184
%186 = load i32, i32* %4
%187 = sub nsw i32 3, %186
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds [3 x i32], [3 x i32]* %185, i64 0, i64 %188
%190 = load i32, i32* %189
%191 = icmp sgt i32 %181, %190
br i1 %191, label %192, label %202
192: ; preds = %175
%193 = load i32, i32* %3
%194 = sub nsw i32 %193, 1
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %195
%197 = load i32, i32* %4
%198 = sub nsw i32 3, %197
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [3 x i32], [3 x i32]* %196, i64 0, i64 %199
%201 = load i32, i32* %200
br label %209
202: ; preds = %175
%203 = load i32, i32* %3
%204 = sub nsw i32 %203, 1
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %205
%207 = getelementptr inbounds [3 x i32], [3 x i32]* %206, i64 0, i64 0
%208 = load i32, i32* %207
br label %209
209: ; preds = %202, %192
%210 = phi i32 [ %201, %192 ], [ %208, %202 ]
%211 = load i32, i32* %3
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %212
%214 = load i32, i32* %4
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [3 x i32], [3 x i32]* %213, i64 0, i64 %215
store i32 %210, i32* %216
%217 = load i32, i32* %3
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %218
%220 = load i32, i32* %4
%221 = sub nsw i32 3, %220
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds [3 x i32], [3 x i32]* %219, i64 0, i64 %222
store i32 101, i32* %223
br label %224
224: ; preds = %209, %169
br label %225
225: ; preds = %224, %96
br label %226
226: ; preds = %225
%227 = load i32, i32* %3
%228 = add nsw i32 %227, 1
store i32 %228, i32* %3
br label %8
229: ; preds = %8
%230 = load i32, i32* %2
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %231
%233 = getelementptr inbounds [3 x i32], [3 x i32]* %232, i64 0, i64 0
%234 = load i32, i32* %233
%235 = load i32, i32* %2
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %236
%238 = getelementptr inbounds [3 x i32], [3 x i32]* %237, i64 0, i64 1
%239 = load i32, i32* %238
%240 = load i32, i32* %2
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %241
%243 = getelementptr inbounds [3 x i32], [3 x i32]* %242, i64 0, i64 2
%244 = load i32, i32* %243
%245 = icmp sgt i32 %239, %244
br i1 %245, label %246, label %252
246: ; preds = %229
%247 = load i32, i32* %2
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %248
%250 = getelementptr inbounds [3 x i32], [3 x i32]* %249, i64 0, i64 2
%251 = load i32, i32* %250
br label %258
252: ; preds = %229
%253 = load i32, i32* %2
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %254
%256 = getelementptr inbounds [3 x i32], [3 x i32]* %255, i64 0, i64 1
%257 = load i32, i32* %256
br label %258
258: ; preds = %252, %246
%259 = phi i32 [ %251, %246 ], [ %257, %252 ]
%260 = icmp sgt i32 %234, %259
br i1 %260, label %261, label %287
261: ; preds = %258
%262 = load i32, i32* %2
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %263
%265 = getelementptr inbounds [3 x i32], [3 x i32]* %264, i64 0, i64 1
%266 = load i32, i32* %265
%267 = load i32, i32* %2
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %268
%270 = getelementptr inbounds [3 x i32], [3 x i32]* %269, i64 0, i64 2
%271 = load i32, i32* %270
%272 = icmp sgt i32 %266, %271
br i1 %272, label %273, label %279
273: ; preds = %261
%274 = load i32, i32* %2
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %275
%277 = getelementptr inbounds [3 x i32], [3 x i32]* %276, i64 0, i64 2
%278 = load i32, i32* %277
br label %285
279: ; preds = %261
%280 = load i32, i32* %2
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %281
%283 = getelementptr inbounds [3 x i32], [3 x i32]* %282, i64 0, i64 1
%284 = load i32, i32* %283
br label %285
285: ; preds = %279, %273
%286 = phi i32 [ %278, %273 ], [ %284, %279 ]
br label %293
287: ; preds = %258
%288 = load i32, i32* %2
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %5, i64 0, i64 %289
%291 = getelementptr inbounds [3 x i32], [3 x i32]* %290, i64 0, i64 0
%292 = load i32, i32* %291
br label %293
293: ; preds = %287, %285
%294 = phi i32 [ %286, %285 ], [ %292, %287 ]
%295 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %294)
%296 = load i32, i32* %1
ret i32 %296
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [101 x [3 x i32]]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [101 x [3 x i32]]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %52, label %10
10: ; preds = %0, %44
%11 = phi i64 [ %48, %44 ], [ 1, %0 ]
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = add nsw i64 %11, -1
%14 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %13, i64 0
%15 = load i32, i32* %14
%16 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %13, i64 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %13, i64 2
%19 = load i32, i32* %18
%20 = icmp sgt i32 %17, %19
%21 = select i1 %20, i32 %19, i32 %17
%22 = icmp sgt i32 %15, %21
%23 = select i1 %22, i32 %21, i32 %15
%24 = add nsw i32 %23, 1
%25 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %11, i64 0
store i32 %24, i32* %25
%26 = load i32, i32* %2
switch i32 %26, label %35 [
i32 0, label %27
i32 3, label %29
]
27: ; preds = %10
%28 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %11, i64 1
store i32 101, i32* %28
br label %44
29: ; preds = %10
%30 = icmp sgt i32 %15, %19
%31 = select i1 %30, i32 %19, i32 %15
%32 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %11, i64 1
store i32 %31, i32* %32
%33 = icmp sgt i32 %15, %17
%34 = select i1 %33, i32 %17, i32 %15
br label %44
35: ; preds = %10
%36 = sub nsw i32 3, %26
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %13, i64 %37
%39 = load i32, i32* %38
%40 = icmp sgt i32 %15, %39
%41 = select i1 %40, i32 %39, i32 %15
%42 = sext i32 %26 to i64
%43 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %11, i64 %42
store i32 %41, i32* %43
br label %44
44: ; preds = %27, %35, %29
%45 = phi i64 [ 2, %27 ], [ %37, %35 ], [ 2, %29 ]
%46 = phi i32 [ 101, %27 ], [ 101, %35 ], [ %34, %29 ]
%47 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %11, i64 %45
store i32 %46, i32* %47
%48 = add nuw nsw i64 %11, 1
%49 = load i32, i32* %1
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %11, %50
br i1 %51, label %10, label %52
52: ; preds = %44, %0
%53 = phi i32 [ %8, %0 ], [ %49, %44 ]
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %54, i64 0
%56 = load i32, i32* %55
%57 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %54, i64 1
%58 = load i32, i32* %57
%59 = getelementptr inbounds [101 x [3 x i32]], [101 x [3 x i32]]* %3, i64 0, i64 %54, i64 2
%60 = load i32, i32* %59
%61 = icmp sgt i32 %58, %60
%62 = select i1 %61, i32 %60, i32 %58
%63 = icmp sgt i32 %56, %62
%64 = select i1 %63, i32 %62, i32 %56
%65 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %64)
ret i32 0
}