#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 isBlank(char const *, size_t);
char *secGetStringPart(char const *, int /*<<< orphan*/, size_t);
void getHeaderFieldName(char **cpp_output, const char *ccp_input) {
  size_t i_last_char_name;
  for (i_last_char_name = 0; isBlank(ccp_input, i_last_char_name) == -1 &&
                             ccp_input[i_last_char_name] != ':';
       ++i_last_char_name)
    ;
  *cpp_output = secGetStringPart(ccp_input, 0, i_last_char_name - 1);
}


x86 assembly (clang, -O0):
<getHeaderFieldName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <isBlank@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x19(%rbp)
jne    116a <getHeaderFieldName+0x4a>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117a <getHeaderFieldName+0x5a>
jmp    1190 <getHeaderFieldName+0x70>
jmp    117f <getHeaderFieldName+0x5f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <getHeaderFieldName+0x18>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1040 <secGetStringPart@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHeaderFieldName>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <isBlank@plt>
cmp    $0xffffffff,%eax
jne    115b <getHeaderFieldName+0x3b>
xor    %ebx,%ebx
xchg   %ax,%ax
cmpb   $0x3a,(%r15,%rbx,1)
je     115b <getHeaderFieldName+0x3b>
add    $0x1,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <isBlank@plt>
cmp    $0xffffffff,%eax
je     1140 <getHeaderFieldName+0x20>
add    $0xffffffffffffffff,%rbx
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <secGetStringPart@plt>
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @getHeaderFieldName(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i64
store i8** %0, i8*** %3
store i8* %1, i8** %4
store i64 0, i64* %5
br label %6
6: ; preds = %21, %2
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = call i32 @isBlank(i8* %7, i64 %8)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = load i64, i64* %5
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 58
br label %18
18: ; preds = %11, %6
%19 = phi i1 [ false, %6 ], [ %17, %11 ]
br i1 %19, label %20, label %24
20: ; preds = %18
br label %21
21: ; preds = %20
%22 = load i64, i64* %5
%23 = add i64 %22, 1
store i64 %23, i64* %5
br label %6
24: ; preds = %18
%25 = load i8*, i8** %4
%26 = load i64, i64* %5
%27 = sub i64 %26, 1
%28 = call i8* @secGetStringPart(i8* %25, i32 0, i64 %27)
%29 = load i8**, i8*** %3
store i8* %28, i8** %29
ret void
}

LLVM IR (-O2):
define void @getHeaderFieldName(i8** nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @isBlank(i8* %1, i64 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %14
5: ; preds = %2, %10
%6 = phi i64 [ %11, %10 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 58
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = add i64 %6, 1
%12 = tail call i32 @isBlank(i8* %1, i64 %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %5, label %14
14: ; preds = %5, %10, %2
%15 = phi i64 [ 0, %2 ], [ %11, %10 ], [ %6, %5 ]
%16 = add i64 %15, -1
%17 = tail call i8* @secGetStringPart(i8* %1, i32 0, i64 %16)
store i8* %17, i8** %0
ret void
}