#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int toupper(char);
bool play_option() {
  char ch;
  bool option = false;
  do {
    printf("play again (y/n): ");
    scanf(" %c", &ch);
    switch (toupper(ch)) {
    case 'Y':
    case 'y': {
      option = true;
      break;
    }
    case 'N':
    case 'n': {
      option = false;
      break;
    }
    default: {
      break;
    }
    }
  } while (option);
}


x86 assembly (clang, -O0):
<play_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
sub    $0x4e,%eax
je     11b6 <play_option+0x86>
jmp    1177 <play_option+0x47>
mov    -0x10(%rbp),%eax
sub    $0x59,%eax
je     11aa <play_option+0x7a>
jmp    1188 <play_option+0x58>
mov    -0x10(%rbp),%eax
sub    $0x6e,%eax
je     11b6 <play_option+0x86>
jmp    1199 <play_option+0x69>
mov    -0x10(%rbp),%eax
sub    $0x79,%eax
jne    11c2 <play_option+0x92>
jmp    11aa <play_option+0x7a>
movl   $0x1,-0xc(%rbp)
jmp    11c7 <play_option+0x97>
movl   $0x0,-0xc(%rbp)
jmp    11c7 <play_option+0x97>
jmp    11c7 <play_option+0x97>
jmp    11cc <play_option+0x9c>
cmpl   $0x0,-0xc(%rbp)
jne    113f <play_option+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<play_option>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
lea    0xec0(%rip),%r14
lea    0xecc(%rip),%r15
lea    0x7(%rsp),%rbx
jmp    1163 <play_option+0x33>
xchg   %ax,%ax
cmp    $0x79,%eax
jne    1191 <play_option+0x61>
mov    $0x1,%ebp
test   %ebp,%ebp
mov    $0x1,%ebp
je     1196 <play_option+0x66>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%edi
call   1030 <toupper@plt>
cmp    $0x6d,%eax
jg     1150 <play_option+0x20>
cmp    $0x59,%eax
je     1155 <play_option+0x25>
cmp    $0x4e,%eax
jne    115a <play_option+0x2a>
jmp    1196 <play_option+0x66>
cmp    $0x6e,%eax
jne    115a <play_option+0x2a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"play again (y/n): \00"
@.str.1 = [4 x i8] c" %c\00"
define i32 @play_option() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %3
br label %4
4: ; preds = %13, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = call i32 @toupper(i8 signext %7)
switch i32 %8, label %11 [
i32 89, label %9
i32 121, label %9
i32 78, label %10
i32 110, label %10
]
9: ; preds = %4, %4
store i32 1, i32* %3
br label %12
10: ; preds = %4, %4
store i32 0, i32* %3
br label %12
11: ; preds = %4
br label %12
12: ; preds = %11, %10, %9
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %4, label %16
16: ; preds = %13
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [19 x i8] c"play again (y/n): \00"
@.str.1 = [4 x i8] c" %c\00"
define i32 @play_option() {
%1 = alloca i8
br label %2
2: ; preds = %9, %0
%3 = phi i32 [ 0, %0 ], [ 1, %9 ]
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = call i32 @toupper(i8 signext %6)
switch i32 %7, label %9 [
i32 89, label %8
i32 121, label %8
i32 78, label %12
i32 110, label %12
]
8: ; preds = %2, %2
br label %9
9: ; preds = %8, %2
%10 = phi i32 [ %3, %2 ], [ 1, %8 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %2
12: ; preds = %2, %2, %9
ret i32 undef
}