#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 */
char getchar();
int /*<<< orphan*/ isalpha(char);
int /*<<< orphan*/ printf(char *);
int playagain(void) {
  char input;
  printf("\nThat was fun. Would you like to play again? (y\\n) ");
  do
    input = getchar();
  while (!isalpha(input));
  getchar();
  if (input == 'y' || input == 'Y')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<playagain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1144 <playagain+0x14>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
je     1188 <playagain+0x58>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
jne    1194 <playagain+0x64>
movl   $0x1,-0x4(%rbp)
jmp    119b <playagain+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<playagain>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %eax,%eax
je     1140 <playagain+0x10>
xor    %eax,%eax
call   1040 <getchar@plt>
and    $0xdf,%bl
xor    %eax,%eax
cmp    $0x59,%bl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0AThat was fun. Would you like to play again? (y\\n) \00"
define i32 @playagain() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %6, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
br label %6
6: ; preds = %4
%7 = load i8, i8* %2
%8 = call i32 @isalpha(i8 signext %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %4, label %11
11: ; preds = %6
%12 = call signext i8 (...) @getchar()
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 121
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 89
br i1 %19, label %20, label %21
20: ; preds = %16, %11
store i32 1, i32* %1
br label %22
21: ; preds = %16
store i32 0, i32* %1
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [52 x i8] c"\0AThat was fun. Would you like to play again? (y\\n) \00"
define i32 @playagain() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call signext i8 (...) @getchar()
%4 = tail call i32 @isalpha(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call signext i8 (...) @getchar()
%8 = and i8 %3, -33
%9 = icmp eq i8 %8, 89
%10 = zext i1 %9 to i32
ret i32 %10
}