#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 getch();
int /*<<< orphan*/ insertLog(char *, char *);
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *);
int hudPrompt(char text[250]) {
  move(0, 0);
  printw(text);
  int input = getch();
  switch (input) {
  case 121:
    return 1;
    break;
  case 110:
    return 0;
    break;
  }
  insertLog(
      "WARNING: "
      "\"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/LauriM/Gunhack/refs/heads/master/src/hud.c\""
      ":"
      "30",
      "User failed to answer y/n. Returning n");
  return 0;
}


x86 assembly (clang, -O0):
<hudPrompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %esi,%esi
mov    %esi,-0x1c(%rbp)
mov    %esi,%edi
call   1060 <move@plt>
mov    -0x10(%rbp),%rdi
call   1040 <printw@plt>
mov    -0x1c(%rbp),%eax
call   1050 <getch@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x6e,%eax
je     119d <hudPrompt+0x5d>
jmp    1180 <hudPrompt+0x40>
mov    -0x18(%rbp),%eax
sub    $0x79,%eax
jne    11a9 <hudPrompt+0x69>
jmp    1191 <hudPrompt+0x51>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <hudPrompt+0x83>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <hudPrompt+0x83>
lea    0xe50(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <insertLog@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hudPrompt>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <move@plt>
mov    %rbx,%rdi
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x79,%eax
je     117d <hudPrompt+0x3d>
cmp    $0x6e,%eax
je     1179 <hudPrompt+0x39>
lea    0xe93(%rip),%rdi
lea    0xf1f(%rip),%rsi
call   1030 <insertLog@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [147 x i8] c"WARNING: \22/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LauriM/Gunhack/refs/heads/master/src/hud.c\22:30\00"
@.str.1 = [39 x i8] c"User failed to answer y/n. Returning n\00"
define i32 @hudPrompt(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = call i32 @move(i32 0, i32 0)
%6 = load i8*, i8** %3
%7 = call i32 @printw(i8* %6)
%8 = call i32 (...) @getch()
store i32 %8, i32* %4
%9 = load i32, i32* %4
switch i32 %9, label %12 [
i32 121, label %10
i32 110, label %11
]
10: ; preds = %1
store i32 1, i32* %2
br label %14
11: ; preds = %1
store i32 0, i32* %2
br label %14
12: ; preds = %1
%13 = call i32 @insertLog(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %14
14: ; preds = %12, %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [147 x i8] c"WARNING: \22/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LauriM/Gunhack/refs/heads/master/src/hud.c\22:30\00"
@.str.1 = [39 x i8] c"User failed to answer y/n. Returning n\00"
define i32 @hudPrompt(i8* %0) {
%2 = tail call i32 @move(i32 0, i32 0)
%3 = tail call i32 @printw(i8* %0)
%4 = tail call i32 (...) @getch()
switch i32 %4, label %6 [
i32 121, label %8
i32 110, label %5
]
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = tail call i32 @insertLog(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %1, %6, %5
%9 = phi i32 [ 0, %6 ], [ 0, %5 ], [ 1, %1 ]
ret i32 %9
}