#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 */
const char *json_escape_char(char c) {
  switch (c) {
  case '\\':
    return "\\\\";
  case '/':
    return "\\/";
  case '"':
    return "\\\"";
  case '\b':
    return "\\b";
  case '\f':
    return "\\f";
  case '\t':
    return "\\t";
  case '\n':
    return "\\n";
  case '\r':
    return "\\r";
  default:
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<json_escape_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x8,%eax
je     11c6 <json_escape_char+0xc6>
jmp    111f <json_escape_char+0x1f>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     11e6 <json_escape_char+0xe6>
jmp    1130 <json_escape_char+0x30>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     11f6 <json_escape_char+0xf6>
jmp    1141 <json_escape_char+0x41>
mov    -0x10(%rbp),%eax
sub    $0xc,%eax
je     11d6 <json_escape_char+0xd6>
jmp    1152 <json_escape_char+0x52>
mov    -0x10(%rbp),%eax
sub    $0xd,%eax
je     1206 <json_escape_char+0x106>
jmp    1163 <json_escape_char+0x63>
mov    -0x10(%rbp),%eax
sub    $0x22,%eax
je     11b6 <json_escape_char+0xb6>
jmp    1174 <json_escape_char+0x74>
mov    -0x10(%rbp),%eax
sub    $0x2f,%eax
je     11a6 <json_escape_char+0xa6>
jmp    1185 <json_escape_char+0x85>
mov    -0x10(%rbp),%eax
sub    $0x5c,%eax
jne    1216 <json_escape_char+0x116>
jmp    1196 <json_escape_char+0x96>
lea    0xe63(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe56(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe49(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe3c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe2f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe22(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe15(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
lea    0xe08(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <json_escape_char+0x123>
jmp    121b <json_escape_char+0x11b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_escape_char>:
lea    -0x8(%rdi),%eax
cmp    $0x27,%eax
ja     1120 <json_escape_char+0x20>
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf8a(%rip),%rax
ret
cmp    $0x5c,%edi
jne    112d <json_escape_char+0x2d>
lea    0xf74(%rip),%rax
ret
xor    %eax,%eax
ret
lea    0xf78(%rip),%rax
ret
lea    0xf73(%rip),%rax
ret
lea    0xf65(%rip),%rax
ret
lea    0xf66(%rip),%rax
ret
lea    0xf4f(%rip),%rax
ret
lea    0xf44(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\/\00"
@.str.2 = [3 x i8] c"\\\22\00"
@.str.3 = [3 x i8] c"\\b\00"
@.str.4 = [3 x i8] c"\\f\00"
@.str.5 = [3 x i8] c"\\t\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
define i8* @json_escape_char(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 92, label %6
i32 47, label %7
i32 34, label %8
i32 8, label %9
i32 12, label %10
i32 9, label %11
i32 10, label %12
i32 13, label %13
]
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %1
br label %15
15: ; preds = %14
store i8* null, i8** %2
br label %16
16: ; preds = %15, %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\/\00"
@.str.2 = [3 x i8] c"\\\22\00"
@.str.3 = [3 x i8] c"\\b\00"
@.str.4 = [3 x i8] c"\\f\00"
@.str.5 = [3 x i8] c"\\t\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
define i8* @json_escape_char(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %10 [
i32 92, label %11
i32 47, label %3
i32 34, label %4
i32 8, label %5
i32 12, label %6
i32 9, label %7
i32 10, label %8
i32 13, label %9
]
3: ; preds = %1
br label %11
4: ; preds = %1
br label %11
5: ; preds = %1
br label %11
6: ; preds = %1
br label %11
7: ; preds = %1
br label %11
8: ; preds = %1
br label %11
9: ; preds = %1
br label %11
10: ; preds = %1
br label %11
11: ; preds = %1, %10, %9, %8, %7, %6, %5, %4, %3
%12 = phi i8* [ null, %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %12
}