#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*/ print();
int /*<<< orphan*/ setarray(int, int, int);
int main(int argc, char const *argv[]) {
  int n = 0;
  int hua = 1, fangxiang = 0;
  int moveStep = 0;
  int cmdtemp;
  int draw = 0;
  int cmd[40] = {2, 524, 3, 524, 4, 512, 4, 506, 4, 506, 4, 503,
                 3, 516, 4, 509, 4, 508, 4, 507, 1, 6,   9};
  while (cmd[n] != 9) {
    cmdtemp = cmd[n];
    if (cmdtemp == 1) {
      hua = 1;
    } else if (cmdtemp == 2) {
      hua = 2;
    }
    if (cmdtemp == 3) {
      fangxiang = 3;
    } else if (cmdtemp == 4) {
      fangxiang = 4;
    }
    if (cmdtemp > 499) {
      draw = 5;
      moveStep = cmdtemp % 100;
      setarray(hua, fangxiang, moveStep);
    }
    if (cmdtemp == 6) {
      print();
    }
    draw = 0;
    n++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0xa0,%edx
call   1040 <memcpy@plt>
movslq -0x14(%rbp),%rax
cmpl   $0x9,-0xd0(%rbp,%rax,4)
09
je     1252 <main+0x122>
movslq -0x14(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    11ba <main+0x8a>
movl   $0x1,-0x18(%rbp)
jmp    11d0 <main+0xa0>
cmpl   $0x2,-0x24(%rbp)
jne    11cb <main+0x9b>
movl   $0x2,-0x18(%rbp)
jmp    11d0 <main+0xa0>
cmpl   $0x3,-0x24(%rbp)
jne    11e6 <main+0xb6>
movl   $0x3,-0x1c(%rbp)
jmp    11fc <main+0xcc>
cmpl   $0x4,-0x24(%rbp)
jne    11f7 <main+0xc7>
movl   $0x4,-0x1c(%rbp)
jmp    11fc <main+0xcc>
cmpl   $0x1f3,-0x24(%rbp)
jle    122c <main+0xfc>
movl   $0x5,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <setarray@plt>
cmpl   $0x6,-0x24(%rbp)
jne    123d <main+0x10d>
mov    $0x0,%al
call   1030 <print@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <main+0x54>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebp
lea    0xefd(%rip),%rbx
lea    0xec6(%rip),%r15
xor    %r14d,%r14d
jmp    114b <main+0x2b>
nop
mov    %ebp,%eax
mov    %edx,%r14d
add    $0x4,%rbx
mov    %eax,%ebp
mov    (%rbx),%edx
lea    -0x1(%rdx),%eax
cmp    $0x8,%eax
ja     1167 <main+0x47>
movslq (%r15,%rax,4),%rcx
add    %r15,%rcx
mov    %edx,%eax
jmp    *%rcx
mov    $0x2,%eax
jmp    1145 <main+0x25>
cmp    $0x1f4,%edx
jl     118f <main+0x6f>
mov    %edx,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %ebp,%edi
mov    %r14d,%esi
call   1040 <setarray@plt>
mov    %ebp,%eax
jmp    1145 <main+0x25>
cmp    $0x6,%edx
jne    119b <main+0x7b>
xor    %eax,%eax
call   1030 <print@plt>
mov    %ebp,%eax
jmp    1145 <main+0x25>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.cmd = <{ [23 x i32], [17 x i32] }> <{ [23 x i32] [i32 2, i32 524, i32 3, i32 524, i32 4, i32 512, i32 4, i32 506, i32 4, i32 506, i32 4, i32 503, i32 3, i32 516, i32 4, i32 509, i32 4, i32 508, i32 4, i32 507, i32 1, i32 6, i32 9], [17 x i32] zeroinitializer }>
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 i32
%11 = alloca i32
%12 = alloca [40 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %11
%13 = bitcast [40 x i32]* %12 to i8*
br label %14
14: ; preds = %57, %2
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [40 x i32], [40 x i32]* %12, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 9
br i1 %19, label %20, label %60
20: ; preds = %14
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [40 x i32], [40 x i32]* %12, i64 0, i64 %22
%24 = load i32, i32* %23
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 1, i32* %7
br label %33
28: ; preds = %20
%29 = load i32, i32* %10
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 2, i32* %7
br label %32
32: ; preds = %31, %28
br label %33
33: ; preds = %32, %27
%34 = load i32, i32* %10
%35 = icmp eq i32 %34, 3
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 3, i32* %8
br label %42
37: ; preds = %33
%38 = load i32, i32* %10
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 4, i32* %8
br label %41
41: ; preds = %40, %37
br label %42
42: ; preds = %41, %36
%43 = load i32, i32* %10
%44 = icmp sgt i32 %43, 499
br i1 %44, label %45, label %52
45: ; preds = %42
store i32 5, i32* %11
%46 = load i32, i32* %10
%47 = srem i32 %46, 100
store i32 %47, i32* %9
%48 = load i32, i32* %7
%49 = load i32, i32* %8
%50 = load i32, i32* %9
%51 = call i32 @setarray(i32 %48, i32 %49, i32 %50)
br label %52
52: ; preds = %45, %42
%53 = load i32, i32* %10
%54 = icmp eq i32 %53, 6
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (...) @print()
br label %57
57: ; preds = %55, %52
store i32 0, i32* %11
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
br label %14
60: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@__const.main.cmd = <{ [23 x i32], [17 x i32] }> <{ [23 x i32] [i32 2, i32 524, i32 3, i32 524, i32 4, i32 512, i32 4, i32 506, i32 4, i32 506, i32 4, i32 503, i32 3, i32 516, i32 4, i32 509, i32 4, i32 508, i32 4, i32 507, i32 1, i32 6, i32 9], [17 x i32] zeroinitializer }>
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %21, %2
%4 = phi i64 [ %24, %21 ], [ 0, %2 ]
%5 = phi i32 [ %22, %21 ], [ 1, %2 ]
%6 = phi i32 [ %23, %21 ], [ 0, %2 ]
%7 = getelementptr inbounds [40 x i32], [40 x i32]* bitcast (<{ [23 x i32], [17 x i32] }>* @__const.main.cmd to [40 x i32]*), i64 0, i64 %4
%8 = load i32, i32* %7
switch i32 %8, label %11 [
i32 9, label %25
i32 1, label %21
i32 2, label %9
i32 3, label %20
i32 4, label %10
]
9: ; preds = %3
br label %21
10: ; preds = %3
br label %21
11: ; preds = %3
%12 = icmp sgt i32 %8, 499
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = urem i32 %8, 100
%15 = tail call i32 @setarray(i32 %5, i32 %6, i32 %14)
br label %21
16: ; preds = %11
%17 = icmp eq i32 %8, 6
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = tail call i32 (...) @print()
br label %21
20: ; preds = %3
br label %21
21: ; preds = %3, %20, %10, %9, %13, %18, %16
%22 = phi i32 [ %5, %18 ], [ %5, %16 ], [ %5, %13 ], [ %8, %3 ], [ 2, %9 ], [ %5, %10 ], [ %5, %20 ]
%23 = phi i32 [ %6, %18 ], [ %6, %16 ], [ %6, %13 ], [ %6, %3 ], [ %6, %9 ], [ %8, %10 ], [ %8, %20 ]
%24 = add nuw i64 %4, 1
br label %3
25: ; preds = %3
ret i32 0
}