#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 *strchr(char *, char);
void bin_lc_parse_header_record(char *hdr_record, int record_len, char **value,
                                char **comment, int *kwsize) {
  char *pos;
  *value = strchr(hdr_record, '=');
  if (*value == NULL) {
    *comment = NULL;
    return;
  }
  *kwsize = *value - hdr_record;
  pos = *value;
  (*value)++;
  while (**value == ' ')
    (*value)++;
  while (pos[-1] == ' ')
    pos--;
  *pos = '\0';
  *comment = strchr(*value, '/');
  if (**value == '/')
    **value = '\0';
  else if (*comment) {
    pos = *comment;
    while (pos[-1] == ' ')
      pos--;
    *pos = '\0';
    (*comment)++;
    while (**comment == ' ')
      (*comment)++;
    if (**comment) {
      pos = hdr_record + record_len - 1;
      while (pos[-1] == ' ')
        pos--;
      *pos = '\0';
    }
  } else {
    pos = hdr_record + record_len - 1;
    while (pos[-1] == ' ')
      pos--;
    *pos = '\0';
    *comment = pos;
  }
}


x86 assembly (clang, -O0):
<bin_lc_parse_header_record>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1161 <bin_lc_parse_header_record+0x51>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
jmp    1334 <bin_lc_parse_header_record+0x224>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11b6 <bin_lc_parse_header_record+0xa6>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1190 <bin_lc_parse_header_record+0x80>
jmp    11bb <bin_lc_parse_header_record+0xab>
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    11dd <bin_lc_parse_header_record+0xcd>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    11bb <bin_lc_parse_header_record+0xab>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1221 <bin_lc_parse_header_record+0x111>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
jmp    1334 <bin_lc_parse_header_record+0x224>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     12e8 <bin_lc_parse_header_record+0x1d8>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    125c <bin_lc_parse_header_record+0x14c>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    123a <bin_lc_parse_header_record+0x12a>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1297 <bin_lc_parse_header_record+0x187>
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1271 <bin_lc_parse_header_record+0x161>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     12e3 <bin_lc_parse_header_record+0x1d3>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    12dc <bin_lc_parse_header_record+0x1cc>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    12ba <bin_lc_parse_header_record+0x1aa>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
jmp    132f <bin_lc_parse_header_record+0x21f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    131d <bin_lc_parse_header_record+0x20d>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    12fb <bin_lc_parse_header_record+0x1eb>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1334 <bin_lc_parse_header_record+0x224>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_lc_parse_header_record>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r12
mov    %rcx,%r14
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %rdi,%rbx
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,0x0(%rbp)
test   %rax,%rax
je     119f <bin_lc_parse_header_record+0x8f>
mov    %eax,%ecx
sub    %ebx,%ecx
mov    %ecx,(%r12)
lea    0x1(%rax),%rcx
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,0x0(%rbp)
cmpb   $0x20,(%rcx)
lea    0x1(%rcx),%rcx
je     1150 <bin_lc_parse_header_record+0x40>
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,-0x2(%rax)
lea    -0x1(%rax),%rax
je     1170 <bin_lc_parse_header_record+0x60>
movb   $0x0,(%rax)
mov    0x0(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,(%r14)
mov    0x0(%rbp),%rcx
cmpb   $0x2f,(%rcx)
jne    11ab <bin_lc_parse_header_record+0x9b>
movb   $0x0,(%rcx)
jmp    1230 <bin_lc_parse_header_record+0x120>
movq   $0x0,(%r14)
jmp    1230 <bin_lc_parse_header_record+0x120>
test   %rax,%rax
je     120f <bin_lc_parse_header_record+0xff>
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x20,-0x2(%rax)
lea    -0x1(%rax),%rax
je     11c0 <bin_lc_parse_header_record+0xb0>
movb   $0x0,(%rax)
mov    (%r14),%rax
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,(%r14)
movzbl (%rax),%ecx
add    $0x1,%rax
cmp    $0x20,%cl
je     11e0 <bin_lc_parse_header_record+0xd0>
test   %cl,%cl
je     1230 <bin_lc_parse_header_record+0x120>
movslq %r15d,%rax
add    %rax,%rbx
nopl   0x0(%rax)
cmpb   $0x20,-0x2(%rbx)
lea    -0x1(%rbx),%rbx
je     1200 <bin_lc_parse_header_record+0xf0>
movb   $0x0,(%rbx)
jmp    1230 <bin_lc_parse_header_record+0x120>
movslq %r15d,%rax
add    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x20,-0x2(%rbx)
lea    -0x1(%rbx),%rbx
je     1220 <bin_lc_parse_header_record+0x110>
movb   $0x0,(%rbx)
mov    %rbx,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @bin_lc_parse_header_record(i8* %0, i32 %1, i8** %2, i8** %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i8** %3, i8*** %9
store i32* %4, i32** %10
%12 = load i8*, i8** %6
%13 = call i8* @strchr(i8* %12, i8 signext 61)
%14 = load i8**, i8*** %8
store i8* %13, i8** %14
%15 = load i8**, i8*** %8
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %5
%19 = load i8**, i8*** %9
store i8* null, i8** %19
br label %142
20: ; preds = %5
%21 = load i8**, i8*** %8
%22 = load i8*, i8** %21
%23 = load i8*, i8** %6
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = load i32*, i32** %10
store i32 %27, i32* %28
%29 = load i8**, i8*** %8
%30 = load i8*, i8** %29
store i8* %30, i8** %11
%31 = load i8**, i8*** %8
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %31
br label %34
34: ; preds = %40, %20
%35 = load i8**, i8*** %8
%36 = load i8*, i8** %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 32
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = load i8**, i8*** %8
%42 = load i8*, i8** %41
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %41
br label %34
44: ; preds = %34
br label %45
45: ; preds = %51, %44
%46 = load i8*, i8** %11
%47 = getelementptr inbounds i8, i8* %46, i64 -1
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 32
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = load i8*, i8** %11
%53 = getelementptr inbounds i8, i8* %52, i32 -1
store i8* %53, i8** %11
br label %45
54: ; preds = %45
%55 = load i8*, i8** %11
store i8 0, i8* %55
%56 = load i8**, i8*** %8
%57 = load i8*, i8** %56
%58 = call i8* @strchr(i8* %57, i8 signext 47)
%59 = load i8**, i8*** %9
store i8* %58, i8** %59
%60 = load i8**, i8*** %8
%61 = load i8*, i8** %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 47
br i1 %64, label %65, label %68
65: ; preds = %54
%66 = load i8**, i8*** %8
%67 = load i8*, i8** %66
store i8 0, i8* %67
br label %142
68: ; preds = %54
%69 = load i8**, i8*** %9
%70 = load i8*, i8** %69
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %122
72: ; preds = %68
%73 = load i8**, i8*** %9
%74 = load i8*, i8** %73
store i8* %74, i8** %11
br label %75
75: ; preds = %81, %72
%76 = load i8*, i8** %11
%77 = getelementptr inbounds i8, i8* %76, i64 -1
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 32
br i1 %80, label %81, label %84
81: ; preds = %75
%82 = load i8*, i8** %11
%83 = getelementptr inbounds i8, i8* %82, i32 -1
store i8* %83, i8** %11
br label %75
84: ; preds = %75
%85 = load i8*, i8** %11
store i8 0, i8* %85
%86 = load i8**, i8*** %9
%87 = load i8*, i8** %86
%88 = getelementptr inbounds i8, i8* %87, i32 1
store i8* %88, i8** %86
br label %89
89: ; preds = %95, %84
%90 = load i8**, i8*** %9
%91 = load i8*, i8** %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 32
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = load i8**, i8*** %9
%97 = load i8*, i8** %96
%98 = getelementptr inbounds i8, i8* %97, i32 1
store i8* %98, i8** %96
br label %89
99: ; preds = %89
%100 = load i8**, i8*** %9
%101 = load i8*, i8** %100
%102 = load i8, i8* %101
%103 = icmp ne i8 %102, 0
br i1 %103, label %104, label %121
104: ; preds = %99
%105 = load i8*, i8** %6
%106 = load i32, i32* %7
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
%109 = getelementptr inbounds i8, i8* %108, i64 -1
store i8* %109, i8** %11
br label %110
110: ; preds = %116, %104
%111 = load i8*, i8** %11
%112 = getelementptr inbounds i8, i8* %111, i64 -1
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 32
br i1 %115, label %116, label %119
116: ; preds = %110
%117 = load i8*, i8** %11
%118 = getelementptr inbounds i8, i8* %117, i32 -1
store i8* %118, i8** %11
br label %110
119: ; preds = %110
%120 = load i8*, i8** %11
store i8 0, i8* %120
br label %121
121: ; preds = %119, %99
br label %141
122: ; preds = %68
%123 = load i8*, i8** %6
%124 = load i32, i32* %7
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = getelementptr inbounds i8, i8* %126, i64 -1
store i8* %127, i8** %11
br label %128
128: ; preds = %134, %122
%129 = load i8*, i8** %11
%130 = getelementptr inbounds i8, i8* %129, i64 -1
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = icmp eq i32 %132, 32
br i1 %133, label %134, label %137
134: ; preds = %128
%135 = load i8*, i8** %11
%136 = getelementptr inbounds i8, i8* %135, i32 -1
store i8* %136, i8** %11
br label %128
137: ; preds = %128
%138 = load i8*, i8** %11
store i8 0, i8* %138
%139 = load i8*, i8** %11
%140 = load i8**, i8*** %9
store i8* %139, i8** %140
br label %141
141: ; preds = %137, %121
br label %142
142: ; preds = %18, %141, %65
ret void
}

LLVM IR (-O2):
define void @bin_lc_parse_header_record(i8* %0, i32 %1, i8** nocapture %2, i8** nocapture %3, i32* nocapture writeonly %4) {
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
store i8* %6, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %5
store i8* null, i8** %3
br label %64
9: ; preds = %5
%10 = ptrtoint i8* %6 to i64
%11 = ptrtoint i8* %0 to i64
%12 = sub i64 %10, %11
%13 = trunc i64 %12 to i32
store i32 %13, i32* %4
br label %14
14: ; preds = %14, %9
%15 = phi i8* [ %6, %9 ], [ %16, %14 ]
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 32
br i1 %18, label %14, label %19
19: ; preds = %14, %19
%20 = phi i8* [ %21, %19 ], [ %6, %14 ]
%21 = getelementptr inbounds i8, i8* %20, i64 -1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 32
br i1 %23, label %19, label %24
24: ; preds = %19
store i8 0, i8* %20
%25 = load i8*, i8** %2
%26 = tail call i8* @strchr(i8* dereferenceable(1) %25, i8 signext 47)
store i8* %26, i8** %3
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 47
br i1 %29, label %30, label %31
30: ; preds = %24
store i8 0, i8* %27
br label %64
31: ; preds = %24
%32 = icmp eq i8* %26, null
br i1 %32, label %54, label %33
33: ; preds = %31, %33
%34 = phi i8* [ %35, %33 ], [ %26, %31 ]
%35 = getelementptr inbounds i8, i8* %34, i64 -1
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 32
br i1 %37, label %33, label %38
38: ; preds = %33
store i8 0, i8* %34
%39 = load i8*, i8** %3
br label %40
40: ; preds = %40, %38
%41 = phi i8* [ %39, %38 ], [ %42, %40 ]
%42 = getelementptr inbounds i8, i8* %41, i64 1
store i8* %42, i8** %3
%43 = load i8, i8* %42
switch i8 %43, label %44 [
i8 32, label %40
i8 0, label %64
]
44: ; preds = %40
%45 = sext i32 %1 to i64
%46 = getelementptr inbounds i8, i8* %0, i64 %45
br label %47
47: ; preds = %47, %44
%48 = phi i8* [ %46, %44 ], [ %49, %47 ]
%49 = getelementptr inbounds i8, i8* %48, i64 -1
%50 = getelementptr inbounds i8, i8* %48, i64 -2
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 32
br i1 %52, label %47, label %53
53: ; preds = %47
store i8 0, i8* %49
br label %64
54: ; preds = %31
%55 = sext i32 %1 to i64
%56 = getelementptr inbounds i8, i8* %0, i64 %55
br label %57
57: ; preds = %57, %54
%58 = phi i8* [ %56, %54 ], [ %59, %57 ]
%59 = getelementptr inbounds i8, i8* %58, i64 -1
%60 = getelementptr inbounds i8, i8* %58, i64 -2
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 32
br i1 %62, label %57, label %63
63: ; preds = %57
store i8 0, i8* %59
store i8* %59, i8** %3
br label %64
64: ; preds = %40, %30, %53, %63, %8
ret void
}