#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 */

/* Variables and functions */
char *extract_html(char *buffer, int size_buffer) {
  char *end = buffer + size_buffer;
  char *cur;
  for (cur = buffer; cur + 3 < end; cur++)
    if (*cur == '\r' && *(cur + 1) == '\n' && *(cur + 2) == '\r' &&
        *(cur + 3) == '\n')
      return cur + 4;
  return NULL;
}


x86 assembly (clang, -O0):
<extract_html>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x3,%rax
cmp    -0x20(%rbp),%rax
jae    119e <extract_html+0x9e>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    1188 <extract_html+0x88>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0xa,%eax
jne    1188 <extract_html+0x88>
mov    -0x28(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0xd,%eax
jne    1188 <extract_html+0x88>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0xa,%eax
jne    1188 <extract_html+0x88>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <extract_html+0xa6>
jmp    118d <extract_html+0x8d>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1122 <extract_html+0x22>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_html>:
cmp    $0x4,%esi
jl     1145 <extract_html+0x45>
mov    %rdi,%rax
movslq %esi,%rcx
add    %rdi,%rcx
add    $0x3,%rax
jmp    1129 <extract_html+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rax
cmp    %rcx,%rax
jae    1145 <extract_html+0x45>
cmpb   $0xd,-0x3(%rax)
jne    1120 <extract_html+0x20>
cmpb   $0xa,-0x2(%rax)
jne    1120 <extract_html+0x20>
cmpb   $0xd,-0x1(%rax)
jne    1120 <extract_html+0x20>
cmpb   $0xa,(%rax)
jne    1120 <extract_html+0x20>
add    $0x1,%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @extract_html(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8* %11, i8** %6
%12 = load i8*, i8** %4
store i8* %12, i8** %7
br label %13
13: ; preds = %45, %2
%14 = load i8*, i8** %7
%15 = getelementptr inbounds i8, i8* %14, i64 3
%16 = load i8*, i8** %6
%17 = icmp ult i8* %15, %16
br i1 %17, label %18, label %48
18: ; preds = %13
%19 = load i8*, i8** %7
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 13
br i1 %22, label %23, label %44
23: ; preds = %18
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %44
29: ; preds = %23
%30 = load i8*, i8** %7
%31 = getelementptr inbounds i8, i8* %30, i64 2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 13
br i1 %34, label %35, label %44
35: ; preds = %29
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i64 3
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 10
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = load i8*, i8** %7
%43 = getelementptr inbounds i8, i8* %42, i64 4
store i8* %43, i8** %3
br label %49
44: ; preds = %35, %29, %23, %18
br label %45
45: ; preds = %44
%46 = load i8*, i8** %7
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %7
br label %13
48: ; preds = %13
store i8* null, i8** %3
br label %49
49: ; preds = %48, %41
%50 = load i8*, i8** %3
ret i8* %50
}

LLVM IR (-O2):
define i8* @extract_html(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %1, 3
br i1 %5, label %6, label %30
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 3
br label %8
8: ; preds = %6, %26
%9 = phi i8* [ %28, %26 ], [ %7, %6 ]
%10 = phi i8* [ %27, %26 ], [ %0, %6 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 13
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %10, i64 2
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 13
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i8, i8* %9
%23 = icmp eq i8 %22, 10
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = getelementptr inbounds i8, i8* %10, i64 4
br label %30
26: ; preds = %8, %13, %17, %21
%27 = getelementptr inbounds i8, i8* %10, i64 1
%28 = getelementptr inbounds i8, i8* %10, i64 4
%29 = icmp ult i8* %28, %4
br i1 %29, label %8, label %30
30: ; preds = %26, %2, %24
%31 = phi i8* [ %25, %24 ], [ null, %2 ], [ null, %26 ]
ret i8* %31
}