#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 */
int /*<<< orphan*/ *strchr(char const *, char);
void single_or_double_quote(const char *str, char *ret) {
  ret[1] = '\0';
  if (strchr(str, '\"') != NULL) {
    ret[0] = '\'';
  } else if (strchr(str, '\'') != NULL || strchr(str, '#') != NULL ||
             strchr(str, '\t') != NULL || strchr(str, ' ') != NULL) {
    ret[0] = '\"';
  } else {
    ret[0] = '\0';
  }
}


x86 assembly (clang, -O0):
<single_or_double_quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     114c <single_or_double_quote+0x3c>
mov    -0x10(%rbp),%rax
movb   $0x27,(%rax)
jmp    11c4 <single_or_double_quote+0xb4>
mov    -0x8(%rbp),%rdi
mov    $0x27,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11ac <single_or_double_quote+0x9c>
mov    -0x8(%rbp),%rdi
mov    $0x23,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11ac <single_or_double_quote+0x9c>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11ac <single_or_double_quote+0x9c>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11b8 <single_or_double_quote+0xa8>
mov    -0x10(%rbp),%rax
movb   $0x22,(%rax)
jmp    11bf <single_or_double_quote+0xaf>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11c4 <single_or_double_quote+0xb4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_or_double_quote>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movb   $0x0,0x1(%rsi)
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    $0x27,%bpl
test   %rax,%rax
jne    1183 <single_or_double_quote+0x73>
mov    %rbx,%rdi
mov    $0x27,%esi
call   1030 <strchr@plt>
mov    $0x22,%bpl
test   %rax,%rax
jne    1183 <single_or_double_quote+0x73>
mov    %rbx,%rdi
mov    $0x23,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1183 <single_or_double_quote+0x73>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1183 <single_or_double_quote+0x73>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0x22,%ebp
cmove  %ecx,%ebp
mov    %bpl,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @single_or_double_quote(i8* %0, i8* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 1
store i8 0, i8* %3
%4 = tail call i32* @strchr(i8* %0, i8 signext 34)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = tail call i32* @strchr(i8* %0, i8 signext 39)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = tail call i32* @strchr(i8* %0, i8 signext 35)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = tail call i32* @strchr(i8* %0, i8 signext 9)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = tail call i32* @strchr(i8* %0, i8 signext 32)
%17 = icmp eq i32* %16, null
%18 = select i1 %17, i8 0, i8 34
br label %19
19: ; preds = %15, %6, %9, %12, %2
%20 = phi i8 [ 39, %2 ], [ 34, %12 ], [ 34, %9 ], [ 34, %6 ], [ %18, %15 ]
store i8 %20, i8* %1
ret void
}