#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 EOF;
char fgetc(int /*<<< orphan*/);
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char c;
  c = fgetc(stdin);
  while (c != EOF)
    if (isalnum(c))
      printf("%c\n", c);
  c = fgetc(stdin);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2e7e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1195 <main+0x65>
movsbl -0x11(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     1190 <main+0x60>
lea    0xe79(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <printf@plt>
jmp    1157 <main+0x27>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2ea9(%rip),%r15
mov    (%r15),%edi
call   1050 <fgetc@plt>
mov    0x2e92(%rip),%r12
cmp    (%r12),%al
jne    116a <main+0x3a>
mov    (%r15),%edi
call   1050 <fgetc@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
movsbl %al,%ebp
lea    0xe8a(%rip),%r14
jmp    1186 <main+0x56>
nopl   0x0(%rax,%rax,1)
cmp    (%r12),%bl
je     1154 <main+0x24>
mov    %ebp,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
je     1180 <main+0x50>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
jmp    1180 <main+0x50>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i8 0
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdin
%8 = call signext i8 @fgetc(i32 %7)
store i8 %8, i8* %6
br label %9
9: ; preds = %22, %2
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = load i8, i8* %6
%17 = call i64 @isalnum(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8, i8* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %20)
br label %22
22: ; preds = %19, %15
br label %9
23: ; preds = %9
%24 = load i32, i32* @stdin
%25 = call signext i8 @fgetc(i32 %24)
store i8 %25, i8* %6
ret i32 1
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call signext i8 @fgetc(i32 %3)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %15, label %7
7: ; preds = %2, %12
%8 = tail call i64 @isalnum(i8 signext %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %4)
br label %12
12: ; preds = %10, %7
%13 = load i8, i8* @EOF
%14 = icmp eq i8 %4, %13
br i1 %14, label %15, label %7
15: ; preds = %12, %2
%16 = load i32, i32* @stdin
%17 = tail call signext i8 @fgetc(i32 %16)
ret i32 1
}