#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*/ addch(char);
int addstr(char *);
int clear();
int move(int, int);
int printw(char *, ...);
int refresh();
void game_scene_print_face(char **face, int size, int flag, int steps,
                           int lastv, int lasth, int loop_c, int running) {
  while (clear(), 0) {
  }
  while (move(0 + 6 + 0, 0 + 6), addstr("Current State:"), 0) {
  }
  while (move(0 + 6 + 1, 0 + 6),
         printw("Total: %2d, Left: %2d, Steps: %2d", size, size - flag, steps),
         0) {
  }
  while (loop_c = 0, 0) {
  }
  while (loop_c < size * size) {
    while (
        move((0 + 6 + 3) + 2 * (loop_c / size), (0 + 6) + 4 * (loop_c % size)),
        addch(face[loop_c / size][loop_c % size]), 0) {
    }
    while (loop_c++, 0) {
    }
  }
  while (move((0 + 6 + 3) + 2 * size + 1, 0 + 6), 0) {
  }
  if (running) {
    while (addstr("Press SPACE to explore, F to flag, U to unflag."), 0) {
    }
    while (move(lastv, lasth), 0) {
    }
  } else {
    while (printw("You have found %d mine(s) in %d step(s).", flag, steps), 0) {
    }
    while ((move((0 + 6 + 3) + 2 * size + 2, 0 + 6), 0)) {
    }
    if (flag == size) {
      while (printw("Win! Press Q to back."), 0) {
      }
    } else {
      while (printw("Lose! Press Q to back."), 0) {
      }
    }
  }
  while (refresh(), 0) {
  }
}


x86 assembly (clang, -O0):
<game_scene_print_face>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <clear@plt>
xor    %eax,%eax
test   $0x1,%al
jne    1199 <game_scene_print_face+0x39>
jmp    119e <game_scene_print_face+0x3e>
jmp    1183 <game_scene_print_face+0x23>
jmp    11a3 <game_scene_print_face+0x43>
mov    $0x6,%esi
mov    %esi,%edi
call   1080 <move@plt>
lea    0xe4a(%rip),%rdi
call   1060 <addstr@plt>
xor    %eax,%eax
test   $0x1,%al
jne    11ca <game_scene_print_face+0x6a>
jmp    11cf <game_scene_print_face+0x6f>
jmp    11a3 <game_scene_print_face+0x43>
jmp    11d4 <game_scene_print_face+0x74>
mov    $0x7,%edi
mov    $0x6,%esi
call   1080 <move@plt>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
xor    %eax,%eax
test   $0x1,%al
jne    120c <game_scene_print_face+0xac>
jmp    1211 <game_scene_print_face+0xb1>
jmp    11d4 <game_scene_print_face+0x74>
jmp    1216 <game_scene_print_face+0xb6>
movl   $0x0,0x10(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    122c <game_scene_print_face+0xcc>
jmp    1231 <game_scene_print_face+0xd1>
jmp    1216 <game_scene_print_face+0xb6>
jmp    1236 <game_scene_print_face+0xd6>
mov    0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    12e2 <game_scene_print_face+0x182>
jmp    124d <game_scene_print_face+0xed>
mov    0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%edi
shl    $0x1,%edi
add    $0x9,%edi
mov    0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
shl    $0x2,%esi
add    $0x6,%esi
call   1080 <move@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x28(%rbp),%rax
movslq %edx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <addch@plt>
xor    %eax,%eax
test   $0x1,%al
jne    12b6 <game_scene_print_face+0x156>
jmp    12bb <game_scene_print_face+0x15b>
jmp    124d <game_scene_print_face+0xed>
jmp    12c0 <game_scene_print_face+0x160>
mov    0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,0x10(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    12d8 <game_scene_print_face+0x178>
jmp    12dd <game_scene_print_face+0x17d>
jmp    12c0 <game_scene_print_face+0x160>
jmp    1236 <game_scene_print_face+0xd6>
jmp    12e7 <game_scene_print_face+0x187>
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
add    $0x9,%edi
add    $0x1,%edi
mov    $0x6,%esi
call   1080 <move@plt>
xor    %eax,%eax
test   $0x1,%al
jne    130c <game_scene_print_face+0x1ac>
jmp    1311 <game_scene_print_face+0x1b1>
jmp    12e7 <game_scene_print_face+0x187>
cmpl   $0x0,0x18(%rbp)
je     1369 <game_scene_print_face+0x209>
jmp    1320 <game_scene_print_face+0x1c0>
lea    0xd0a(%rip),%rdi
call   1060 <addstr@plt>
xor    %eax,%eax
test   $0x1,%al
jne    133b <game_scene_print_face+0x1db>
jmp    1340 <game_scene_print_face+0x1e0>
jmp    1320 <game_scene_print_face+0x1c0>
jmp    1345 <game_scene_print_face+0x1e5>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1080 <move@plt>
xor    %eax,%eax
test   $0x1,%al
jne    135f <game_scene_print_face+0x1ff>
jmp    1364 <game_scene_print_face+0x204>
jmp    1345 <game_scene_print_face+0x1e5>
jmp    142e <game_scene_print_face+0x2ce>
jmp    136e <game_scene_print_face+0x20e>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
xor    %eax,%eax
test   $0x1,%al
jne    1391 <game_scene_print_face+0x231>
jmp    1396 <game_scene_print_face+0x236>
jmp    136e <game_scene_print_face+0x20e>
jmp    139b <game_scene_print_face+0x23b>
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
add    $0x9,%edi
add    $0x2,%edi
mov    $0x6,%esi
call   1080 <move@plt>
xor    %eax,%eax
test   $0x1,%al
jne    13c0 <game_scene_print_face+0x260>
jmp    13c5 <game_scene_print_face+0x265>
jmp    139b <game_scene_print_face+0x23b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    13fd <game_scene_print_face+0x29d>
jmp    13d6 <game_scene_print_face+0x276>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
xor    %eax,%eax
test   $0x1,%al
jne    13f3 <game_scene_print_face+0x293>
jmp    13f8 <game_scene_print_face+0x298>
jmp    13d6 <game_scene_print_face+0x276>
jmp    1429 <game_scene_print_face+0x2c9>
jmp    1402 <game_scene_print_face+0x2a2>
lea    0xc97(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
xor    %eax,%eax
test   $0x1,%al
jne    141f <game_scene_print_face+0x2bf>
jmp    1424 <game_scene_print_face+0x2c4>
jmp    1402 <game_scene_print_face+0x2a2>
jmp    1429 <game_scene_print_face+0x2c9>
jmp    142e <game_scene_print_face+0x2ce>
jmp    1433 <game_scene_print_face+0x2d3>
mov    $0x0,%al
call   1050 <refresh@plt>
xor    %eax,%eax
test   $0x1,%al
jne    1449 <game_scene_print_face+0x2e9>
jmp    144e <game_scene_print_face+0x2ee>
jmp    1433 <game_scene_print_face+0x2d3>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<game_scene_print_face>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x10(%rsp)
mov    %r8d,0xc(%rsp)
mov    %ecx,%r12d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    0x58(%rsp),%eax
mov    %eax,0x14(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <clear@plt>
mov    $0x6,%edi
mov    $0x6,%esi
call   1080 <move@plt>
lea    0xe55(%rip),%rdi
call   1060 <addstr@plt>
mov    $0x7,%edi
mov    $0x6,%esi
call   1080 <move@plt>
mov    %ebx,%edx
mov    %r15d,0x8(%rsp)
sub    %r15d,%edx
lea    0xe3f(%rip),%rdi
mov    %ebx,%esi
mov    %r12d,0x4(%rsp)
mov    %r12d,%ecx
xor    %eax,%eax
call   1030 <printw@plt>
mov    %ebx,%r13d
imul   %ebx,%r13d
test   %r13d,%r13d
je     122b <game_scene_print_face+0xcb>
nopl   (%rax)
mov    %r14d,%eax
cltd
idiv   %ebx
mov    %edx,%r12d
mov    %eax,%r15d
lea    (%r15,%r15,1),%edi
add    $0x9,%edi
lea    0x6(,%r12,4),%esi
call   1080 <move@plt>
movslq %r15d,%rax
mov    0x0(%rbp,%rax,8),%rax
movsbl (%rax,%r12,1),%edi
call   1040 <addch@plt>
add    $0x1,%r14d
cmp    %r14d,%r13d
jne    11f0 <game_scene_print_face+0x90>
lea    (%rbx,%rbx,1),%edi
add    $0xa,%edi
mov    $0x6,%esi
call   1080 <move@plt>
cmpl   $0x0,0x14(%rsp)
je     125d <game_scene_print_face+0xfd>
lea    0xde8(%rip),%rdi
call   1060 <addstr@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
call   1080 <move@plt>
jmp    12a5 <game_scene_print_face+0x145>
lea    (%rbx,%rbx,1),%ebp
lea    0xdfa(%rip),%rdi
mov    0x8(%rsp),%r14d
mov    %r14d,%esi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1030 <printw@plt>
add    $0xb,%ebp
mov    %ebp,%edi
mov    $0x6,%esi
call   1080 <move@plt>
cmp    %r14d,%ebx
jne    1297 <game_scene_print_face+0x137>
lea    0xdf5(%rip),%rdi
jmp    129e <game_scene_print_face+0x13e>
lea    0xe02(%rip),%rdi
xor    %eax,%eax
call   1030 <printw@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <refresh@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Current State:\00"
@.str.1 = [34 x i8] c"Total: %2d, Left: %2d, Steps: %2d\00"
@.str.2 = [48 x i8] c"Press SPACE to explore, F to flag, U to unflag.\00"
@.str.3 = [41 x i8] c"You have found %d mine(s) in %d step(s).\00"
@.str.4 = [22 x i8] c"Win! Press Q to back.\00"
@.str.5 = [23 x i8] c"Lose! Press Q to back.\00"
define void @game_scene_print_face(i8** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8** %0, i8*** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
br label %17
17: ; preds = %19, %8
%18 = call i32 (...) @clear()
br i1 false, label %19, label %20
19: ; preds = %17
br label %17
20: ; preds = %17
br label %21
21: ; preds = %24, %20
%22 = call i32 @move(i32 6, i32 6)
%23 = call i32 @addstr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br i1 false, label %24, label %25
24: ; preds = %21
br label %21
25: ; preds = %21
br label %26
26: ; preds = %34, %25
%27 = call i32 @move(i32 7, i32 6)
%28 = load i32, i32* %10
%29 = load i32, i32* %10
%30 = load i32, i32* %11
%31 = sub nsw i32 %29, %30
%32 = load i32, i32* %12
%33 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %31, i32 %32)
br i1 false, label %34, label %35
34: ; preds = %26
br label %26
35: ; preds = %26
br label %36
36: ; preds = %37, %35
store i32 0, i32* %15
br i1 false, label %37, label %38
37: ; preds = %36
br label %36
38: ; preds = %36
br label %39
39: ; preds = %78, %38
%40 = load i32, i32* %15
%41 = load i32, i32* %10
%42 = load i32, i32* %10
%43 = mul nsw i32 %41, %42
%44 = icmp slt i32 %40, %43
br i1 %44, label %45, label %79
45: ; preds = %39
br label %46
46: ; preds = %72, %45
%47 = load i32, i32* %15
%48 = load i32, i32* %10
%49 = sdiv i32 %47, %48
%50 = mul nsw i32 2, %49
%51 = add nsw i32 9, %50
%52 = load i32, i32* %15
%53 = load i32, i32* %10
%54 = srem i32 %52, %53
%55 = mul nsw i32 4, %54
%56 = add nsw i32 6, %55
%57 = call i32 @move(i32 %51, i32 %56)
%58 = load i8**, i8*** %9
%59 = load i32, i32* %15
%60 = load i32, i32* %10
%61 = sdiv i32 %59, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %58, i64 %62
%64 = load i8*, i8** %63
%65 = load i32, i32* %15
%66 = load i32, i32* %10
%67 = srem i32 %65, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %64, i64 %68
%70 = load i8, i8* %69
%71 = call i32 @addch(i8 signext %70)
br i1 false, label %72, label %73
72: ; preds = %46
br label %46
73: ; preds = %46
br label %74
74: ; preds = %77, %73
%75 = load i32, i32* %15
%76 = add nsw i32 %75, 1
store i32 %76, i32* %15
br i1 false, label %77, label %78
77: ; preds = %74
br label %74
78: ; preds = %74
br label %39
79: ; preds = %39
br label %80
80: ; preds = %86, %79
%81 = load i32, i32* %10
%82 = mul nsw i32 2, %81
%83 = add nsw i32 9, %82
%84 = add nsw i32 %83, 1
%85 = call i32 @move(i32 %84, i32 6)
br i1 false, label %86, label %87
86: ; preds = %80
br label %80
87: ; preds = %80
%88 = load i32, i32* %16
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %101
90: ; preds = %87
br label %91
91: ; preds = %93, %90
%92 = call i32 @addstr(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br i1 false, label %93, label %94
93: ; preds = %91
br label %91
94: ; preds = %91
br label %95
95: ; preds = %99, %94
%96 = load i32, i32* %13
%97 = load i32, i32* %14
%98 = call i32 @move(i32 %96, i32 %97)
br i1 false, label %99, label %100
99: ; preds = %95
br label %95
100: ; preds = %95
br label %130
101: ; preds = %87
br label %102
102: ; preds = %106, %101
%103 = load i32, i32* %11
%104 = load i32, i32* %12
%105 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %103, i32 %104)
br i1 false, label %106, label %107
106: ; preds = %102
br label %102
107: ; preds = %102
br label %108
108: ; preds = %114, %107
%109 = load i32, i32* %10
%110 = mul nsw i32 2, %109
%111 = add nsw i32 9, %110
%112 = add nsw i32 %111, 2
%113 = call i32 @move(i32 %112, i32 6)
br i1 false, label %114, label %115
114: ; preds = %108
br label %108
115: ; preds = %108
%116 = load i32, i32* %11
%117 = load i32, i32* %10
%118 = icmp eq i32 %116, %117
br i1 %118, label %119, label %124
119: ; preds = %115
br label %120
120: ; preds = %122, %119
%121 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br i1 false, label %122, label %123
122: ; preds = %120
br label %120
123: ; preds = %120
br label %129
124: ; preds = %115
br label %125
125: ; preds = %127, %124
%126 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br i1 false, label %127, label %128
127: ; preds = %125
br label %125
128: ; preds = %125
br label %129
129: ; preds = %128, %123
br label %130
130: ; preds = %129, %100
br label %131
131: ; preds = %133, %130
%132 = call i32 (...) @refresh()
br i1 false, label %133, label %134
133: ; preds = %131
br label %131
134: ; preds = %131
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Current State:\00"
@.str.1 = [34 x i8] c"Total: %2d, Left: %2d, Steps: %2d\00"
@.str.2 = [48 x i8] c"Press SPACE to explore, F to flag, U to unflag.\00"
@.str.3 = [41 x i8] c"You have found %d mine(s) in %d step(s).\00"
@.str.4 = [22 x i8] c"Win! Press Q to back.\00"
@.str.5 = [23 x i8] c"Lose! Press Q to back.\00"
define void @game_scene_print_face(i8** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i32 (...) @clear()
%10 = tail call i32 @move(i32 6, i32 6)
%11 = tail call i32 @addstr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @move(i32 7, i32 6)
%13 = sub nsw i32 %1, %2
%14 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %13, i32 %3)
%15 = mul i32 %1, %1
%16 = icmp eq i32 %15, 0
br i1 %16, label %35, label %17
17: ; preds = %8, %17
%18 = phi i32 [ %33, %17 ], [ 0, %8 ]
%19 = sdiv i32 %18, %1
%20 = shl nsw i32 %19, 1
%21 = add nsw i32 %20, 9
%22 = srem i32 %18, %1
%23 = shl nsw i32 %22, 2
%24 = add nuw nsw i32 %23, 6
%25 = tail call i32 @move(i32 %21, i32 %24)
%26 = sext i32 %19 to i64
%27 = getelementptr inbounds i8*, i8** %0, i64 %26
%28 = load i8*, i8** %27
%29 = zext i32 %22 to i64
%30 = getelementptr inbounds i8, i8* %28, i64 %29
%31 = load i8, i8* %30
%32 = tail call i32 @addch(i8 signext %31)
%33 = add nuw i32 %18, 1
%34 = icmp eq i32 %33, %15
br i1 %34, label %35, label %17
35: ; preds = %17, %8
%36 = shl nsw i32 %1, 1
%37 = add nsw i32 %36, 10
%38 = tail call i32 @move(i32 %37, i32 6)
%39 = icmp eq i32 %7, 0
br i1 %39, label %43, label %40
40: ; preds = %35
%41 = tail call i32 @addstr(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%42 = tail call i32 @move(i32 %4, i32 %5)
br label %52
43: ; preds = %35
%44 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %2, i32 %3)
%45 = add nsw i32 %36, 11
%46 = tail call i32 @move(i32 %45, i32 6)
%47 = icmp eq i32 %1, %2
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %52
50: ; preds = %43
%51 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %52
52: ; preds = %40, %50, %48
%53 = tail call i32 (...) @refresh()
ret void
}