#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int end_of_line(FILE *fin, int c) {
  int eol;
  eol = (c == '\r' || c == '\n');
  if (c == '\r') {
    c = fgetc(fin);
    if (c != '\n' && c != EOF)
      ungetc(c, fin);
  }
  return eol;
}


x86 assembly (clang, -O0):
<end_of_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0xd,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     1148 <end_of_line+0x28>
cmpl   $0xa,-0xc(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xd,-0xc(%rbp)
jne    1196 <end_of_line+0x76>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     1191 <end_of_line+0x71>
mov    -0xc(%rbp),%eax
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <end_of_line+0x71>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
jmp    1196 <end_of_line+0x76>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_of_line>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    $0xd,%esi
jne    114d <end_of_line+0x2d>
mov    %rdi,%r14
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     114d <end_of_line+0x2d>
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%eax
je     114d <end_of_line+0x2d>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <ungetc@plt>
cmp    $0xd,%ebx
sete   %al
cmp    $0xa,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @end_of_line(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 13
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = tail call i32 @fgetc(i32* %0)
%6 = icmp eq i32 %5, 10
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %5, %7
%9 = select i1 %6, i1 true, i1 %8
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = tail call i32 @ungetc(i32 %5, i32* %0)
br label %12
12: ; preds = %4, %10, %2
%13 = icmp eq i32 %1, 10
%14 = or i1 %3, %13
%15 = zext i1 %14 to i32
ret i32 %15
}