#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int GetYesOrNo(void) {
  char a[1000];
  while (1) {
    printf("Would you like to play again? ");
    gets(a);
    if (strcmp(a, "yes") == 0) {
      return 1;
    } else if (strcmp(a, "no") == 0) {
      return 0;
    } else {
      printf("please answer yes or no.\n");
      continue;
    }
  }
}


x86 assembly (clang, -O0):
<GetYesOrNo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    -0x3f0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x3f0(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    117c <GetYesOrNo+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <GetYesOrNo+0x86>
lea    -0x3f0(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a5 <GetYesOrNo+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <GetYesOrNo+0x86>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
jmp    113b <GetYesOrNo+0xb>
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetYesOrNo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3e8,%rsp
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     11ed <GetYesOrNo+0xad>
lea    0xe9a(%rip),%r15
mov    %rsp,%rbp
lea    0xe93(%rip),%r12
lea    0xe66(%rip),%r13
lea    0xe7e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ea <GetYesOrNo+0xaa>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1060 <gets@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11b0 <GetYesOrNo+0x70>
jmp    11ed <GetYesOrNo+0xad>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Would you like to play again? \00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [26 x i8] c"please answer yes or no.\0A\00"
define i32 @GetYesOrNo() {
%1 = alloca i32
%2 = alloca [1000 x i8]
br label %3
3: ; preds = %0, %16
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 1, i32* %1
br label %18
11: ; preds = %3
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %1
br label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %3
18: ; preds = %15, %10
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [31 x i8] c"Would you like to play again? \00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@str = [25 x i8] c"please answer yes or no.\00"
define i32 @GetYesOrNo() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %10
%8 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @gets(i8* %2)
%14 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %10, %7, %0
%17 = phi i32 [ 1, %0 ], [ 0, %7 ], [ 1, %10 ]
ret i32 %17
}