#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 *find_name_end(char *);
char *find_value_end(char *);
char *skip_space(char *);
void parse_line(char *ptr, char **varname, char **varval) {
  ptr = skip_space(ptr);
  *varname = skip_space(ptr);
  *varval = NULL;
  ptr = find_name_end(ptr);
  if (*ptr && *ptr != '=') {
    *ptr = '\0';
    ptr = skip_space(ptr + 1);
  }
  if (*ptr == '=') {
    *ptr = '\0';
    ptr = skip_space(ptr + 1);
    if (*ptr) {
      *varval = ptr;
      ptr = find_value_end(ptr);
      *ptr = '\0';
    }
  }
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_space@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_space@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <find_name_end@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b4 <parse_line+0x84>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     11b4 <parse_line+0x84>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <skip_space@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    120d <parse_line+0xdd>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <skip_space@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1208 <parse_line+0xd8>
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1050 <find_value_end@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    120d <parse_line+0xdd>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1030 <skip_space@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <skip_space@plt>
mov    %rax,(%r15)
movq   $0x0,(%r14)
mov    %rbx,%rdi
call   1040 <find_name_end@plt>
mov    (%rax),%cl
test   %cl,%cl
je     1179 <parse_line+0x49>
cmp    $0x3d,%cl
je     1179 <parse_line+0x49>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    %rax,%rdi
call   1030 <skip_space@plt>
mov    (%rax),%cl
cmp    $0x3d,%cl
jne    11a0 <parse_line+0x70>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    %rax,%rdi
call   1030 <skip_space@plt>
cmpb   $0x0,(%rax)
je     11a0 <parse_line+0x70>
mov    %rax,(%r14)
mov    %rax,%rdi
call   1050 <find_value_end@plt>
movb   $0x0,(%rax)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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