#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 /*<<< orphan*/ exit(int);
int getchar();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int testnl(void) {
  int c;
  while ((c = getchar()) != '\n') {
    if (c == EOF) {
      exit(1);
    }
    if ((c >= '0' && c <= '9') || c == '.' || c == '!' ||
        (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '-') {
      ungetc(c, stdin);
      return (0);
    }
  }
  ungetc(c, stdin);
  return (1);
}


x86 assembly (clang, -O0):
<testnl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     11e3 <testnl+0xb3>
mov    -0x8(%rbp),%eax
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%eax
jne    1167 <testnl+0x37>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x30,-0x8(%rbp)
jl     117b <testnl+0x4b>
cmpl   $0x39,-0x8(%rbp)
jle    11c1 <testnl+0x91>
cmpl   $0x2e,-0x8(%rbp)
je     11c1 <testnl+0x91>
cmpl   $0x21,-0x8(%rbp)
je     11c1 <testnl+0x91>
cmpl   $0x41,-0x8(%rbp)
jl     11a3 <testnl+0x73>
cmpl   $0x5a,-0x8(%rbp)
jle    11c1 <testnl+0x91>
cmpl   $0x61,-0x8(%rbp)
jl     11b7 <testnl+0x87>
cmpl   $0x7a,-0x8(%rbp)
jle    11c1 <testnl+0x91>
cmpl   $0x2d,-0x8(%rbp)
jne    11de <testnl+0xae>
mov    -0x8(%rbp),%edi
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fb <testnl+0xcb>
jmp    1138 <testnl+0x8>
mov    -0x8(%rbp),%edi
mov    0x2dfb(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testnl>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     117c <testnl+0x4c>
cmp    (%r14),%eax
je     11a0 <testnl+0x70>
lea    -0x30(%rax),%ecx
cmp    $0xa,%ecx
jb     1186 <testnl+0x56>
cmp    $0x21,%eax
je     1186 <testnl+0x56>
cmp    $0x2e,%eax
je     1186 <testnl+0x56>
lea    -0x41(%rax),%ecx
cmp    $0x1a,%ecx
jb     1186 <testnl+0x56>
cmp    $0x2d,%eax
je     1186 <testnl+0x56>
mov    %eax,%ecx
add    $0xffffff9f,%ecx
cmp    $0x19,%ecx
ja     1140 <testnl+0x10>
jmp    1186 <testnl+0x56>
mov    $0x1,%ebx
mov    $0xa,%eax
mov    0x2e5b(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <ungetc@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
define i32 @testnl() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %43, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %44
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %6
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 48
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 57
br i1 %17, label %39, label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 46
br i1 %20, label %39, label %21
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 33
br i1 %23, label %39, label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 65
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 90
br i1 %29, label %39, label %30
30: ; preds = %27, %24
%31 = load i32, i32* %2
%32 = icmp sge i32 %31, 97
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = icmp sle i32 %34, 122
br i1 %35, label %39, label %36
36: ; preds = %33, %30
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 45
br i1 %38, label %39, label %43
39: ; preds = %36, %33, %27, %21, %18, %15
%40 = load i32, i32* %2
%41 = load i32, i32* @stdin
%42 = call i32 @ungetc(i32 %40, i32 %41)
store i32 0, i32* %1
br label %48
43: ; preds = %36
br label %3
44: ; preds = %3
%45 = load i32, i32* %2
%46 = load i32, i32* @stdin
%47 = call i32 @ungetc(i32 %45, i32 %46)
store i32 1, i32* %1
br label %48
48: ; preds = %44, %39
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
define i32 @testnl() {
br label %1
1: ; preds = %16, %0
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 10
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %2, %5
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %4
%10 = add i32 %2, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %21, label %12
12: ; preds = %9
switch i32 %2, label %13 [
i32 46, label %21
i32 33, label %21
]
13: ; preds = %12
%14 = add i32 %2, -65
%15 = icmp ult i32 %14, 26
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = add i32 %2, -97
%18 = icmp ult i32 %17, 26
%19 = icmp eq i32 %2, 45
%20 = or i1 %19, %18
br i1 %20, label %21, label %1
21: ; preds = %1, %13, %16, %9, %12, %12
%22 = phi i32 [ %2, %12 ], [ %2, %12 ], [ %2, %9 ], [ %2, %16 ], [ %2, %13 ], [ 10, %1 ]
%23 = phi i32 [ 0, %12 ], [ 0, %12 ], [ 0, %9 ], [ 0, %16 ], [ 0, %13 ], [ 1, %1 ]
%24 = load i32, i32* @stdin
%25 = tail call i32 @ungetc(i32 %22, i32 %24)
ret i32 %23
}