#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ removeEndLine(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int askContinue(void) {
  printf("Do you want to load next level? [y/n] ");
  char buffer[10];
  if (fgets(buffer, 10, stdin) == NULL) {
    perror("Fgets error\n");
    exit(EXIT_FAILURE);
  }
  removeEndLine(buffer);
  if (strcmp(buffer, "y") == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<askContinue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    11af <askContinue+0x4f>
lea    0xe8b(%rip),%rdi
call   1070 <perror@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    -0xe(%rbp),%rdi
call   1030 <removeEndLine@plt>
lea    -0xe(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11de <askContinue+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <askContinue+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<askContinue>:
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
lea    0x6(%rsp),%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11ba <askContinue+0x5a>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <removeEndLine@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe66(%rip),%rdi
call   1070 <perror@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Do you want to load next level? [y/n] \00"
@stdin = global i32 0
@.str.1 = [13 x i8] c"Fgets error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"y\00"
define i32 @askContinue() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %4, i32 10, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%14 = call i32 @removeEndLine(i8* %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %1
br label %20
19: ; preds = %12
store i32 0, i32* %1
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [39 x i8] c"Do you want to load next level? [y/n] \00"
@stdin = global i32 0
@.str.1 = [13 x i8] c"Fgets error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"y\00"
define i32 @askContinue() {
%1 = alloca [10 x i8]
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32* @fgets(i8* %3, i32 10, i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = call i32 @removeEndLine(i8* %3)
%13 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
ret i32 %15
}