char *dwarf_find_macro_value_start(char *str) {
  char *lcp;
  int funclike = 0;
  for (lcp = str; *lcp; ++lcp) {
    switch (*lcp) {
    case '(':
      funclike = 1;
      break;
    case ')':
      return lcp + 2;
    case ' ':
      if (!funclike) {
        return lcp + 1;
      }
      break;
    }
  }
  return lcp;
}


x86 assembly (clang, -O0):
<dwarf_find_macro_value_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b1 <dwarf_find_macro_value_start+0xb1>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x20,%eax
je     117b <dwarf_find_macro_value_start+0x7b>
jmp    113c <dwarf_find_macro_value_start+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x28,%eax
je     115e <dwarf_find_macro_value_start+0x5e>
jmp    114d <dwarf_find_macro_value_start+0x4d>
mov    -0x20(%rbp),%eax
sub    $0x29,%eax
je     116a <dwarf_find_macro_value_start+0x6a>
jmp    119b <dwarf_find_macro_value_start+0x9b>
movl   $0x1,-0x1c(%rbp)
jmp    119b <dwarf_find_macro_value_start+0x9b>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <dwarf_find_macro_value_start+0xb9>
cmpl   $0x0,-0x1c(%rbp)
jne    1196 <dwarf_find_macro_value_start+0x96>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <dwarf_find_macro_value_start+0xb9>
jmp    119b <dwarf_find_macro_value_start+0x9b>
jmp    11a0 <dwarf_find_macro_value_start+0xa0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <dwarf_find_macro_value_start+0x17>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dwarf_find_macro_value_start>:
mov    %rdi,%rax
mov    (%rdi),%dl
test   %dl,%dl
je     1159 <dwarf_find_macro_value_start+0x59>
add    $0x1,%rax
xor    %ecx,%ecx
jmp    1130 <dwarf_find_macro_value_start+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ecx
movzbl (%rax),%edx
add    $0x1,%rax
test   %dl,%dl
je     115a <dwarf_find_macro_value_start+0x5a>
movsbl %dl,%edx
cmp    $0x20,%edx
je     1150 <dwarf_find_macro_value_start+0x50>
cmp    $0x28,%edx
je     1120 <dwarf_find_macro_value_start+0x20>
cmp    $0x29,%edx
jne    1125 <dwarf_find_macro_value_start+0x25>
jmp    115f <dwarf_find_macro_value_start+0x5f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %ecx,%ecx
mov    $0x1,%ecx
jne    1125 <dwarf_find_macro_value_start+0x25>
ret
add    $0xffffffffffffffff,%rax
ret
add    $0x1,%rax
ret

LLVM IR (-O0):
define i8* @dwarf_find_macro_value_start(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %5
%6 = load i8*, i8** %3
store i8* %6, i8** %4
br label %7
7: ; preds = %27, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %26 [
i32 40, label %15
i32 41, label %16
i32 32, label %19
]
15: ; preds = %11
store i32 1, i32* %5
br label %26
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 2
store i8* %18, i8** %2
br label %32
19: ; preds = %11
%20 = load i32, i32* %5
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8* %24, i8** %2
br label %32
25: ; preds = %19
br label %26
26: ; preds = %11, %25, %15
br label %27
27: ; preds = %26
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
br label %7
30: ; preds = %7
%31 = load i8*, i8** %4
store i8* %31, i8** %2
br label %32
32: ; preds = %30, %22, %16
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
define i8* @dwarf_find_macro_value_start(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %16
%5 = phi i8 [ %19, %16 ], [ %2, %1 ]
%6 = phi i32 [ %17, %16 ], [ 0, %1 ]
%7 = phi i8* [ %18, %16 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
switch i32 %8, label %16 [
i32 40, label %9
i32 41, label %10
i32 32, label %12
]
9: ; preds = %4
br label %16
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %7, i64 2
br label %21
12: ; preds = %4
%13 = icmp eq i32 %6, 0
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = getelementptr inbounds i8, i8* %7, i64 1
br label %21
16: ; preds = %9, %4, %12
%17 = phi i32 [ %6, %4 ], [ 1, %12 ], [ 1, %9 ]
%18 = getelementptr inbounds i8, i8* %7, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %4
21: ; preds = %16, %1, %14, %10
%22 = phi i8* [ %15, %14 ], [ %11, %10 ], [ %0, %1 ], [ %18, %16 ]
ret i8* %22
}