#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
scalar_t__ isspace(int);
int eatSpace() {
  int c;
  while ((c = getchar()) != EOF && c != '\n' && isspace(c))
    ;
  if (c == EOF)
    exit(0);
  return c;
}


x86 assembly (clang, -O0):
<eatSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
mov    0x2e9b(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x5(%rbp)
je     1179 <eatSpace+0x49>
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1179 <eatSpace+0x49>
mov    -0x4(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1189 <eatSpace+0x59>
jmp    118e <eatSpace+0x5e>
jmp    1138 <eatSpace+0x8>
mov    -0x4(%rbp),%eax
mov    0x2e50(%rip),%rcx
cmp    (%rcx),%eax
jne    11a7 <eatSpace+0x77>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eatSpace>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%r14
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    (%r14),%eax
cmp    $0xa,%ebx
je     1164 <eatSpace+0x34>
cmp    %eax,%ebx
je     1164 <eatSpace+0x34>
mov    %ebx,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <eatSpace+0x10>
mov    (%r14),%eax
cmp    %eax,%ebx
je     1172 <eatSpace+0x42>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %edi,%edi
call   1050 <exit@plt>

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

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