#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*/ Aones(int *);
int /*<<< orphan*/ M_init(int **, int, int);
int atoi(char *);
int move(int **, int, int *, int *, int *);
int /*<<< orphan*/ printb(int **);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int m = 0, n = 0;
  int mvnum = 1, i = 0;
  int M[8][8], mvchoice[(8) * (8) + 1];
  if (argc == 3)
    m = atoi(argv[1]) - 1, n = atoi(argv[2]) - 1;
  Aones(mvchoice);
  M_init(M, m, n);
  while (mvnum) {
    while (mvnum < (8) * (8))
      mvnum = move(M, mvnum, mvchoice, &m, &n);
    printb(M);
    printf("%d\n", ++i);
    while (mvnum == (8) * (8))
      mvnum = move(M, mvnum, mvchoice, &m, &n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11c5 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
call   1050 <Aones@plt>
lea    -0x120(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <M_init@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1278 <main+0x118>
jmp    11f2 <main+0x92>
cmpl   $0x40,-0x1c(%rbp)
jge    1222 <main+0xc2>
lea    -0x120(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x230(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1080 <move@plt>
mov    %eax,-0x1c(%rbp)
jmp    11f2 <main+0x92>
lea    -0x120(%rbp),%rdi
call   1030 <printb@plt>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
lea    0xdc2(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x40,-0x1c(%rbp)
jne    1273 <main+0x113>
lea    -0x120(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x230(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1080 <move@plt>
mov    %eax,-0x1c(%rbp)
jmp    1243 <main+0xe3>
jmp    11e3 <main+0x83>
xor    %eax,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %r14d,%r14d
mov    $0x0,%ebp
mov    $0x0,%ebx
cmp    $0x3,%edi
jne    11ba <main+0x5a>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
add    $0xffffffff,%ebx
mov    %ebx,0xc(%rsp)
mov    0x10(%r15),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
add    $0xffffffff,%ebp
mov    %ebp,0x8(%rsp)
lea    0x110(%rsp),%r15
mov    %r15,%rdi
call   1050 <Aones@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <M_init@plt>
mov    $0x1,%r13d
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%rbp
jmp    11f5 <main+0x95>
nopl   (%rax)
test   %r13d,%r13d
je     1260 <main+0x100>
cmp    $0x3f,%r13d
jg     121c <main+0xbc>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <move@plt>
mov    %eax,%r13d
cmp    $0x40,%eax
jl     1200 <main+0xa0>
mov    %r12,%rdi
call   1030 <printb@plt>
add    $0x1,%r14d
lea    0xdd1(%rip),%rdi
mov    %r14d,%esi
call   1060 <printf@plt>
cmp    $0x40,%r13d
jne    11f0 <main+0x90>
nopl   (%rax)
mov    %r12,%rdi
mov    $0x40,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <move@plt>
cmp    $0x40,%eax
je     1240 <main+0xe0>
mov    %eax,%r13d
jmp    11f0 <main+0x90>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x [8 x i32]]
%6 = alloca [65 x i32]
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast [8 x [8 x i32]]* %5 to i8*
%10 = bitcast [65 x i32]* %6 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %12, label %21
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = add nsw i32 %15, -1
store i32 %16, i32* %3
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = add nsw i32 %19, -1
store i32 %20, i32* %4
br label %21
21: ; preds = %12, %2
%22 = phi i32 [ %20, %12 ], [ 0, %2 ]
%23 = phi i32 [ %16, %12 ], [ 0, %2 ]
%24 = getelementptr inbounds [65 x i32], [65 x i32]* %6, i64 0, i64 0
%25 = call i32 @Aones(i32* %24)
%26 = bitcast [8 x [8 x i32]]* %5 to i32**
%27 = call i32 @M_init(i32** %26, i32 %23, i32 %22)
br label %31
28: ; preds = %45, %39
%29 = phi i32 [ %40, %39 ], [ %46, %45 ]
%30 = icmp eq i32 %29, 0
br i1 %30, label %48, label %31
31: ; preds = %21, %28
%32 = phi i32 [ 0, %21 ], [ %42, %28 ]
%33 = phi i32 [ 1, %21 ], [ %29, %28 ]
%34 = icmp slt i32 %33, 64
br i1 %34, label %35, label %39
35: ; preds = %31, %35
%36 = phi i32 [ %37, %35 ], [ %33, %31 ]
%37 = call i32 @move(i32** %26, i32 %36, i32* %24, i32* %3, i32* %4)
%38 = icmp slt i32 %37, 64
br i1 %38, label %35, label %39
39: ; preds = %35, %31
%40 = phi i32 [ %33, %31 ], [ %37, %35 ]
%41 = call i32 @printb(i32** %26)
%42 = add nuw nsw i32 %32, 1
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = icmp eq i32 %40, 64
br i1 %44, label %45, label %28
45: ; preds = %39, %45
%46 = call i32 @move(i32** %26, i32 64, i32* %24, i32* %3, i32* %4)
%47 = icmp eq i32 %46, 64
br i1 %47, label %45, label %28
48: ; preds = %28
ret i32 0
}