#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 const *, char);
char *strdup(char const *);
int /*<<< orphan*/ trim_spaces(char *);
int parse_line(const char *line, char **key, char **value) {
  char *value_str;
  if ((line[0] == ';') || (line[0] == '#') || (line[0] == '\n'))
    return 0;
  if (!(value_str = strchr(line, '=')))
    return 0;
  value_str[0] = '\0';
  value_str++;
  *key = strdup(line);
  char *temp_str;
  if ((temp_str = strchr(value_str, '\n')))
    temp_str[0] = '\0';
  *value = strdup(value_str);
  trim_spaces(*key);
  trim_spaces(*value);
  return 1;
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
je     1174 <parse_line+0x44>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1174 <parse_line+0x44>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1180 <parse_line+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1223 <parse_line+0xf3>
mov    -0x10(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11a8 <parse_line+0x78>
movl   $0x0,-0x4(%rbp)
jmp    1223 <parse_line+0xf3>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     11f1 <parse_line+0xc1>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <trim_spaces@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1040 <trim_spaces@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movzbl (%rdi),%eax
xor    %ebp,%ebp
cmp    $0x3b,%rax
ja     1167 <parse_line+0x37>
movabs $0x800000800000400,%rcx
bt     %rax,%rcx
jae    1167 <parse_line+0x37>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     115c <parse_line+0x2c>
mov    %rax,%r12
movb   $0x0,(%rax)
add    $0x1,%r12
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r15)
mov    %r12,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11a3 <parse_line+0x73>
movb   $0x0,(%rax)
mov    %r12,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r14)
mov    (%r15),%rdi
call   1040 <trim_spaces@plt>
mov    (%r14),%rdi
call   1040 <trim_spaces@plt>
mov    $0x1,%ebp
jmp    115c <parse_line+0x2c>

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

LLVM IR (-O2):
define i32 @parse_line(i8* %0, i8** nocapture %1, i8** nocapture %2) {
%4 = load i8, i8* %0
switch i8 %4, label %5 [
i8 59, label %20
i8 35, label %20
i8 10, label %20
]
5: ; preds = %3
%6 = tail call i8* @strchr(i8* %0, i8 signext 61)
%7 = icmp eq i8* %6, null
br i1 %7, label %20, label %8
8: ; preds = %5
store i8 0, i8* %6
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strdup(i8* %0)
store i8* %10, i8** %1
%11 = tail call i8* @strchr(i8* %9, i8 signext 10)
%12 = icmp eq i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %8
store i8 0, i8* %11
br label %14
14: ; preds = %13, %8
%15 = tail call i8* @strdup(i8* %9)
store i8* %15, i8** %2
%16 = load i8*, i8** %1
%17 = tail call i32 @trim_spaces(i8* %16)
%18 = load i8*, i8** %2
%19 = tail call i32 @trim_spaces(i8* %18)
br label %20
20: ; preds = %5, %3, %3, %3, %14
%21 = phi i32 [ 1, %14 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %5 ]
ret i32 %21
}