#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*/ clear();
int /*<<< orphan*/ filter_results();
char getch();
int /*<<< orphan*/ init_curses();
int /*<<< orphan*/ keyword_prompt();
int /*<<< orphan*/ refresh_listing();
int /*<<< orphan*/ shutdown_curses();
void _pager(bool start_with_prompt) {
  init_curses();
  for (;;) {
    clear();
    if (start_with_prompt) {
      start_with_prompt = false;
      keyword_prompt();
      filter_results();
      continue;
    }
    refresh_listing();
    if (getch() == '/') {
      keyword_prompt();
      filter_results();
      continue;
    }
    break;
  }
  shutdown_curses();
}


x86 assembly (clang, -O0):
<_pager>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <init_curses@plt>
mov    $0x0,%al
call   1090 <clear@plt>
cmpl   $0x0,-0x4(%rbp)
je     11ad <_pager+0x3d>
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <keyword_prompt@plt>
mov    $0x0,%al
call   1060 <filter_results@plt>
jmp    1182 <_pager+0x12>
mov    $0x0,%al
call   1040 <refresh_listing@plt>
mov    $0x0,%al
call   1080 <getch@plt>
movsbl %al,%eax
cmp    $0x2f,%eax
jne    11da <_pager+0x6a>
mov    $0x0,%al
call   1070 <keyword_prompt@plt>
mov    $0x0,%al
call   1060 <filter_results@plt>
jmp    1182 <_pager+0x12>
jmp    11df <_pager+0x6f>
mov    $0x0,%al
call   1050 <shutdown_curses@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pager>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <init_curses@plt>
xor    %eax,%eax
call   1090 <clear@plt>
test   %ebx,%ebx
je     119a <_pager+0x2a>
xor    %eax,%eax
call   1070 <keyword_prompt@plt>
xor    %eax,%eax
call   1060 <filter_results@plt>
xor    %eax,%eax
call   1090 <clear@plt>
xor    %eax,%eax
call   1040 <refresh_listing@plt>
xor    %eax,%eax
call   1080 <getch@plt>
cmp    $0x2f,%al
je     1185 <_pager+0x15>
xor    %eax,%eax
pop    %rbx
jmp    1050 <shutdown_curses@plt>

LLVM IR (-O0):
define void @_pager(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @init_curses()
br label %4
4: ; preds = %16, %8, %1
%5 = call i32 (...) @clear()
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
store i32 0, i32* %2
%9 = call i32 (...) @keyword_prompt()
%10 = call i32 (...) @filter_results()
br label %4
11: ; preds = %4
%12 = call i32 (...) @refresh_listing()
%13 = call signext i8 (...) @getch()
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = call i32 (...) @keyword_prompt()
%18 = call i32 (...) @filter_results()
br label %4
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = call i32 (...) @shutdown_curses()
ret void
}

LLVM IR (-O2):
define void @_pager(i32 %0) {
%2 = tail call i32 (...) @init_curses()
%3 = icmp eq i32 %0, 0
%4 = tail call i32 (...) @clear()
br i1 %3, label %9, label %5
5: ; preds = %1
%6 = tail call i32 (...) @keyword_prompt()
%7 = tail call i32 (...) @filter_results()
%8 = tail call i32 (...) @clear()
br label %9
9: ; preds = %1, %5
%10 = tail call i32 (...) @refresh_listing()
%11 = tail call signext i8 (...) @getch()
%12 = icmp eq i8 %11, 47
br i1 %12, label %13, label %20
13: ; preds = %9, %13
%14 = tail call i32 (...) @keyword_prompt()
%15 = tail call i32 (...) @filter_results()
%16 = tail call i32 (...) @clear()
%17 = tail call i32 (...) @refresh_listing()
%18 = tail call signext i8 (...) @getch()
%19 = icmp eq i8 %18, 47
br i1 %19, label %13, label %20
20: ; preds = %13, %9
%21 = tail call i32 (...) @shutdown_curses()
ret void
}