#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 h;
typedef int g;
typedef int f;
typedef int e;

/* Variables and functions */
char getchar();
int /*<<< orphan*/ l();
int m(int, int, int, int);
int /*<<< orphan*/ printf(char *);
int random();
main() {
  int e, f, g, h, i, j, k;
  l();
  for ((e = (0)); ((e) + (-60)); (e = (((e) + (1))))) {
    (h = (0));
    for ((f = (1)); ((f) + (-9)); (f = (((f) + (1)))))
      for ((g = (1)); ((g) + (-9)); (g = (((g) + (1)))))
        (h = (((h) + (m(f, g, 1, 1)))));
    if (h) {
      do {
        printf("\n?");
        do {
          (f = (getchar() - (('A') + ((((0) + (-(1))))))));
        } while (((f < 1) || (f > 8)));
        do {
          (g = (getchar() - '0'));
        } while (((g < 1) || (g > 8)));
      } while ((!m(f, g, 1, (((0) + (-(1)))))));
      l();
    }
    (h = (0));
    for ((f = (1)); ((f) + (-9)); (f = (((f) + (1)))))
      for ((g = (1)); ((g) + (-9)); (g = (((g) + (1)))))
        if (((k = (((m(f, g, (((0) + (-(1)))), 1)) + ((random() % 6)))))) > h) {
          (h = (k));
          (i = (f));
          (j = (g));
        }
    if (h && m(i, j, (((0) + (-(1)))), (((0) + (-(1))))))
      l();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <l@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffc4,%eax
cmp    $0x0,%eax
je     138d <main+0x23d>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff7,%eax
cmp    $0x0,%eax
je     11f2 <main+0xa2>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xfffffff7,%eax
cmp    $0x0,%eax
je     11df <main+0x8f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1070 <m@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a0 <main+0x50>
jmp    11e4 <main+0x94>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x3a>
cmpl   $0x0,-0x14(%rbp)
je     12ab <main+0x15b>
jmp    1201 <main+0xb1>
lea    0xdf8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
sub    $0x40,%eax
mov    %eax,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x25(%rbp)
jl     1236 <main+0xe6>
cmpl   $0x8,-0xc(%rbp)
setg   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    120d <main+0xbd>
jmp    1246 <main+0xf6>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x10(%rbp)
mov    %al,-0x26(%rbp)
jl     126f <main+0x11f>
cmpl   $0x8,-0x10(%rbp)
setg   %al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
test   $0x1,%al
jne    1246 <main+0xf6>
jmp    127f <main+0x12f>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1070 <m@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1201 <main+0xb1>
mov    $0x0,%al
call   1030 <l@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff7,%eax
cmp    $0x0,%eax
je     134e <main+0x1fe>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xfffffff7,%eax
cmp    $0x0,%eax
je     133b <main+0x1eb>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1060 <random@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    -0x2c(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x20(%rbp)
cmp    -0x14(%rbp),%eax
jle    1328 <main+0x1d8>
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    132d <main+0x1dd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12cf <main+0x17f>
jmp    1340 <main+0x1f0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12b9 <main+0x169>
cmpl   $0x0,-0x14(%rbp)
je     137a <main+0x22a>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0xffffffff,%ecx
mov    %ecx,%edx
call   1070 <m@plt>
cmp    $0x0,%eax
je     137a <main+0x22a>
mov    $0x0,%al
call   1030 <l@plt>
jmp    137f <main+0x22f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
xor    %eax,%eax
call   1030 <l@plt>
xor    %eax,%eax
jmp    1180 <main+0x30>
nopl   0x0(%rax)
mov    0x1c(%rsp),%eax
add    $0x1,%eax
cmp    $0x3c,%eax
je     16a1 <main+0x551>
mov    %eax,0x1c(%rsp)
xor    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
mov    $0x4,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
mov    $0x5,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
mov    $0x7,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
mov    $0x8,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%ebp
add    %r14d,%ebp
add    $0x1,%ebx
cmp    $0x9,%ebx
jne    1190 <main+0x40>
test   %ebp,%ebp
je     12f4 <main+0x1a4>
lea    0xd7d(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
call   1040 <printf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x49(%rax),%ecx
cmp    $0xf8,%cl
jb     12a0 <main+0x150>
movzbl %al,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x39(%rax),%ecx
cmp    $0xf8,%cl
jb     12c0 <main+0x170>
add    $0xffffffc0,%ebx
movzbl %al,%esi
add    $0xffffffd0,%esi
mov    %ebx,%edi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1070 <m@plt>
test   %eax,%eax
je     1290 <main+0x140>
xor    %eax,%eax
call   1030 <l@plt>
mov    $0x1,%edi
xor    %edx,%edx
mov    %r12d,%ecx
jmp    1311 <main+0x1c1>
add    $0x1,%edi
mov    %r12d,%ecx
mov    %eax,%edx
cmp    $0x9,%edi
je     1670 <main+0x520>
mov    %edx,(%rsp)
mov    %ecx,0x20(%rsp)
mov    %r15d,0x24(%rsp)
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
mov    %edi,%ebp
call   1070 <m@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <random@plt>
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
add    %ebx,%edx
mov    %rdx,0x58(%rsp)
movl   $0x2,0x18(%rsp)
mov    %ebp,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <random@plt>
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
add    %ebx,%edx
mov    %rdx,0x60(%rsp)
movl   $0x3,0x14(%rsp)
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x40(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
mov    %rdx,0x50(%rsp)
movl   $0x4,0x10(%rsp)
mov    %ebp,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x3c(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
mov    %eax,0x28(%rsp)
cltq
imul   $0x2aaaaaab,%rax,%r13
mov    %r13,%rax
shr    $0x3f,%rax
shr    $0x20,%r13
add    %eax,%r13d
add    %r13d,%r13d
movl   $0x5,0xc(%rsp)
mov    %ebp,%edi
mov    $0x5,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x38(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
mov    %eax,0x4c(%rsp)
cltq
imul   $0x2aaaaaab,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
shr    $0x20,%r14
add    %eax,%r14d
movl   $0x6,0x8(%rsp)
mov    %ebp,%edi
mov    $0x6,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x34(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
mov    %eax,0x48(%rsp)
cltq
imul   $0x2aaaaaab,%rax,%r15
mov    %r15,%rbx
shr    $0x3f,%rbx
shr    $0x20,%r15
movl   $0x7,0x4(%rsp)
mov    %ebp,%edi
mov    $0x7,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x30(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
mov    %eax,0x44(%rsp)
cltq
imul   $0x2aaaaaab,%rax,%r12
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0xffffffff,%edx
mov    $0x1,%ecx
call   1070 <m@plt>
mov    %eax,0x2c(%rsp)
xor    %eax,%eax
call   1060 <random@plt>
mov    (%rsp),%edx
mov    0x58(%rsp),%rsi
movslq %eax,%rcx
mov    $0x1,%edi
mov    %ebp,%r9d
cmp    %edx,%esi
jg     153e <main+0x3ee>
mov    %edx,%esi
mov    0x20(%rsp),%edi
mov    0x24(%rsp),%r9d
mov    %edi,(%rsp)
imul   $0x2aaaaaab,%rcx,%rcx
mov    %r12,%rdx
shr    $0x3f,%rdx
shr    $0x20,%r12
add    %ebx,%r15d
add    %r14d,%r14d
lea    0x0(%r13,%r13,2),%edi
mov    0x28(%rsp),%r8d
sub    %edi,%r8d
mov    0x50(%rsp),%r11
add    0x40(%rsp),%r11d
mov    %ebp,%r10d
mov    0x60(%rsp),%r13
cmp    %esi,%r13d
jg     158a <main+0x43a>
mov    %esi,%r13d
mov    (%rsp),%esi
mov    %esi,0x18(%rsp)
mov    %r9d,%r10d
mov    %rcx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rcx
add    %edx,%r12d
add    %r15d,%r15d
lea    (%r14,%r14,2),%edx
mov    0x4c(%rsp),%r9d
sub    %edx,%r9d
add    0x3c(%rsp),%r8d
mov    %ebp,%edx
cmp    %r13d,%r11d
mov    %ebp,%edi
jg     15c3 <main+0x473>
mov    %r13d,%r11d
mov    0x18(%rsp),%edx
mov    %edx,0x14(%rsp)
mov    %r10d,%edx
add    %esi,%ecx
add    %r12d,%r12d
lea    (%r15,%r15,2),%esi
mov    0x48(%rsp),%ebx
sub    %esi,%ebx
add    0x38(%rsp),%r9d
mov    %edi,%esi
cmp    %r11d,%r8d
mov    0x44(%rsp),%ebp
jg     15ef <main+0x49f>
mov    %r11d,%r8d
mov    0x14(%rsp),%esi
mov    %esi,0x10(%rsp)
mov    %edx,%esi
add    %ecx,%ecx
lea    (%r12,%r12,2),%edx
sub    %edx,%ebp
add    0x34(%rsp),%ebx
mov    %edi,%edx
cmp    %r8d,%r9d
jg     160f <main+0x4bf>
mov    %r8d,%r9d
mov    0x10(%rsp),%edx
mov    %edx,0xc(%rsp)
mov    %esi,%edx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
add    0x30(%rsp),%ebp
mov    %edi,%ecx
cmp    %r9d,%ebx
mov    $0x8,%r12d
jg     1632 <main+0x4e2>
mov    %r9d,%ebx
mov    0xc(%rsp),%ecx
mov    %ecx,0x8(%rsp)
mov    %edx,%ecx
add    0x2c(%rsp),%eax
mov    %edi,%edx
cmp    %ebx,%ebp
jg     1648 <main+0x4f8>
mov    %ebx,%ebp
mov    0x8(%rsp),%edx
mov    %edx,0x4(%rsp)
mov    %ecx,%edx
mov    %edi,%r15d
cmp    %ebp,%eax
jg     1300 <main+0x1b0>
mov    %ebp,%eax
mov    %edx,%r15d
mov    0x4(%rsp),%r12d
jmp    1300 <main+0x1b0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %eax,%eax
je     1170 <main+0x20>
mov    %r15d,%edi
mov    %r12d,%esi
mov    $0xffffffff,%edx
mov    $0xffffffff,%ecx
call   1070 <m@plt>
test   %eax,%eax
je     1170 <main+0x20>
xor    %eax,%eax
call   1030 <l@plt>
jmp    1170 <main+0x20>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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