#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 getc(int /*<<< orphan*/ *);
scalar_t__ isalnum(int);
int /*<<< orphan*/ isascii(int);
scalar_t__ isblank(int);
int /*<<< orphan*/ printf(char *, ...);
int tg_nonalnum_get_char(FILE *fp, void *dump) {
  int c;
  while (1) {
    c = getc(fp);
    if (c == EOF)
      break;
    else if (c == '\r') {
      c = '\n';
      break;
    } else if (c == '\n')
      break;
    else if (!isascii(c))
      continue;
    else if (c == '1' || c == '0')
      break;
    else if (isalnum(c))
      continue;
    else if (isblank(c))
      continue;
    break;
  }
  if (*(int *)dump) {
    if (c != EOF)
      printf("%c\n", c);
    else
      printf("EOF\n");
  }
  return c;
}


x86 assembly (clang, -O0):
<tg_nonalnum_get_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
jne    1183 <tg_nonalnum_get_char+0x33>
jmp    1228 <tg_nonalnum_get_char+0xd8>
cmpl   $0xd,-0x14(%rbp)
jne    1199 <tg_nonalnum_get_char+0x49>
movl   $0xa,-0x14(%rbp)
jmp    1228 <tg_nonalnum_get_char+0xd8>
cmpl   $0xa,-0x14(%rbp)
jne    11a8 <tg_nonalnum_get_char+0x58>
jmp    1228 <tg_nonalnum_get_char+0xd8>
mov    -0x14(%rbp),%edi
call   1060 <isascii@plt>
cmp    $0x0,%eax
jne    11be <tg_nonalnum_get_char+0x6e>
jmp    1160 <tg_nonalnum_get_char+0x10>
cmpl   $0x31,-0x14(%rbp)
je     11d2 <tg_nonalnum_get_char+0x82>
cmpl   $0x30,-0x14(%rbp)
jne    11d7 <tg_nonalnum_get_char+0x87>
jmp    1228 <tg_nonalnum_get_char+0xd8>
mov    -0x14(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     11ee <tg_nonalnum_get_char+0x9e>
jmp    1160 <tg_nonalnum_get_char+0x10>
mov    -0x14(%rbp),%edi
call   1050 <isblank@plt>
cmp    $0x0,%rax
je     1205 <tg_nonalnum_get_char+0xb5>
jmp    1160 <tg_nonalnum_get_char+0x10>
jmp    120a <tg_nonalnum_get_char+0xba>
jmp    120f <tg_nonalnum_get_char+0xbf>
jmp    1214 <tg_nonalnum_get_char+0xc4>
jmp    1219 <tg_nonalnum_get_char+0xc9>
jmp    121e <tg_nonalnum_get_char+0xce>
jmp    1223 <tg_nonalnum_get_char+0xd3>
jmp    1228 <tg_nonalnum_get_char+0xd8>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1270 <tg_nonalnum_get_char+0x120>
mov    -0x14(%rbp),%eax
mov    0x2da9(%rip),%rcx
cmp    (%rcx),%eax
je     125d <tg_nonalnum_get_char+0x10d>
mov    -0x14(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126b <tg_nonalnum_get_char+0x11b>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1270 <tg_nonalnum_get_char+0x120>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tg_nonalnum_get_char>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1070 <getc@plt>
mov    %eax,%ebp
mov    0x2e7c(%rip),%r12
cmp    (%r12),%eax
jne    11a2 <tg_nonalnum_get_char+0x52>
mov    %ebp,%ebx
cmpl   $0x0,(%r14)
je     11ef <tg_nonalnum_get_char+0x9f>
cmp    (%r12),%ebx
jne    11df <tg_nonalnum_get_char+0x8f>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
jmp    11ef <tg_nonalnum_get_char+0x9f>
xchg   %ax,%ax
mov    %r15,%rdi
call   1070 <getc@plt>
mov    %eax,%ebp
mov    %eax,%ebx
cmp    (%r12),%eax
je     1174 <tg_nonalnum_get_char+0x24>
mov    $0xa,%ebx
cmp    $0xa,%ebp
je     1174 <tg_nonalnum_get_char+0x24>
cmp    $0xd,%ebp
je     1174 <tg_nonalnum_get_char+0x24>
cmp    $0x80,%ebp
jae    1190 <tg_nonalnum_get_char+0x40>
mov    %ebp,%eax
and    $0xfffffffe,%eax
cmp    $0x30,%eax
je     1172 <tg_nonalnum_get_char+0x22>
mov    %ebp,%edi
call   1050 <isalnum@plt>
test   %rax,%rax
jne    1190 <tg_nonalnum_get_char+0x40>
mov    %ebp,%edi
call   1060 <isblank@plt>
mov    %ebp,%ebx
test   %rax,%rax
jne    1190 <tg_nonalnum_get_char+0x40>
jmp    1174 <tg_nonalnum_get_char+0x24>
lea    0xe1a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [5 x i8] c"EOF\0A\00"
define i32 @tg_nonalnum_get_char(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %2, %25, %37, %42
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %6
br label %50
13: ; preds = %6
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 13
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 10, i32* %5
br label %50
17: ; preds = %13
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %21
20: ; preds = %17
br label %50
21: ; preds = %17
%22 = load i32, i32* %5
%23 = call i32 @isascii(i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
br label %6
26: ; preds = %21
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 49
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 48
br i1 %31, label %32, label %33
32: ; preds = %29, %26
br label %50
33: ; preds = %29
%34 = load i32, i32* %5
%35 = call i64 @isalnum(i32 %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
br label %6
38: ; preds = %33
%39 = load i32, i32* %5
%40 = call i64 @isblank(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
br label %6
43: ; preds = %38
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49, %32, %20, %16, %12
%51 = load i8*, i8** %4
%52 = bitcast i8* %51 to i32*
%53 = load i32, i32* %52
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %65
55: ; preds = %50
%56 = load i32, i32* %5
%57 = load i32, i32* @EOF
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i32, i32* %5
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
br label %64
62: ; preds = %55
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %64
64: ; preds = %62, %59
br label %65
65: ; preds = %64, %50
%66 = load i32, i32* %5
ret i32 %66
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%c\0A\00"
@str = [4 x i8] c"EOF\00"
define i32 @tg_nonalnum_get_char(i32* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %23, label %6
6: ; preds = %2, %10
%7 = phi i32 [ %11, %10 ], [ %3, %2 ]
switch i32 %7, label %8 [
i32 13, label %23
i32 10, label %23
]
8: ; preds = %6
%9 = icmp ult i32 %7, 128
br i1 %9, label %14, label %10
10: ; preds = %8, %17, %20
%11 = tail call i32 @getc(i32* %0)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %23, label %6
14: ; preds = %8
%15 = and i32 %7, -2
%16 = icmp eq i32 %15, 48
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = tail call i64 @isalnum(i32 %7)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %10
20: ; preds = %17
%21 = tail call i64 @isblank(i32 %7)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %10
23: ; preds = %10, %14, %20, %6, %6, %2
%24 = phi i32 [ %3, %2 ], [ 10, %6 ], [ 10, %6 ], [ %7, %20 ], [ %7, %14 ], [ %11, %10 ]
%25 = bitcast i8* %1 to i32*
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %23
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %24, %29
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %35
33: ; preds = %28
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %35
35: ; preds = %31, %33, %23
ret i32 %24
}