#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 */
scalar_t__ isblank(char const);
char *strcasestr(char const *, char const *);
scalar_t__ strlen(char const *);
const char *in_get_header_info_str(const char *header, const char *type) {
  const char *p = strcasestr(header, type);
  if (p == NULL) {
    return NULL;
  }
  p += (strlen(type) + 1);
  while (isblank(*p) != 0) {
    p++;
  }
  return p;
}


x86 assembly (clang, -O0):
<in_get_header_info_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcasestr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1169 <in_get_header_info_str+0x39>
movq   $0x0,-0x8(%rbp)
jmp    11ad <in_get_header_info_str+0x7d>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isblank@plt>
cmp    $0x0,%rax
je     11a5 <in_get_header_info_str+0x75>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    117e <in_get_header_info_str+0x4e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_get_header_info_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <strcasestr@plt>
test   %rax,%rax
je     1164 <in_get_header_info_str+0x34>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %rax,%rbx
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isblank@plt>
test   %rax,%rax
jne    1150 <in_get_header_info_str+0x20>
jmp    1166 <in_get_header_info_str+0x36>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @in_get_header_info_str(i8* %0, i8* %1) {
%3 = tail call i8* @strcasestr(i8* %0, i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%7 = add nsw i64 %6, 1
%8 = getelementptr inbounds i8, i8* %3, i64 %7
br label %9
9: ; preds = %9, %5
%10 = phi i8* [ %8, %5 ], [ %14, %9 ]
%11 = load i8, i8* %10
%12 = tail call i64 @isblank(i8 signext %11)
%13 = icmp eq i64 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %15, label %9
15: ; preds = %9, %2
%16 = phi i8* [ null, %2 ], [ %10, %9 ]
ret i8* %16
}