#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 *strchr(char *, char);
char *vqec_config_find_quote_or_backslash(char *str) {
  char *idx_q, *idx_s, *idx;
  idx_q = strchr(str, '\"');
  idx_s = strchr(str, '\\');
  idx = (char *)(-1);
  if (idx_s && idx_s < idx) {
    idx = idx_s;
  }
  if (idx_q && idx_q < idx) {
    idx = idx_q;
  }
  if (idx == (char *)(-1)) {
    idx = NULL;
  }
  return (idx);
}


x86 assembly (clang, -O0):
<vqec_config_find_quote_or_backslash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116c <vqec_config_find_quote_or_backslash+0x5c>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    116c <vqec_config_find_quote_or_backslash+0x5c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118d <vqec_config_find_quote_or_backslash+0x7d>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    118d <vqec_config_find_quote_or_backslash+0x7d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x20(%rbp)
jne    11a6 <vqec_config_find_quote_or_backslash+0x96>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vqec_config_find_quote_or_backslash>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1030 <strchr@plt>
mov    $0xffffffffffffffff,%rcx
lea    0x1(%rax),%rdx
cmp    $0x2,%rdx
jb     1145 <vqec_config_find_quote_or_backslash+0x35>
mov    %rax,%rcx
cmp    %rcx,%r14
mov    %rcx,%rdx
cmovb  %r14,%rdx
test   %r14,%r14
cmove  %rcx,%rdx
xor    %eax,%eax
cmp    $0xffffffffffffffff,%rdx
cmovne %rdx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @vqec_config_find_quote_or_backslash(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 34)
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 92)
%4 = ptrtoint i8* %3 to i64
switch i64 %4, label %5 [
i64 0, label %6
i64 -1, label %6
]
5: ; preds = %1
br label %6
6: ; preds = %1, %1, %5
%7 = phi i8* [ %3, %5 ], [ inttoptr (i64 -1 to i8*), %1 ], [ inttoptr (i64 -1 to i8*), %1 ]
%8 = icmp ne i8* %2, null
%9 = icmp ult i8* %2, %7
%10 = select i1 %8, i1 %9, i1 false
%11 = select i1 %10, i8* %2, i8* %7
%12 = icmp eq i8* %11, inttoptr (i64 -1 to i8*)
%13 = select i1 %12, i8* null, i8* %11
ret i8* %13
}