#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*/ *);
void skipLine(FILE *f) {
  int c;
  while ((c = fgetc(f)) != EOF && c != '\r' && c != '\n')
    ;
  if (c == '\r' && (c = fgetc(f)) != EOF && c != '\n')
    ungetc(c, f);
}


x86 assembly (clang, -O0):
<skipLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ea5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1167 <skipLine+0x47>
xor    %eax,%eax
cmpl   $0xd,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1167 <skipLine+0x47>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1177 <skipLine+0x57>
jmp    117c <skipLine+0x5c>
jmp    112c <skipLine+0xc>
cmpl   $0xd,-0xc(%rbp)
jne    11b7 <skipLine+0x97>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e4f(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <skipLine+0x97>
cmpl   $0xa,-0xc(%rbp)
je     11b7 <skipLine+0x97>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipLine>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r14),%eax
je     1149 <skipLine+0x29>
cmp    $0xa,%eax
je     1171 <skipLine+0x51>
cmp    $0xd,%eax
jne    1130 <skipLine+0x10>
jmp    114e <skipLine+0x2e>
cmp    $0xd,%eax
jne    1171 <skipLine+0x51>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1171 <skipLine+0x51>
cmp    (%r14),%eax
je     1171 <skipLine+0x51>
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ungetc@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define void @skipLine(i32* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = freeze i32 %4
%6 = icmp eq i32 %3, %5
br i1 %6, label %8, label %7
7: ; preds = %2
switch i32 %3, label %2 [
i32 13, label %10
i32 10, label %18
]
8: ; preds = %2
%9 = icmp eq i32 %3, 13
br i1 %9, label %10, label %18
10: ; preds = %7, %8
%11 = tail call i32 @fgetc(i32* %0)
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
%14 = icmp ne i32 %11, 10
%15 = and i1 %14, %13
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = tail call i32 @ungetc(i32 %11, i32* %0)
br label %18
18: ; preds = %7, %16, %10, %8
ret void
}