#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int see_more(FILE *cmd) {
  int c;
  printf("more?");
  while ((c = fgetc(cmd)) != EOF) {
    if (c == 'q')
      return 0;
    if (c == ' ')
      return 24;
    if (c == '\n')
      return 1;
  }
  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 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%eax
je     119a <see_more+0x7a>
cmpl   $0x71,-0x14(%rbp)
jne    1169 <see_more+0x49>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <see_more+0x81>
cmpl   $0x20,-0x14(%rbp)
jne    117f <see_more+0x5f>
movl   $0x18,-0x4(%rbp)
jmp    11a1 <see_more+0x81>
cmpl   $0xa,-0x14(%rbp)
jne    1195 <see_more+0x75>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <see_more+0x81>
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 <fgetc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    (%r14),%ecx
je     116c <see_more+0x4c>
cmp    $0xa,%ecx
je     1167 <see_more+0x47>
cmp    $0x71,%ecx
je     116c <see_more+0x4c>
cmp    $0x20,%ecx
jne    1140 <see_more+0x20>
mov    $0x18,%eax
jmp    116c <see_more+0x4c>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"more?\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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %23, %1
%7 = load i32*, i32** %3
%8 = call i32 @fgetc(i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %6
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 113
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %2
br label %25
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 32
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 24, i32* %2
br label %25
19: ; preds = %15
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 1, i32* %2
br label %25
23: ; preds = %19
br label %6
24: ; preds = %6
store i32 0, i32* %2
br label %25
25: ; preds = %24, %22, %18, %14
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [6 x i8] c"more?\00"
@EOF = global i32 0
define i32 @see_more(i32* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %7, %1
%4 = tail call i32 @fgetc(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 32, label %9
i32 10, 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 ], [ 24, %9 ], [ 1, %7 ]
ret i32 %11
}