#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
extern int see_more(FILE *fp_tty) {
  int c;
  printf("\033[7m more? \33[m");
  while ((c = getc(fp_tty)) != EOF) {
    switch (c) {
    case 'q':
      return 0;
    case '\n':
      return 1;
    case ' ':
      return 24;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<see_more>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%eax
je     11b2 <see_more+0x92>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xa,%eax
je     1195 <see_more+0x75>
jmp    1167 <see_more+0x47>
mov    -0x18(%rbp),%eax
sub    $0x20,%eax
je     11a1 <see_more+0x81>
jmp    1178 <see_more+0x58>
mov    -0x18(%rbp),%eax
sub    $0x71,%eax
jne    11ad <see_more+0x8d>
jmp    1189 <see_more+0x69>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <see_more+0x99>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <see_more+0x99>
movl   $0x18,-0x4(%rbp)
jmp    11b9 <see_more+0x99>
jmp    1138 <see_more+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<see_more>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eae(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    (%r14),%ecx
je     116c <see_more+0x4c>
cmp    $0x71,%ecx
je     116c <see_more+0x4c>
cmp    $0x20,%ecx
je     1167 <see_more+0x47>
cmp    $0xa,%ecx
jne    1140 <see_more+0x20>
mov    $0x1,%eax
jmp    116c <see_more+0x4c>
mov    $0x18,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\1B[7m more? \1B[m\00"
@EOF = global i32 0
define i32 @see_more(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %16, %1
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load i32, i32* %4
switch i32 %12, label %16 [
i32 113, label %13
i32 10, label %14
i32 32, label %15
]
13: ; preds = %11
store i32 0, i32* %2
br label %18
14: ; preds = %11
store i32 1, i32* %2
br label %18
15: ; preds = %11
store i32 24, i32* %2
br label %18
16: ; preds = %11
br label %6
17: ; preds = %6
store i32 0, i32* %2
br label %18
18: ; preds = %17, %15, %14, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [15 x i8] c"\1B[7m more? \1B[m\00"
@EOF = global i32 0
define i32 @see_more(i32* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %7, %1
%4 = tail call i32 @getc(i32* %0)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %8, label %7
7: ; preds = %3
switch i32 %4, label %3 [
i32 113, label %8
i32 10, label %9
i32 32, label %10
]
8: ; preds = %7, %3
br label %10
9: ; preds = %7
br label %10
10: ; preds = %7, %9, %8
%11 = phi i32 [ 0, %8 ], [ 1, %9 ], [ 24, %7 ]
ret i32 %11
}