#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 */
int strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
char *http_GET_find_line(char **lines, char *line) {
  int len = strlen(line);
  for (; *lines; lines++) {
    if (!strncasecmp(*lines, line, len))
      return *lines + len;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<http_GET_find_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1193 <http_GET_find_line+0x73>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
jne    117d <http_GET_find_line+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    119b <http_GET_find_line+0x7b>
jmp    1182 <http_GET_find_line+0x62>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <http_GET_find_line+0x1c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_GET_find_line>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    (%rbx),%r12
test   %r12,%r12
je     116f <http_GET_find_line+0x4f>
mov    %eax,%ebp
add    $0x8,%rbx
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <strncasecmp@plt>
test   %eax,%eax
je     1174 <http_GET_find_line+0x54>
mov    (%rbx),%r12
add    $0x8,%rbx
test   %r12,%r12
jne    1150 <http_GET_find_line+0x30>
jmp    117d <http_GET_find_line+0x5d>
xor    %r15d,%r15d
jmp    117d <http_GET_find_line+0x5d>
movslq %ebp,%rax
add    %rax,%r12
mov    %r12,%r15
mov    %r15,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @http_GET_find_line(i8** %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %6
br label %9
9: ; preds = %27, %2
%10 = load i8**, i8*** %4
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i8**, i8*** %4
%15 = load i8*, i8** %14
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = call i32 @strncasecmp(i8* %15, i8* %16, i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %13
%21 = load i8**, i8*** %4
%22 = load i8*, i8** %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8* %25, i8** %3
br label %31
26: ; preds = %13
br label %27
27: ; preds = %26
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i32 1
store i8** %29, i8*** %4
br label %9
30: ; preds = %9
store i8* null, i8** %3
br label %31
31: ; preds = %30, %20
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @http_GET_find_line(i8** nocapture %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %18, label %9
6: ; preds = %9
%7 = load i8*, i8** %14
%8 = icmp eq i8* %7, null
br i1 %8, label %18, label %9
9: ; preds = %2, %6
%10 = phi i8* [ %7, %6 ], [ %4, %2 ]
%11 = phi i8** [ %14, %6 ], [ %0, %2 ]
%12 = tail call i32 @strncasecmp(i8* %10, i8* %1, i32 %3)
%13 = icmp eq i32 %12, 0
%14 = getelementptr inbounds i8*, i8** %11, i64 1
br i1 %13, label %15, label %6
15: ; preds = %9
%16 = sext i32 %3 to i64
%17 = getelementptr inbounds i8, i8* %10, i64 %16
br label %18
18: ; preds = %6, %2, %15
%19 = phi i8* [ %17, %15 ], [ null, %2 ], [ null, %6 ]
ret i8* %19
}