#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__ config_parse_key_value(char *, char *);
char *strtok(char *, char *);
int parse_config_line(char *line) {
  char *ptr;
  char *key = NULL;
  char *value = NULL;
  if (line[0] == '#' || line[0] == '\0' || line[0] == '\n')
    return 0;
  ptr = strtok(line, "\t\n ");
  while (ptr != NULL) {
    if (!key) {
      key = ptr;
    } else if (!value) {
      value = ptr;
    } else {
      return -1;
    }
    ptr = strtok(NULL, "\t\n ");
  }
  if (key && value) {
    if (config_parse_key_value(key, value) != 0)
      return -1;
  } else {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_config_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     116c <parse_config_line+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116c <parse_config_line+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1178 <parse_config_line+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1242 <parse_config_line+0x122>
mov    -0x10(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11f1 <parse_config_line+0xd1>
cmpq   $0x0,-0x20(%rbp)
jne    11af <parse_config_line+0x8f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11d8 <parse_config_line+0xb8>
cmpq   $0x0,-0x28(%rbp)
jne    11c7 <parse_config_line+0xa7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11d3 <parse_config_line+0xb3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1242 <parse_config_line+0x122>
jmp    11d8 <parse_config_line+0xb8>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe1d(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    118c <parse_config_line+0x6c>
cmpq   $0x0,-0x20(%rbp)
je     122f <parse_config_line+0x10f>
cmpq   $0x0,-0x28(%rbp)
je     122f <parse_config_line+0x10f>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <config_parse_key_value@plt>
cmp    $0x0,%rax
je     122a <parse_config_line+0x10a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1242 <parse_config_line+0x122>
jmp    123b <parse_config_line+0x11b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1242 <parse_config_line+0x122>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_config_line>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movzbl (%rdi),%eax
cmp    $0x23,%rax
ja     1151 <parse_config_line+0x31>
xor    %r14d,%r14d
movabs $0x800000401,%rcx
bt     %rax,%rcx
jae    1151 <parse_config_line+0x31>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea8(%rip),%rsi
call   1030 <strtok@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     1143 <parse_config_line+0x23>
xor    %ebx,%ebx
lea    0xe8f(%rip),%r15
xor    %ebp,%ebp
jmp    1192 <parse_config_line+0x72>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%rbp
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <strtok@plt>
test   %rax,%rax
je     11a1 <parse_config_line+0x81>
test   %rbp,%rbp
je     1180 <parse_config_line+0x60>
test   %rbx,%rbx
mov    %rax,%rbx
je     1183 <parse_config_line+0x63>
jmp    1143 <parse_config_line+0x23>
test   %rbx,%rbx
je     1143 <parse_config_line+0x23>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <config_parse_key_value@plt>
neg    %rax
sbb    %r14d,%r14d
jmp    1143 <parse_config_line+0x23>

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

LLVM IR (-O2):
@.str = [4 x i8] c"\09\0A \00"
define i32 @parse_config_line(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %3 [
i8 35, label %24
i8 0, label %24
i8 10, label %24
]
3: ; preds = %1
%4 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %24, label %6
6: ; preds = %3, %13
%7 = phi i8* [ %15, %13 ], [ null, %3 ]
%8 = phi i8* [ %14, %13 ], [ null, %3 ]
%9 = phi i8* [ %16, %13 ], [ %4, %3 ]
%10 = icmp eq i8* %8, null
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = icmp eq i8* %7, null
br i1 %12, label %13, label %24
13: ; preds = %11, %6
%14 = phi i8* [ %9, %6 ], [ %8, %11 ]
%15 = phi i8* [ %7, %6 ], [ %9, %11 ]
%16 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %6
18: ; preds = %13
%19 = icmp eq i8* %15, null
br i1 %19, label %24, label %20
20: ; preds = %18
%21 = tail call i64 @config_parse_key_value(i8* %14, i8* %15)
%22 = icmp ne i64 %21, 0
%23 = sext i1 %22 to i32
br label %24
24: ; preds = %11, %3, %18, %20, %1, %1, %1
%25 = phi i32 [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ %23, %20 ], [ -1, %18 ], [ -1, %3 ], [ -1, %11 ]
ret i32 %25
}