const char *skipcomment(start) const char *start;
{
  for (;;)
    switch (*++start) {
    case '\0':
      start--;
    case ')':
      return start;
    case '\\':
      start++;
      break;
    case '(':
      start = skipcomment(start);
    }
}


x86 assembly (clang, -O0):
<skipcomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1172 <skipcomment+0x62>
jmp    113f <skipcomment+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x28,%eax
je     1199 <skipcomment+0x89>
jmp    1150 <skipcomment+0x40>
mov    -0xc(%rbp),%eax
sub    $0x29,%eax
je     117e <skipcomment+0x6e>
jmp    1161 <skipcomment+0x51>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     1188 <skipcomment+0x78>
jmp    11a6 <skipcomment+0x96>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <skipcomment+0x96>
mov    -0x8(%rbp),%rdi
call   1030 <skipcomment@plt>
mov    %rax,-0x8(%rbp)
jmp    111c <skipcomment+0xc>

x86 assembly (clang, -O2):
<skipcomment>:
push   %rax
mov    %rdi,%rax
jmp    112a <skipcomment+0x1a>
cs nopw 0x0(%rax,%rax,1)
jne    1148 <skipcomment+0x38>
mov    %rax,%rdi
call   1030 <skipcomment@plt>
mov    %rax,%rcx
add    $0x1,%rax
movsbl 0x1(%rcx),%edx
cmp    $0x28,%edx
jle    1120 <skipcomment+0x10>
cmp    $0x5c,%edx
jne    114e <skipcomment+0x3e>
add    $0x2,%rcx
mov    %rcx,%rax
jmp    112a <skipcomment+0x1a>
test   %edx,%edx
jne    112a <skipcomment+0x1a>
jmp    1155 <skipcomment+0x45>
cmp    $0x29,%edx
jne    112a <skipcomment+0x1a>
pop    %rcx
ret
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @skipcomment(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %19, %1
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i32 1
store i8* %5, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %19 [
i32 0, label %8
i32 41, label %11
i32 92, label %13
i32 40, label %16
]
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 -1
store i8* %10, i8** %2
br label %11
11: ; preds = %3, %8
%12 = load i8*, i8** %2
ret i8* %12
13: ; preds = %3
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %2
br label %19
16: ; preds = %3
%17 = load i8*, i8** %2
%18 = call i8* @skipcomment(i8* %17)
store i8* %18, i8** %2
br label %19
19: ; preds = %16, %3, %13
br label %3
}

LLVM IR (-O2):
define i8* @skipcomment(i8* %0) {
br label %2
2: ; preds = %14, %1
%3 = phi i8* [ %0, %1 ], [ %15, %14 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %14 [
i32 0, label %8
i32 41, label %7
i32 92, label %10
i32 40, label %12
]
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i8* [ %4, %7 ], [ %3, %2 ]
ret i8* %9
10: ; preds = %2
%11 = getelementptr inbounds i8, i8* %3, i64 2
br label %14
12: ; preds = %2
%13 = tail call i8* @skipcomment(i8* %4)
br label %14
14: ; preds = %12, %2, %10
%15 = phi i8* [ %4, %2 ], [ %13, %12 ], [ %11, %10 ]
br label %2
}