#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 *skipb(char *);
char *quote(char *p) {
  static char buffer[1024];
  char *q = &buffer[0];
  p = skipb(p);
  while (*p != '\0') {
    switch (*p) {
    case '\'':
      *q++ = '\\';
      *q++ = '0';
      *q++ = '4';
      *q++ = '7';
      p++;
      break;
    default:
      *q++ = *p++;
      break;
    }
  }
  *q = '\0';
  return &buffer[0];
}


x86 assembly (clang, -O0):
<quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skipb@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d7 <quote+0xc7>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
sub    $0x27,%al
jne    11b0 <quote+0xa0>
jmp    1157 <quote+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x30,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x34,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x37,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d2 <quote+0xc2>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1134 <quote+0x24>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e5b(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quote>:
push   %rax
call   1030 <skipb@plt>
lea    0x2f23(%rip),%rcx
jmp    112e <quote+0x1e>
nop
movl   $0x3734305c,(%rcx)
add    $0x4,%rcx
add    $0x1,%rax
movzbl (%rax),%edx
cmp    $0x27,%dl
je     1120 <quote+0x10>
test   %dl,%dl
je     1146 <quote+0x36>
mov    %dl,(%rcx)
add    $0x1,%rcx
add    $0x1,%rax
jmp    112e <quote+0x1e>
movb   $0x0,(%rcx)
lea    0x2ef0(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@quote.buffer = internal global [1024 x i8] zeroinitializer
define i8* @quote(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @quote.buffer, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = call i8* @skipb(i8* %4)
store i8* %5, i8** %2
br label %6
6: ; preds = %32, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %26 [
i32 39, label %15
]
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
store i8 92, i8* %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
store i8 48, i8* %18
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
store i8 52, i8* %20
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
store i8 55, i8* %22
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
br label %32
26: ; preds = %11
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %2
%29 = load i8, i8* %27
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
store i8 %29, i8* %30
br label %32
32: ; preds = %26, %15
br label %6
33: ; preds = %6
%34 = load i8*, i8** %3
store i8 0, i8* %34
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @quote.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@quote.buffer = internal global [1024 x i8] zeroinitializer
define i8* @quote(i8* %0) {
%2 = tail call i8* @skipb(i8* %0)
br label %3
3: ; preds = %14, %1
%4 = phi i8* [ %2, %1 ], [ %16, %14 ]
%5 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @quote.buffer, i64 0, i64 0), %1 ], [ %15, %14 ]
%6 = load i8, i8* %4
switch i8 %6, label %12 [
i8 0, label %17
i8 39, label %7
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 92, i8* %5
%9 = getelementptr inbounds i8, i8* %5, i64 2
store i8 48, i8* %8
%10 = getelementptr inbounds i8, i8* %5, i64 3
store i8 52, i8* %9
%11 = getelementptr inbounds i8, i8* %5, i64 4
store i8 55, i8* %10
br label %14
12: ; preds = %3
%13 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %6, i8* %5
br label %14
14: ; preds = %12, %7
%15 = phi i8* [ %11, %7 ], [ %13, %12 ]
%16 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
17: ; preds = %3
store i8 0, i8* %5
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @quote.buffer, i64 0, i64 0)
}