#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 EOF;
int getchar();
int /*<<< orphan*/ isspace(int);
int rpmatch(char *);
int yesno(void) {
  char buf[128];
  int len = 0;
  int c;
  while ((c = getchar()) != EOF && c != '\n')
    if ((len > 0 && len < 127) || (len == 0 && !isspace(c)))
      buf[len++] = c;
  buf[len] = '\0';
  return rpmatch(buf) == 1;
}


x86 assembly (clang, -O0):
<yesno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x84(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x88(%rbp)
xor    %eax,%eax
mov    0x2e8b(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x89(%rbp)
je     117b <yesno+0x4b>
cmpl   $0xa,-0x88(%rbp)
setne  %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
test   $0x1,%al
jne    118e <yesno+0x5e>
jmp    11ed <yesno+0xbd>
cmpl   $0x0,-0x84(%rbp)
jle    11a8 <yesno+0x78>
cmpl   $0x7f,-0x84(%rbp)
jl     11c9 <yesno+0x99>
cmpl   $0x0,-0x84(%rbp)
jne    11e8 <yesno+0xb8>
mov    -0x88(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    11e8 <yesno+0xb8>
mov    -0x88(%rbp),%eax
mov    %al,%cl
mov    -0x84(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x84(%rbp)
cltq
mov    %cl,-0x80(%rbp,%rax,1)
jmp    1145 <yesno+0x15>
movslq -0x84(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
call   1050 <rpmatch@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yesno>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     11af <yesno+0x7f>
mov    %eax,%ebx
mov    0x2e93(%rip),%r14
cmp    (%r14),%eax
je     11af <yesno+0x7f>
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    -0x1(%rbp),%eax
cmp    $0x7e,%eax
jae    1180 <yesno+0x50>
mov    %ebp,%eax
add    $0x1,%ebp
mov    %bl,(%rsp,%rax,1)
jmp    1184 <yesno+0x54>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %ebp,%ebp
je     119f <yesno+0x6f>
mov    %ebp,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     11af <yesno+0x7f>
mov    %eax,%ebx
mov    %r15d,%ebp
cmp    (%r14),%eax
jne    1160 <yesno+0x30>
jmp    11af <yesno+0x7f>
mov    %ebx,%edi
call   1030 <isspace@plt>
xor    %r15d,%r15d
test   %eax,%eax
jne    1187 <yesno+0x57>
jmp    1168 <yesno+0x38>
movslq %r15d,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1050 <rpmatch@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @yesno() {
%1 = alloca [128 x i8]
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
br label %4
4: ; preds = %33, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 10
br label %11
11: ; preds = %8, %4
%12 = phi i1 [ false, %4 ], [ %10, %8 ]
br i1 %12, label %13, label %34
13: ; preds = %11
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 127
br i1 %18, label %26, label %19
19: ; preds = %16, %13
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %3
%24 = call i32 @isspace(i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %22, %16
%27 = load i32, i32* %3
%28 = trunc i32 %27 to i8
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %31
store i8 %28, i8* %32
br label %33
33: ; preds = %26, %22, %19
br label %4
34: ; preds = %11
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %36
store i8 0, i8* %37
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%39 = call i32 @rpmatch(i8* %38)
%40 = icmp eq i32 %39, 1
%41 = zext i1 %40 to i32
ret i32 %41
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @yesno() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %8, label %30
8: ; preds = %0, %23
%9 = phi i32 [ %25, %23 ], [ %3, %0 ]
%10 = phi i32 [ %24, %23 ], [ 0, %0 ]
%11 = add i32 %10, -1
%12 = icmp ult i32 %11, 126
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = icmp eq i32 %10, 0
br i1 %14, label %15, label %23
15: ; preds = %13
%16 = tail call i32 @isspace(i32 %9)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %8, %15
%19 = trunc i32 %9 to i8
%20 = add nuw nsw i32 %10, 1
%21 = zext i32 %10 to i64
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %21
store i8 %19, i8* %22
br label %23
23: ; preds = %18, %15, %13
%24 = phi i32 [ %20, %18 ], [ 0, %15 ], [ %10, %13 ]
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp ne i32 %25, %26
%28 = icmp ne i32 %25, 10
%29 = and i1 %28, %27
br i1 %29, label %8, label %30
30: ; preds = %23, %0
%31 = phi i32 [ 0, %0 ], [ %24, %23 ]
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %32
store i8 0, i8* %33
%34 = call i32 @rpmatch(i8* %2)
%35 = icmp eq i32 %34, 1
%36 = zext i1 %35 to i32
ret i32 %36
}