#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 cgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/);
int testnl() {
  char c;
  while ((c = cgetc(0)) != '\n')
    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
xor    %edi,%edi
call   1040 <cgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11d8 <testnl+0xb8>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1158 <testnl+0x38>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    11b3 <testnl+0x93>
movsbl -0x5(%rbp),%eax
cmp    $0x2e,%eax
je     11b3 <testnl+0x93>
movsbl -0x5(%rbp),%eax
cmp    $0x21,%eax
je     11b3 <testnl+0x93>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     118c <testnl+0x6c>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    11b3 <testnl+0x93>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11a6 <testnl+0x86>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    11b3 <testnl+0x93>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    11d3 <testnl+0xb3>
mov    -0x5(%rbp),%al
mov    0x2e2b(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <ungetc@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <testnl+0xd3>
jmp    1128 <testnl+0x8>
mov    -0x5(%rbp),%al
mov    0x2e06(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <ungetc@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testnl>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1040 <cgetc@plt>
cmp    $0xa,%al
je     1176 <testnl+0x56>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     115f <testnl+0x3f>
cmp    $0x21,%al
je     115f <testnl+0x3f>
cmp    $0x2e,%al
je     115f <testnl+0x3f>
lea    -0x41(%rax),%ecx
cmp    $0x1a,%cl
jb     115f <testnl+0x3f>
cmp    $0x2d,%al
je     115f <testnl+0x3f>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
jae    1130 <testnl+0x10>
xor    %ebx,%ebx
mov    0x2e80(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <ungetc@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0x1,%ebx
mov    $0xa,%al
jmp    1161 <testnl+0x41>

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

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