#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 */
scalar_t__ strchr(char *, char);
int quote(char c) {
  if (c && strchr("\"", c))
    return 2;
  if (c && strchr("'", c))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
je     1151 <quote+0x41>
lea    0xece(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1151 <quote+0x41>
movl   $0x2,-0x4(%rbp)
jmp    118b <quote+0x7b>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
je     1184 <quote+0x74>
lea    0xe9d(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1184 <quote+0x74>
movl   $0x1,-0x4(%rbp)
jmp    118b <quote+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quote>:
push   %rbx
test   %dil,%dil
je     1152 <quote+0x42>
movsbl %dil,%ebx
lea    0xedf(%rip),%rdi
mov    %ebx,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     1137 <quote+0x27>
pop    %rbx
ret
lea    0xec4(%rip),%rdi
mov    %ebx,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1135 <quote+0x25>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c"'\00"
define i32 @quote(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 2, i32* %2
br label %22
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %2
br label %22
21: ; preds = %16, %12
store i32 0, i32* %2
br label %22
22: ; preds = %21, %20, %11
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c"'\00"
define i32 @quote(i8 signext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8 signext %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1, %6
br label %10
10: ; preds = %6, %3, %9
%11 = phi i32 [ 0, %9 ], [ 2, %3 ], [ 1, %6 ]
ret i32 %11
}