#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 */
char bdos(int, int);
int /*<<< orphan*/ flush();
int /*<<< orphan*/ printf(char *);
int domore() {
  char c;
  printf("[more]");
  flush();
  while (!(c = bdos(6, 0xff)))
    ;
  printf("\b\b\b\b\b\b      \b\b\b\b\b\b");
  if (c == 3 || c == 11)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<domore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <flush@plt>
mov    $0x6,%edi
mov    $0xff,%esi
call   1050 <bdos@plt>
mov    %al,-0x5(%rbp)
cmp    $0x0,%al
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1171 <domore+0x41>
jmp    1176 <domore+0x46>
jmp    114b <domore+0x1b>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x3,%eax
je     119c <domore+0x6c>
movsbl -0x5(%rbp),%eax
cmp    $0xb,%eax
jne    11a8 <domore+0x78>
movl   $0x1,-0x4(%rbp)
jmp    11af <domore+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<domore>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <flush@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x6,%edi
mov    $0xff,%esi
call   1050 <bdos@plt>
test   %al,%al
je     1150 <domore+0x20>
mov    %eax,%ebx
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
and    $0xf7,%bl
xor    %eax,%eax
cmp    $0x3,%bl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"[more]\00"
@.str.1 = [19 x i8] c"\08\08\08\08\08\08 \08\08\08\08\08\08\00"
define i32 @domore() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @flush()
br label %5
5: ; preds = %9, %0
%6 = call signext i8 @bdos(i32 6, i32 255)
store i8 %6, i8* %2
%7 = icmp ne i8 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 3
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 11
br i1 %18, label %19, label %20
19: ; preds = %15, %10
store i32 1, i32* %1
br label %21
20: ; preds = %15
store i32 0, i32* %1
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [7 x i8] c"[more]\00"
@.str.1 = [19 x i8] c"\08\08\08\08\08\08 \08\08\08\08\08\08\00"
define i32 @domore() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @flush()
br label %3
3: ; preds = %3, %0
%4 = tail call signext i8 @bdos(i32 6, i32 255)
%5 = icmp eq i8 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = and i8 %4, -9
%9 = icmp eq i8 %8, 3
%10 = zext i1 %9 to i32
ret i32 %10
}