#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 GetKeyPrompt(char *);
int /*<<< orphan*/ printf(char *);
char tolower(int);
int More2(void) {
  int ch;
  for (;;) {
    ch = GetKeyPrompt(
        "\x1b[1;34mMore\x1b[0;36m [\x1b[35mYES\x1b[36m]? \x1b[32m");
    if (tolower(ch) == 'y' || ch == '\n' || ch == ' ') {
      printf("\033[12D\033[K\033[0;32m");
      return 1;
    } else if (tolower(ch) == 'n' || tolower(ch) == 'q' || tolower(ch) == 's') {
      printf("\033[12D\033[K\033[0;32m");
      return 0;
    } else {
      printf("\n\x1b[0;33m '\x1b[1;33my\x1b[0;33m' = Yes, GO.\n "
             "'\x1b[1;33mn\x1b[0;33m' = No, STOP!\x1b[0m\n");
    }
    printf("\033[12D\033[K\033[0;32m");
  }
  printf("\x1b[0;36m");
  return 1;
}


x86 assembly (clang, -O0):
<More2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <GetKeyPrompt@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <tolower@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     116f <More2+0x3f>
cmpl   $0xa,-0x8(%rbp)
je     116f <More2+0x3f>
cmpl   $0x20,-0x8(%rbp)
jne    1187 <More2+0x57>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11fd <More2+0xcd>
mov    -0x8(%rbp),%edi
call   1050 <tolower@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
je     11c3 <More2+0x93>
mov    -0x8(%rbp),%edi
call   1050 <tolower@plt>
movsbl %al,%eax
cmp    $0x71,%eax
je     11c3 <More2+0x93>
mov    -0x8(%rbp),%edi
call   1050 <tolower@plt>
movsbl %al,%eax
cmp    $0x73,%eax
jne    11db <More2+0xab>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fd <More2+0xcd>
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
jmp    11ec <More2+0xbc>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    1138 <More2+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<More2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb1(%rip),%rdi
call   1030 <GetKeyPrompt@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <tolower@plt>
cmp    $0x79,%al
je     116b <More2+0x2b>
cmp    $0xa,%ebp
je     116b <More2+0x2b>
cmp    $0x20,%ebp
jne    1187 <More2+0x47>
mov    $0x1,%ebx
lea    0xeb3(%rip),%rdi
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xeac(%rip),%r14
lea    0xe95(%rip),%r15
lea    0xe64(%rip),%r12
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %ebp,%edi
call   1060 <tolower@plt>
cmp    $0x6e,%al
je     1170 <More2+0x30>
mov    %ebp,%edi
call   1060 <tolower@plt>
cmp    $0x71,%al
je     1170 <More2+0x30>
mov    %ebp,%edi
call   1060 <tolower@plt>
cmp    $0x73,%al
je     1170 <More2+0x30>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
call   1030 <GetKeyPrompt@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <tolower@plt>
cmp    $0x79,%al
je     116b <More2+0x2b>
cmp    $0x20,%ebp
je     116b <More2+0x2b>
cmp    $0xa,%ebp
jne    11a0 <More2+0x60>
jmp    116b <More2+0x2b>

LLVM IR (-O0):
@.str = [42 x i8] c"\1B[1;34mMore\1B[0;36m [\1B[35mYES\1B[36m]? \1B[32m\00"
@.str.1 = [16 x i8] c"\1B[12D\1B[K\1B[0;32m\00"
@.str.2 = [74 x i8] c"\0A\1B[0;33m '\1B[1;33my\1B[0;33m' = Yes, GO.\0A '\1B[1;33mn\1B[0;33m' = No, STOP!\1B[0m\0A\00"
define i32 @More2() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %37, %0
%4 = call i32 @GetKeyPrompt(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call signext i8 @tolower(i32 %5)
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 121
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 10
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %17
15: ; preds = %12, %9, %3
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %39
17: ; preds = %12
%18 = load i32, i32* %2
%19 = call signext i8 @tolower(i32 %18)
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 110
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = load i32, i32* %2
%24 = call signext i8 @tolower(i32 %23)
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 113
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = load i32, i32* %2
%29 = call signext i8 @tolower(i32 %28)
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 115
br i1 %31, label %32, label %34
32: ; preds = %27, %22, %17
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %39
34: ; preds = %27
%35 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34
br label %37
37: ; preds = %36
%38 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %3
39: ; preds = %32, %15
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [42 x i8] c"\1B[1;34mMore\1B[0;36m [\1B[35mYES\1B[36m]? \1B[32m\00"
@.str.1 = [16 x i8] c"\1B[12D\1B[K\1B[0;32m\00"
@str = [73 x i8] c"\0A\1B[0;33m '\1B[1;33my\1B[0;33m' = Yes, GO.\0A '\1B[1;33mn\1B[0;33m' = No, STOP!\1B[0m\00"
define i32 @More2() {
%1 = tail call i32 @GetKeyPrompt(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 @tolower(i32 %1)
%3 = freeze i8 %2
%4 = icmp eq i8 %3, 121
br i1 %4, label %24, label %5
5: ; preds = %0
switch i32 %1, label %6 [
i32 32, label %24
i32 10, label %24
]
6: ; preds = %5, %23
%7 = phi i32 [ %19, %23 ], [ %1, %5 ]
%8 = tail call signext i8 @tolower(i32 %7)
%9 = icmp eq i8 %8, 110
br i1 %9, label %24, label %10
10: ; preds = %6
%11 = tail call signext i8 @tolower(i32 %7)
%12 = icmp eq i8 %11, 113
br i1 %12, label %24, label %13
13: ; preds = %10
%14 = tail call signext i8 @tolower(i32 %7)
%15 = icmp eq i8 %14, 115
br i1 %15, label %24, label %16
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @GetKeyPrompt(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%20 = tail call signext i8 @tolower(i32 %19)
%21 = freeze i8 %20
%22 = icmp eq i8 %21, 121
br i1 %22, label %24, label %23
23: ; preds = %16
switch i32 %19, label %6 [
i32 32, label %24
i32 10, label %24
]
24: ; preds = %6, %10, %13, %16, %23, %23, %0, %5, %5
%25 = phi i32 [ 1, %5 ], [ 1, %5 ], [ 1, %0 ], [ 1, %23 ], [ 1, %23 ], [ 1, %16 ], [ 0, %13 ], [ 0, %10 ], [ 0, %6 ]
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret i32 %25
}