#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(unsigned char const, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ strpbrk(char *, char *);
void print_special(const unsigned char *s, char *special, FILE *out) {
  int simple = *s != 0 && special && !strpbrk((char *)s, special);
  if (simple) {
    fputs((char *)s, out);
  } else {
    fputc('"', out);
    for (; *s; s++) {
      if (*s == '"')
        fputc('"', out);
      fputc(*s, out);
    }
    fputc('"', out);
  }
}


x86 assembly (clang, -O0):
<print_special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     1181 <print_special+0x51>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1d(%rbp)
je     1181 <print_special+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strpbrk@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11a8 <print_special+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fputs@plt>
jmp    1212 <print_special+0xe2>
mov    -0x18(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1204 <print_special+0xd4>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x22,%eax
jne    11e1 <print_special+0xb1>
mov    -0x18(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11b6 <print_special+0x86>
mov    -0x18(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_special>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
test   %rsi,%rsi
je     1150 <print_special+0x20>
cmpb   $0x0,(%rbx)
je     1150 <print_special+0x20>
mov    %rbx,%rdi
call   1050 <strpbrk@plt>
test   %eax,%eax
je     119e <print_special+0x6e>
mov    $0x22,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
jmp    117f <print_special+0x4f>
nop
mov    $0x22,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
movzbl (%rbx),%eax
movzbl %al,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x22,%al
je     1160 <print_special+0x30>
test   %al,%al
jne    1170 <print_special+0x40>
mov    $0x22,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fputc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputs@plt>

LLVM IR (-O0):
define void @print_special(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 @strpbrk(i8* %16, i8* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br label %21
21: ; preds = %15, %12, %3
%22 = phi i1 [ false, %12 ], [ false, %3 ], [ %20, %15 ]
%23 = zext i1 %22 to i32
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load i8*, i8** %4
%28 = load i32*, i32** %6
%29 = call i32 @fputs(i8* %27, i32* %28)
br label %56
30: ; preds = %21
%31 = load i32*, i32** %6
%32 = call i32 @fputc(i8 zeroext 34, i32* %31)
br label %33
33: ; preds = %50, %30
%34 = load i8*, i8** %4
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %53
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = icmp eq i32 %40, 34
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load i32*, i32** %6
%44 = call i32 @fputc(i8 zeroext 34, i32* %43)
br label %45
45: ; preds = %42, %37
%46 = load i8*, i8** %4
%47 = load i8, i8* %46
%48 = load i32*, i32** %6
%49 = call i32 @fputc(i8 zeroext %47, i32* %48)
br label %50
50: ; preds = %45
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %4
br label %33
53: ; preds = %33
%54 = load i32*, i32** %6
%55 = call i32 @fputc(i8 zeroext 34, i32* %54)
br label %56
56: ; preds = %53, %26
ret void
}

LLVM IR (-O2):
define void @print_special(i8* %0, i8* %1, i32* nocapture %2) {
%4 = load i8, i8* %0
%5 = icmp ne i8 %4, 0
%6 = icmp ne i8* %1, null
%7 = and i1 %6, %5
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = tail call i32 @strpbrk(i8* %0, i8* %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @fputs(i8* %0, i32* %2)
br label %27
13: ; preds = %3, %8
%14 = tail call i32 @fputc(i8 zeroext 34, i32* %2)
br label %15
15: ; preds = %21, %13
%16 = phi i8* [ %0, %13 ], [ %24, %21 ]
%17 = load i8, i8* %16
switch i8 %17, label %21 [
i8 0, label %25
i8 34, label %18
]
18: ; preds = %15
%19 = tail call i32 @fputc(i8 zeroext 34, i32* %2)
%20 = load i8, i8* %16
br label %21
21: ; preds = %15, %18
%22 = phi i8 [ %17, %15 ], [ %20, %18 ]
%23 = tail call i32 @fputc(i8 zeroext %22, i32* %2)
%24 = getelementptr inbounds i8, i8* %16, i64 1
br label %15
25: ; preds = %15
%26 = tail call i32 @fputc(i8 zeroext 34, i32* %2)
br label %27
27: ; preds = %25, %11
ret void
}