#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 */
scalar_t__ fgets_or_exit(char *, int, int /*<<< orphan*/ *);
scalar_t__ strncmp(char *, char *, int);
void skip_headers(FILE *client) {
  char buffer[4048];
  while (fgets_or_exit(buffer, 4048, client)) {
    if (strncmp(buffer, "\n", 1) == 0 || strncmp(buffer, "\r\n", 2) == 0)
      return;
  }
}


x86 assembly (clang, -O0):
<skip_headers>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfe0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xfe0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xfd0,%esi
call   1030 <fgets_or_exit@plt>
cmp    $0x0,%rax
je     119c <skip_headers+0x7c>
lea    -0xfe0(%rbp),%rdi
lea    0xea5(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     1192 <skip_headers+0x72>
lea    -0xfe0(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1197 <skip_headers+0x77>
jmp    119c <skip_headers+0x7c>
jmp    112f <skip_headers+0xf>
add    $0xfe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_headers>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfd8,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
lea    0xec6(%rip),%r15
lea    0xebe(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0xfd0,%esi
mov    %r14,%rdx
call   1030 <fgets_or_exit@plt>
test   %rax,%rax
je     118f <skip_headers+0x6f>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     118f <skip_headers+0x6f>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1150 <skip_headers+0x30>
add    $0xfd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @skip_headers(i32* %0) {
%2 = alloca i32*
%3 = alloca [4048 x i8]
store i32* %0, i32** %2
br label %4
4: ; preds = %18, %1
%5 = getelementptr inbounds [4048 x i8], [4048 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i64 @fgets_or_exit(i8* %5, i32 4048, i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = getelementptr inbounds [4048 x i8], [4048 x i8]* %3, i64 0, i64 0
%11 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = getelementptr inbounds [4048 x i8], [4048 x i8]* %3, i64 0, i64 0
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %9
br label %19
18: ; preds = %13
br label %4
19: ; preds = %17, %4
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @skip_headers(i32* %0) {
%2 = alloca [4048 x i8]
%3 = getelementptr inbounds [4048 x i8], [4048 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %10, %1
%5 = call i64 @fgets_or_exit(i8* %3, i32 4048, i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %7, %10
ret void
}