#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 */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ stdin;
bool restart(void) {
  char c, buff[5];
  do {
    printf("\nDo you want to play again? [Y\\n] ");
    if (fgets(buff, sizeof(buff), stdin) != NULL) {
      sscanf(buff, "%c", &c);
      switch (c) {
      case 'y':
      case 'Y':
        return true;
      case 'n':
      case 'N':
        return false;
      }
    }
  } while (1);
}


x86 assembly (clang, -O0):
<restart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11de <restart+0xae>
lea    0xeb7(%rip),%rsi
lea    -0xa(%rbp),%rdi
lea    -0x5(%rbp),%rdx
call   1050 <sscanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x4e,%eax
je     11cd <restart+0x9d>
jmp    118e <restart+0x5e>
mov    -0x10(%rbp),%eax
sub    $0x59,%eax
je     11c1 <restart+0x91>
jmp    119f <restart+0x6f>
mov    -0x10(%rbp),%eax
sub    $0x6e,%eax
je     11cd <restart+0x9d>
jmp    11b0 <restart+0x80>
mov    -0x10(%rbp),%eax
sub    $0x79,%eax
jne    11d9 <restart+0xa9>
jmp    11c1 <restart+0x91>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <restart+0xc2>
movl   $0x0,-0x4(%rbp)
jmp    11f2 <restart+0xc2>
jmp    11de <restart+0xae>
jmp    11e3 <restart+0xb3>
mov    $0x1,%al
test   $0x1,%al
jne    1138 <restart+0x8>
jmp    11f2 <restart+0xc2>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restart>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%r14
mov    0x2e9d(%rip),%r13
lea    0xb(%rsp),%rbx
lea    0xecc(%rip),%r15
lea    0xa(%rsp),%r12
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     1160 <restart+0x30>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <sscanf@plt>
movsbl 0xa(%rsp),%eax
cmp    $0x6d,%eax
jg     11b0 <restart+0x80>
cmp    $0x4e,%eax
je     11c1 <restart+0x91>
cmp    $0x59,%eax
jne    1160 <restart+0x30>
jmp    11ba <restart+0x8a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x6e,%eax
je     11c1 <restart+0x91>
cmp    $0x79,%eax
jne    1160 <restart+0x30>
mov    $0x1,%eax
jmp    11c3 <restart+0x93>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"\0ADo you want to play again? [Y\\n] \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @restart() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [5 x i8]
br label %4
4: ; preds = %19, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %6, i32 5, i32 %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %18
10: ; preds = %4
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
switch i32 %14, label %17 [
i32 121, label %15
i32 89, label %15
i32 110, label %16
i32 78, label %16
]
15: ; preds = %10, %10
store i32 1, i32* %1
br label %20
16: ; preds = %10, %10
store i32 0, i32* %1
br label %20
17: ; preds = %10
br label %18
18: ; preds = %17, %4
br label %19
19: ; preds = %18
br i1 true, label %4, label %20
20: ; preds = %15, %16, %19
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [35 x i8] c"\0ADo you want to play again? [Y\\n] \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @restart() {
%1 = alloca i8
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %9, %0
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %3, i32 5, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %4, %10
br label %4
10: ; preds = %4
%11 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
switch i32 %13, label %9 [
i32 121, label %14
i32 89, label %14
i32 110, label %15
i32 78, label %15
]
14: ; preds = %10, %10
br label %15
15: ; preds = %10, %10, %14
%16 = phi i32 [ 1, %14 ], [ 0, %10 ], [ 0, %10 ]
ret i32 %16
}