#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ menuSelection(int *, char *, char **, int);
int /*<<< orphan*/ printf(char *);
void playAgain(void (*mode)(void)) {
  int menuChoice;
  char *playAgainOptions[] = {"1. Yes", "2. No"};
  menuSelection(&menuChoice, "DO YOU WANT TO PLAY AGAIN?", playAgainOptions, 2);
  if (menuChoice == 1)
    mode();
  else
    printf("   |                                                               "
           "         |\n"
           "   "
           "==================================================================="
           "=======\n\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<playAgain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2cbd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cba(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdx
lea    -0xc(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x2,%ecx
call   1040 <menuSelection@plt>
cmpl   $0x1,-0xc(%rbp)
jne    117d <playAgain+0x4d>
call   *-0x8(%rbp)
jmp    1189 <playAgain+0x59>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<playAgain>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movaps 0x2cc1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xec2(%rip),%rsi
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rdx
mov    $0x2,%ecx
call   1040 <menuSelection@plt>
cmpl   $0x1,0xc(%rsp)
jne    116a <playAgain+0x3a>
call   *%rbx
jmp    1176 <playAgain+0x46>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"1. Yes\00"
@.str.1 = [6 x i8] c"2. No\00"
@__const.playAgain.playAgainOptions = [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [27 x i8] c"DO YOU WANT TO PLAY AGAIN?\00"
@.str.3 = [158 x i8] c" | |\0A ==========================================================================\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define void @playAgain(void ()* %0) {
%2 = alloca void ()*
%3 = alloca i32
%4 = alloca [2 x i8*]
store void ()* %0, void ()** %2
%5 = bitcast [2 x i8*]* %4 to i8*
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%7 = call i32 @menuSelection(i32* %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8** %6, i32 2)
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load void ()*, void ()** %2
br label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* @EXIT_SUCCESS
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"1. Yes\00"
@.str.1 = [6 x i8] c"2. No\00"
@__const.playAgain.playAgainOptions = [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [27 x i8] c"DO YOU WANT TO PLAY AGAIN?\00"
@EXIT_SUCCESS = global i32 0
@str = [157 x i8] c" | |\0A ==========================================================================\0A\00"
define void @playAgain(void ()* nocapture %0) {
%2 = alloca i32
%3 = alloca [2 x i8*]
%4 = bitcast i32* %2 to i8*
%5 = bitcast [2 x i8*]* %3 to i8*
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%7 = call i32 @menuSelection(i32* %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8** %6, i32 2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %1
br label %13
11: ; preds = %1
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([157 x i8], [157 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %10
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
}