#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*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char const *);
int hudMenu(const char *title, char **options, const char *prompt) {
  move(0, 0);
  printw(title);
  printw("\n");
  while (*options != NULL) {
    printw(*options);
    printw("\n");
    ++options;
  }
  printw("\n");
  printw(prompt);
  return getch();
}


x86 assembly (clang, -O0):
<hudMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1050 <move@plt>
mov    -0x8(%rbp),%rdi
call   1030 <printw@plt>
lea    0xea3(%rip),%rdi
call   1030 <printw@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1199 <hudMenu+0x69>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <printw@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printw@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1162 <hudMenu+0x32>
lea    0xe60(%rip),%rdi
call   1030 <printw@plt>
mov    -0x18(%rbp),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <getch@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hudMenu>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %edi,%edi
xor    %esi,%esi
call   1050 <move@plt>
mov    %r15,%rdi
call   1030 <printw@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printw@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1189 <hudMenu+0x59>
add    $0x8,%rbx
lea    0xe92(%rip),%r15
xchg   %ax,%ax
call   1030 <printw@plt>
mov    %r15,%rdi
call   1030 <printw@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <hudMenu+0x40>
lea    0xe70(%rip),%rdi
call   1030 <printw@plt>
mov    %r14,%rdi
call   1030 <printw@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <getch@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @hudMenu(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = call i32 @move(i32 0, i32 0)
%8 = load i8*, i8** %4
%9 = call i32 @printw(i8* %8)
%10 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %15, %3
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i32 @printw(i8* %17)
%19 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %5
br label %11
22: ; preds = %11
%23 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = load i8*, i8** %6
%25 = call i32 @printw(i8* %24)
%26 = call i32 (...) @getch()
ret i32 %26
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @hudMenu(i8* %0, i8** nocapture %1, i8* %2) {
%4 = tail call i32 @move(i32 0, i32 0)
%5 = tail call i32 @printw(i8* %0)
%6 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %1
%8 = icmp eq i8* %7, null
br i1 %8, label %17, label %9
9: ; preds = %3, %9
%10 = phi i8* [ %15, %9 ], [ %7, %3 ]
%11 = phi i8** [ %14, %9 ], [ %1, %3 ]
%12 = tail call i32 @printw(i8* %10)
%13 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %11, i64 1
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %9
17: ; preds = %9, %3
%18 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @printw(i8* %2)
%20 = tail call i32 (...) @getch()
ret i32 %20
}