#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 *str_quotefin2(char *s, char q) {
  for (; *s; s++)
    if (*s == '\\')
      s++;
    else if (*s == q)
      return s;
  return NULL;
}


x86 assembly (clang, -O0):
<str_quotefin2>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1177 <str_quotefin2+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    113c <str_quotefin2+0x3c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1161 <str_quotefin2+0x61>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    115c <str_quotefin2+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <str_quotefin2+0x7f>
jmp    1161 <str_quotefin2+0x61>
jmp    1166 <str_quotefin2+0x66>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <str_quotefin2+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_quotefin2>:
mov    %rdi,%rax
jmp    1118 <str_quotefin2+0x18>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x5c,%cl
je     1110 <str_quotefin2+0x10>
test   %cl,%cl
je     112f <str_quotefin2+0x2f>
cmp    %sil,%cl
je     1131 <str_quotefin2+0x31>
add    $0x1,%rax
jmp    1118 <str_quotefin2+0x18>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @str_quotefin2(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %10, %2
%4 = phi i8* [ %0, %2 ], [ %12, %10 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %13
i8 92, label %6
]
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
br label %10
8: ; preds = %3
%9 = icmp eq i8 %5, %1
br i1 %9, label %13, label %10
10: ; preds = %6, %8
%11 = phi i8* [ %7, %6 ], [ %4, %8 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
br label %3
13: ; preds = %3, %8
%14 = phi i8* [ %4, %8 ], [ null, %3 ]
ret i8* %14
}