#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*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int erdEatLineEnd(int Ignore(char), FILE *in) {
  int c;
  int Status = 0;
  while (Ignore((char)(c = getc(in))) && c != EOF)
    ;
  if (c == (int)'\n') {
    Status = 1;
  } else {
    ungetc(c, in);
  }
  return (Status);
}


x86 assembly (clang, -O0):
<erdEatLineEnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,-0x14(%rbp)
movsbl %cl,%edi
call   *%rax
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1178 <erdEatLineEnd+0x58>
mov    -0x14(%rbp),%eax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1188 <erdEatLineEnd+0x68>
jmp    118d <erdEatLineEnd+0x6d>
jmp    1137 <erdEatLineEnd+0x17>
cmpl   $0xa,-0x14(%rbp)
jne    11a3 <erdEatLineEnd+0x83>
movl   $0x1,-0x18(%rbp)
jmp    11af <erdEatLineEnd+0x8f>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ungetc@plt>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erdEatLineEnd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eb4(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <getc@plt>
mov    %eax,%ebp
movsbl %bpl,%edi
call   *%rbx
test   %eax,%eax
je     1159 <erdEatLineEnd+0x39>
cmp    (%r15),%ebp
jne    1140 <erdEatLineEnd+0x20>
mov    $0x1,%eax
cmp    $0xa,%ebp
je     116f <erdEatLineEnd+0x4f>
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <ungetc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @erdEatLineEnd(i32 (i8)* %0, i32* %1) {
%3 = alloca i32 (i8)*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 (i8)* %0, i32 (i8)** %3
store i32* %1, i32** %4
store i32 0, i32* %6
br label %7
7: ; preds = %20, %2
%8 = load i32 (i8)*, i32 (i8)** %3
%9 = load i32*, i32** %4
%10 = call i32 @getc(i32* %9)
store i32 %10, i32* %5
%11 = trunc i32 %10 to i8
%12 = call i32 %8(i8 signext %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %7
%15 = load i32, i32* %5
%16 = load i32, i32* @EOF
%17 = icmp ne i32 %15, %16
br label %18
18: ; preds = %14, %7
%19 = phi i1 [ false, %7 ], [ %17, %14 ]
br i1 %19, label %20, label %21
20: ; preds = %18
br label %7
21: ; preds = %18
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %6
br label %29
25: ; preds = %21
%26 = load i32, i32* %5
%27 = load i32*, i32** %4
%28 = call i32 @ungetc(i32 %26, i32* %27)
br label %29
29: ; preds = %25, %24
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @erdEatLineEnd(i32 (i8)* nocapture %0, i32* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @getc(i32* %1)
%5 = trunc i32 %4 to i8
%6 = tail call i32 %0(i8 signext %5)
%7 = icmp ne i32 %6, 0
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %4, %8
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %3, label %11
11: ; preds = %3
%12 = icmp eq i32 %4, 10
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @ungetc(i32 %4, i32* %1)
br label %15
15: ; preds = %11, %13
%16 = phi i32 [ 0, %13 ], [ 1, %11 ]
ret i32 %16
}