#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 /*<<< orphan*/ printf(char *, char *);
char *strpbrk(char *, char *);
int ParseString(char *str, char **key, char **value) {
  char *k, *v, *w;
  k = str;
  v = strpbrk(str, "=");
  if (!v) {
    printf("Invalid config line: '%s'\n", str);
    *key = NULL;
    *value = NULL;
    return 0;
  }
  *v++ = '\0';
  w = strpbrk(k, " ");
  if (w)
    *w = '\0';
  while (*v == ' ') {
    v++;
  }
  *key = k;
  *value = v;
  return 1;
}


x86 assembly (clang, -O0):
<ParseString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    118d <ParseString+0x6d>
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1208 <ParseString+0xe8>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11c5 <ParseString+0xa5>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
jmp    11ca <ParseString+0xaa>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11eb <ParseString+0xcb>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11ca <ParseString+0xaa>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0x3d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1171 <ParseString+0x51>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r12,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1160 <ParseString+0x40>
movb   $0x0,(%rax)
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     1160 <ParseString+0x40>
mov    $0x1,%eax
jmp    1187 <ParseString+0x67>
lea    0xe88(%rip),%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
xor    %r12d,%r12d
xor    %ebx,%ebx
xor    %eax,%eax
mov    %r12,(%r15)
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [27 x i8] c"Invalid config line: '%s'\0A\00"
@.str.2 = [2 x i8] c" \00"
define i32 @ParseString(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%11 = load i8*, i8** %5
store i8* %11, i8** %8
%12 = load i8*, i8** %5
%13 = call i8* @strpbrk(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %9
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %21, label %16
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8**, i8*** %6
store i8* null, i8** %19
%20 = load i8**, i8*** %7
store i8* null, i8** %20
store i32 0, i32* %4
br label %44
21: ; preds = %3
%22 = load i8*, i8** %9
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %9
store i8 0, i8* %22
%24 = load i8*, i8** %8
%25 = call i8* @strpbrk(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %25, i8** %10
%26 = load i8*, i8** %10
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = load i8*, i8** %10
store i8 0, i8* %29
br label %30
30: ; preds = %28, %21
br label %31
31: ; preds = %36, %30
%32 = load i8*, i8** %9
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 32
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i8*, i8** %9
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %9
br label %31
39: ; preds = %31
%40 = load i8*, i8** %8
%41 = load i8**, i8*** %6
store i8* %40, i8** %41
%42 = load i8*, i8** %9
%43 = load i8**, i8*** %7
store i8* %42, i8** %43
store i32 1, i32* %4
br label %44
44: ; preds = %39, %16
%45 = load i32, i32* %4
ret i32 %45
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"Invalid config line: '%s'\0A\00"
define i32 @ParseString(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 61)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %18
8: ; preds = %3
store i8 0, i8* %4
%9 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 32)
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %8
store i8 0, i8* %9
br label %12
12: ; preds = %11, %8
br label %13
13: ; preds = %12, %13
%14 = phi i8* [ %15, %13 ], [ %4, %12 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 32
br i1 %17, label %13, label %18
18: ; preds = %13, %6
%19 = phi i8* [ null, %6 ], [ %0, %13 ]
%20 = phi i8* [ null, %6 ], [ %15, %13 ]
%21 = phi i32 [ 0, %6 ], [ 1, %13 ]
store i8* %19, i8** %1
store i8* %20, i8** %2
ret i32 %21
}