#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 /*<<< orphan*/ fgets_or_exit(char *, int, int /*<<< orphan*/ *);
char *malloc(int);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
void skip_headers(FILE *client) {
  char *buffer = malloc(5000 * sizeof(char));
  while (strcmp(fgets_or_exit(buffer, 300, client), "\r\n") != 0 ||
         strcmp(fgets_or_exit(buffer, 300, client), "\n") != 0) {
  }
}


x86 assembly (clang, -O0):
<skip_headers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1388,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x12c,%esi
call   1030 <fgets_or_exit@plt>
mov    %eax,%edi
lea    0xe9b(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11a6 <skip_headers+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x12c,%esi
call   1030 <fgets_or_exit@plt>
mov    %eax,%edi
lea    0xe6a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11b6 <skip_headers+0x86>
jmp    11bb <skip_headers+0x8b>
jmp    114a <skip_headers+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_headers>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x1388,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%r15
lea    0xeab(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x12c,%esi
mov    %r14,%rdx
call   1030 <fgets_or_exit@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1160 <skip_headers+0x30>
mov    %rbx,%rdi
mov    $0x12c,%esi
mov    %r14,%rdx
call   1030 <fgets_or_exit@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1160 <skip_headers+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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