#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 min(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, q, N;
  int A[100000][3][2];
  for (q = 1;; ++q) {
    scanf("%d", &N);
    if (!N) {
      break;
    }
    for (i = 0; i < N; ++i) {
      for (j = 0; j < 3; ++j) {
        scanf("%d", &A[i][j][0]);
        A[i][j][1] = 999999999;
      }
    }
    A[0][1][1] = 0;
    for (i = 0; i < N; ++i) {
      if (i > 0) {
        A[i][0][1] += A[i][0][0];
        A[i][1][1] = min(A[i][0][1], A[i][1][1]);
        if (i < N - 1) {
          A[i + 1][0][1] = min(A[i][0][1], A[i + 1][0][1]);
          A[i + 1][1][1] = min(A[i][0][1], A[i + 1][1][1]);
        }
      }
      A[i][1][1] += A[i][1][0];
      A[i][2][1] = min(A[i][1][1], A[i][2][1]);
      if (i < N - 1) {
        A[i + 1][0][1] = min(A[i][1][1], A[i + 1][0][1]);
        A[i + 1][1][1] = min(A[i][1][1], A[i + 1][1][1]);
        A[i + 1][2][1] = min(A[i][1][1], A[i + 1][2][1]);
      }
      A[i][2][1] += A[i][2][0];
      if (i < N - 1) {
        A[i + 1][1][1] = min(A[i][2][1], A[i + 1][1][1]);
        A[i + 1][2][1] = min(A[i][2][1], A[i + 1][2][1]);
      }
    }
    printf("%d. %d\n", q, A[N - 1][1][1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x249f20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1168 <main+0x38>
jmp    15df <main+0x4af>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f4 <main+0xc4>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    11e1 <main+0xb1>
movslq -0x8(%rbp),%rax
lea    -0x249f20(%rbp),%rsi
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe50(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movl   $0x3b9ac9ff,0x4(%rax,%rcx,8)
3b
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1182 <main+0x52>
jmp    11e6 <main+0xb6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <main+0x3f>
movl   $0x0,-0x249f14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15a8 <main+0x478>
cmpl   $0x0,-0x8(%rbp)
jle    1343 <main+0x213>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%ecx
movslq -0x8(%rbp),%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edi
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    133e <main+0x20e>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
jmp    1343 <main+0x213>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
movslq -0x8(%rbp),%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    0xc(%rax),%ecx
mov    %ecx,0xc(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%edi
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14b7 <main+0x387>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%ecx
movslq -0x8(%rbp),%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    0x14(%rax),%ecx
mov    %ecx,0x14(%rax)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1595 <main+0x465>
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
movslq -0x8(%rbp),%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%edi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%esi
call   1040 <min@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
jmp    159a <main+0x46a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1205 <main+0xd5>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x249f20(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%edx
lea    0xa37(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <main+0x19>
xor    %eax,%eax
add    $0x249f20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x249f18,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     1328 <main+0x1f8>
mov    $0x1,%r12d
lea    0xe95(%rip),%r14
lea    0xc(%rsp),%r15
jmp    11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x0,0x1c(%rsp)
add    $0xffffffff,%ecx
movslq %ecx,%rax
lea    (%rax,%rax,2),%rax
mov    0x1c(%rsp,%rax,8),%edx
lea    0xe66(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     1328 <main+0x1f8>
test   %ecx,%ecx
jle    1180 <main+0x50>
lea    0x20(%rsp),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    -0x10(%rbp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
movl   $0x3b9ac9ff,-0xc(%rbp)
lea    -0x8(%rbp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
movl   $0x3b9ac9ff,-0x4(%rbp)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
movl   $0x3b9ac9ff,0x4(%rbp)
add    $0x1,%rbx
movslq 0xc(%rsp),%rcx
add    $0x18,%rbp
cmp    %rcx,%rbx
jl     11d0 <main+0xa0>
movl   $0x0,0x1c(%rsp)
test   %ecx,%ecx
jle    1188 <main+0x58>
lea    0x3c(%rsp),%rbp
xor    %r13d,%r13d
jmp    1253 <main+0x123>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ecx,%rax
add    $0x18,%rbp
mov    %rbx,%r13
cmp    %rax,%rbx
jge    1188 <main+0x58>
test   %r13,%r13
je     1296 <main+0x166>
mov    -0x28(%rbp),%edi
mov    -0x20(%rbp),%esi
add    -0x2c(%rbp),%edi
mov    %edi,-0x28(%rbp)
call   1040 <min@plt>
mov    %eax,-0x20(%rbp)
movslq 0xc(%rsp),%rax
add    $0xffffffffffffffff,%rax
cmp    %rax,%r13
jge    1296 <main+0x166>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x10(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
add    -0x24(%rbp),%edi
mov    %edi,-0x20(%rbp)
call   1040 <min@plt>
mov    %eax,-0x18(%rbp)
movslq 0xc(%rsp),%rcx
lea    -0x1(%rcx),%rdx
cmp    %rdx,%r13
jge    12f1 <main+0x1c1>
mov    -0x20(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%edi
mov    0x0(%rbp),%esi
call   1040 <min@plt>
mov    %eax,0x0(%rbp)
mov    -0x18(%rbp),%eax
movslq 0xc(%rsp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
add    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0x1(%r13),%rbx
cmp    %rdx,%r13
jge    1240 <main+0x110>
mov    -0x8(%rbp),%esi
mov    %eax,%edi
call   1040 <min@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%edi
mov    0x0(%rbp),%esi
call   1040 <min@plt>
mov    %eax,0x0(%rbp)
mov    0xc(%rsp),%ecx
jmp    1240 <main+0x110>
xor    %eax,%eax
add    $0x249f18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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