#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 getc(int /*<<< orphan*/);
scalar_t__ isspace(int);
int /*<<< orphan*/ stdin;
int getc_nonspace(void) {
  int c;
  while ((c = getc(stdin)) != EOF) {
    if (isspace(c) || c == '\n' || c == '\r') {
      continue;
    }
    return c;
  }
  return EOF;
}


x86 assembly (clang, -O0):
<getc_nonspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
call   1040 <getc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea0(%rip),%rcx
cmp    (%rcx),%eax
je     117e <getc_nonspace+0x5e>
mov    -0x8(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
jne    116e <getc_nonspace+0x4e>
cmpl   $0xa,-0x8(%rbp)
je     116e <getc_nonspace+0x4e>
cmpl   $0xd,-0x8(%rbp)
jne    1173 <getc_nonspace+0x53>
jmp    1128 <getc_nonspace+0x8>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118a <getc_nonspace+0x6a>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getc_nonspace>:
push   %r15
push   %r14
push   %rbx
mov    0x2ebc(%rip),%r14
mov    (%r14),%edi
call   1040 <getc@plt>
mov    %eax,%ebx
mov    0x2ea3(%rip),%r15
jmp    114a <getc_nonspace+0x2a>
nop
mov    (%r14),%edi
call   1040 <getc@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     1165 <getc_nonspace+0x45>
mov    %ebx,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <getc_nonspace+0x20>
cmp    $0xa,%ebx
je     1140 <getc_nonspace+0x20>
cmp    $0xd,%ebx
je     1140 <getc_nonspace+0x20>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i32 @getc_nonspace() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* @stdin
%5 = call i32 @getc(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %21
8: ; preds = %3
%9 = load i32, i32* %2
%10 = call i64 @isspace(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 10
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 13
br i1 %17, label %18, label %19
18: ; preds = %15, %12, %8
br label %3
19: ; preds = %15
%20 = load i32, i32* %2
store i32 %20, i32* %1
br label %23
21: ; preds = %3
%22 = load i32, i32* @EOF
store i32 %22, i32* %1
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i32 @getc_nonspace() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @getc(i32 %1)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %16, label %5
5: ; preds = %0, %10
%6 = phi i32 [ %12, %10 ], [ %2, %0 ]
%7 = tail call i64 @isspace(i32 %6)
%8 = freeze i64 %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5, %15, %15
%11 = load i32, i32* @stdin
%12 = tail call i32 @getc(i32 %11)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %16, label %5
15: ; preds = %5
switch i32 %6, label %16 [
i32 13, label %10
i32 10, label %10
]
16: ; preds = %15, %10, %0
%17 = phi i32 [ %2, %0 ], [ %12, %10 ], [ %6, %15 ]
ret i32 %17
}