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


x86 assembly (clang, -O0):
<lexer_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%eax
je     119f <lexer_skip+0x6f>
mov    -0x8(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
jne    117e <lexer_skip+0x4e>
cmpl   $0xa,-0x8(%rbp)
je     117e <lexer_skip+0x4e>
cmpl   $0xd,-0x8(%rbp)
jne    1183 <lexer_skip+0x53>
jmp    1138 <lexer_skip+0x8>
mov    -0x8(%rbp),%edi
mov    0x2e5b(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ab <lexer_skip+0x7b>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_skip>:
push   %r15
push   %r14
push   %rbx
mov    0x2eac(%rip),%r14
mov    (%r14),%edi
call   1050 <getc@plt>
mov    %eax,%ebx
mov    0x2e93(%rip),%r15
jmp    115a <lexer_skip+0x2a>
nop
mov    (%r14),%edi
call   1050 <getc@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     117f <lexer_skip+0x4f>
mov    %ebx,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1150 <lexer_skip+0x20>
cmp    $0xa,%ebx
je     1150 <lexer_skip+0x20>
cmp    $0xd,%ebx
je     1150 <lexer_skip+0x20>
mov    (%r14),%esi
mov    %ebx,%edi
call   1040 <ungetc@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i32 @lexer_skip() {
%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 %24
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
%21 = load i32, i32* @stdin
%22 = call i32 @ungetc(i32 %20, i32 %21)
%23 = load i32, i32* %2
store i32 %23, i32* %1
br label %26
24: ; preds = %3
%25 = load i32, i32* @EOF
store i32 %25, i32* %1
br label %26
26: ; preds = %24, %19
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i32 @lexer_skip() {
%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 %19, 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 %19, label %5
15: ; preds = %5
switch i32 %6, label %16 [
i32 13, label %10
i32 10, label %10
]
16: ; preds = %15
%17 = load i32, i32* @stdin
%18 = tail call i32 @ungetc(i32 %6, i32 %17)
br label %19
19: ; preds = %10, %0, %16
%20 = phi i32 [ %6, %16 ], [ %2, %0 ], [ %12, %10 ]
ret i32 %20
}