#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*/ str;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fgets_or_exit(char *, int, int /*<<< orphan*/ *);
void skip_headers(FILE *f) {
  char str[1024];
  while (1) {
    fgets_or_exit(str, sizeof(str), f);
    if ((str[0] == '\r' && str[1] == '\n') || str[0] == '\n')
      break;
  }
}


x86 assembly (clang, -O0):
<skip_headers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets_or_exit@plt>
movsbl -0x410(%rbp),%eax
cmp    $0xd,%eax
jne    1154 <skip_headers+0x44>
movsbl -0x40f(%rbp),%eax
cmp    $0xa,%eax
je     1164 <skip_headers+0x54>
movsbl -0x410(%rbp),%eax
cmp    $0xa,%eax
jne    1169 <skip_headers+0x59>
jmp    116e <skip_headers+0x5e>
jmp    111f <skip_headers+0xf>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_headers>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1030 <fgets_or_exit@plt>
movzbl (%rsp),%ecx
movzbl 0x1(%rsp),%eax
mov    %ecx,%edx
xor    $0xd,%dl
xor    $0xa,%al
or     %dl,%al
sete   %al
cmp    $0xa,%cl
je     114e <skip_headers+0x3e>
test   %al,%al
je     1120 <skip_headers+0x10>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @skip_headers(i32* %0) {
%2 = alloca i32*
%3 = alloca [1024 x i8]
store i32* %0, i32** %2
br label %4
4: ; preds = %1, %23
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i32 @fgets_or_exit(i8* %5, i32 1024, i32* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 13
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %22, label %17
17: ; preds = %12, %4
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %17, %12
br label %24
23: ; preds = %17
br label %4
24: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @skip_headers(i32* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1
br label %5
5: ; preds = %5, %1
%6 = call i32 @fgets_or_exit(i8* %3, i32 1024, i32* %0)
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 13
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 10
%11 = select i1 %8, i1 %10, i1 false
%12 = icmp eq i8 %7, 10
%13 = or i1 %12, %11
br i1 %13, label %14, label %5
14: ; preds = %5
ret void
}