#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*/ putcharacter(char);
void printslashstring(unsigned char *s) {
  int d;
  putcharacter('"');
  for (; *s; s++) {
    if (*s == 0xff || *s == '"' || *s < ' ' || *s == '\\') {
      putcharacter('\\');
      switch (*s) {
      case '"':
        putcharacter('"');
        break;
      case '\n':
        putcharacter('n');
        break;
      case '\t':
        putcharacter('t');
        break;
      case '\r':
        putcharacter('r');
        break;
      case '\\':
        putcharacter('\\');
        break;
      default:
        putcharacter('x');
        d = *s / 16;
        putcharacter(d < 10 ? d + '0' : d - 10 + 'A');
        d = *s % 16;
        putcharacter(d < 10 ? d + '0' : d - 10 + 'A');
        break;
      }
    } else {
      putcharacter(*s);
    }
  }
  putcharacter('"');
}


x86 assembly (clang, -O0):
<printslashstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x22,%edi
call   1030 <putcharacter@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     12d9 <printslashstring+0x1c9>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xff,%eax
je     1175 <printslashstring+0x65>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x22,%eax
je     1175 <printslashstring+0x65>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
jl     1175 <printslashstring+0x65>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5c,%eax
jne    12b7 <printslashstring+0x1a7>
mov    $0x5c,%edi
call   1030 <putcharacter@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x10(%rbp)
sub    $0x9,%eax
je     11f9 <printslashstring+0xe9>
jmp    1197 <printslashstring+0x87>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     11ea <printslashstring+0xda>
jmp    11a8 <printslashstring+0x98>
mov    -0x10(%rbp),%eax
sub    $0xd,%eax
je     1208 <printslashstring+0xf8>
jmp    11b9 <printslashstring+0xa9>
mov    -0x10(%rbp),%eax
sub    $0x22,%eax
je     11db <printslashstring+0xcb>
jmp    11ca <printslashstring+0xba>
mov    -0x10(%rbp),%eax
sub    $0x5c,%eax
je     1217 <printslashstring+0x107>
jmp    1226 <printslashstring+0x116>
mov    $0x22,%edi
call   1030 <putcharacter@plt>
jmp    12b2 <printslashstring+0x1a2>
mov    $0x6e,%edi
call   1030 <putcharacter@plt>
jmp    12b2 <printslashstring+0x1a2>
mov    $0x74,%edi
call   1030 <putcharacter@plt>
jmp    12b2 <printslashstring+0x1a2>
mov    $0x72,%edi
call   1030 <putcharacter@plt>
jmp    12b2 <printslashstring+0x1a2>
mov    $0x5c,%edi
call   1030 <putcharacter@plt>
jmp    12b2 <printslashstring+0x1a2>
mov    $0x78,%edi
call   1030 <putcharacter@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    125a <printslashstring+0x14a>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x14(%rbp)
jmp    1266 <printslashstring+0x156>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movsbl %al,%edi
call   1030 <putcharacter@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    129b <printslashstring+0x18b>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x18(%rbp)
jmp    12a7 <printslashstring+0x197>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movsbl %al,%edi
call   1030 <putcharacter@plt>
jmp    12c3 <printslashstring+0x1b3>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putcharacter@plt>
jmp    12c8 <printslashstring+0x1b8>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1126 <printslashstring+0x16>
mov    $0x22,%edi
call   1030 <putcharacter@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printslashstring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x22,%edi
call   1030 <putcharacter@plt>
lea    0xed8(%rip),%r14
jmp    117c <printslashstring+0x6c>
mov    $0x78,%edi
call   1030 <putcharacter@plt>
movzbl (%rbx),%eax
mov    %eax,%ecx
shr    $0x4,%cl
lea    0x30(%rcx),%edx
add    $0x37,%cl
cmp    $0xa0,%al
movzbl %dl,%eax
movzbl %cl,%ecx
cmovb  %eax,%ecx
movzbl %cl,%edi
call   1030 <putcharacter@plt>
movzbl (%rbx),%eax
and    $0xf,%al
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edx
cmp    $0xa,%al
movzbl %cl,%ecx
movzbl %dl,%eax
cmovb  %ecx,%eax
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putcharacter@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0xff,%al
je     11a0 <printslashstring+0x90>
cmp    $0x22,%al
je     11a0 <printslashstring+0x90>
test   %al,%al
je     11e4 <printslashstring+0xd4>
cmp    $0x20,%al
jb     11a0 <printslashstring+0x90>
cmp    $0x5c,%al
jne    1170 <printslashstring+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x5c,%edi
call   1030 <putcharacter@plt>
movzbl (%rbx),%eax
lea    -0x9(%rax),%ecx
cmp    $0x19,%cl
ja     11d0 <printslashstring+0xc0>
movzbl %cl,%ecx
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
mov    $0x74,%al
jmp    1170 <printslashstring+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x5c,%al
jne    112a <printslashstring+0x1a>
mov    $0x5c,%al
jmp    1170 <printslashstring+0x60>
mov    $0x6e,%al
jmp    1170 <printslashstring+0x60>
mov    $0x72,%al
jmp    1170 <printslashstring+0x60>
mov    $0x22,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putcharacter@plt>

LLVM IR (-O0):
define void @printslashstring(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @putcharacter(i8 signext 34)
br label %5
5: ; preds = %86, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %89
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 255
br i1 %13, label %29, label %14
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = icmp eq i32 %17, 34
br i1 %18, label %29, label %19
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = icmp slt i32 %22, 32
br i1 %23, label %29, label %24
24: ; preds = %19
%25 = load i8*, i8** %2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = icmp eq i32 %27, 92
br i1 %28, label %29, label %81
29: ; preds = %24, %19, %14, %9
%30 = call i32 @putcharacter(i8 signext 92)
%31 = load i8*, i8** %2
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
switch i32 %33, label %44 [
i32 34, label %34
i32 10, label %36
i32 9, label %38
i32 13, label %40
i32 92, label %42
]
34: ; preds = %29
%35 = call i32 @putcharacter(i8 signext 34)
br label %80
36: ; preds = %29
%37 = call i32 @putcharacter(i8 signext 110)
br label %80
38: ; preds = %29
%39 = call i32 @putcharacter(i8 signext 116)
br label %80
40: ; preds = %29
%41 = call i32 @putcharacter(i8 signext 114)
br label %80
42: ; preds = %29
%43 = call i32 @putcharacter(i8 signext 92)
br label %80
44: ; preds = %29
%45 = call i32 @putcharacter(i8 signext 120)
%46 = load i8*, i8** %2
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = sdiv i32 %48, 16
store i32 %49, i32* %3
%50 = load i32, i32* %3
%51 = icmp slt i32 %50, 10
br i1 %51, label %52, label %55
52: ; preds = %44
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 48
br label %59
55: ; preds = %44
%56 = load i32, i32* %3
%57 = sub nsw i32 %56, 10
%58 = add nsw i32 %57, 65
br label %59
59: ; preds = %55, %52
%60 = phi i32 [ %54, %52 ], [ %58, %55 ]
%61 = trunc i32 %60 to i8
%62 = call i32 @putcharacter(i8 signext %61)
%63 = load i8*, i8** %2
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = srem i32 %65, 16
store i32 %66, i32* %3
%67 = load i32, i32* %3
%68 = icmp slt i32 %67, 10
br i1 %68, label %69, label %72
69: ; preds = %59
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 48
br label %76
72: ; preds = %59
%73 = load i32, i32* %3
%74 = sub nsw i32 %73, 10
%75 = add nsw i32 %74, 65
br label %76
76: ; preds = %72, %69
%77 = phi i32 [ %71, %69 ], [ %75, %72 ]
%78 = trunc i32 %77 to i8
%79 = call i32 @putcharacter(i8 signext %78)
br label %80
80: ; preds = %76, %42, %40, %38, %36, %34
br label %85
81: ; preds = %24
%82 = load i8*, i8** %2
%83 = load i8, i8* %82
%84 = call i32 @putcharacter(i8 signext %83)
br label %85
85: ; preds = %81, %80
br label %86
86: ; preds = %85
%87 = load i8*, i8** %2
%88 = getelementptr inbounds i8, i8* %87, i32 1
store i8* %88, i8** %2
br label %5
89: ; preds = %5
%90 = call i32 @putcharacter(i8 signext 34)
ret void
}

LLVM IR (-O2):
define void @printslashstring(i8* nocapture %0) {
%2 = tail call i32 @putcharacter(i8 signext 34)
br label %3
3: ; preds = %32, %1
%4 = phi i8* [ %0, %1 ], [ %35, %32 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %36
i8 -1, label %10
i8 34, label %10
]
6: ; preds = %3
%7 = icmp ult i8 %5, 32
%8 = icmp eq i8 %5, 92
%9 = or i1 %7, %8
br i1 %9, label %10, label %32
10: ; preds = %3, %3, %6
%11 = tail call i32 @putcharacter(i8 signext 92)
%12 = load i8, i8* %4
switch i8 %12, label %17 [
i8 34, label %32
i8 10, label %13
i8 9, label %14
i8 13, label %15
i8 92, label %16
]
13: ; preds = %10
br label %32
14: ; preds = %10
br label %32
15: ; preds = %10
br label %32
16: ; preds = %10
br label %32
17: ; preds = %10
%18 = tail call i32 @putcharacter(i8 signext 120)
%19 = load i8, i8* %4
%20 = lshr i8 %19, 4
%21 = icmp ult i8 %19, -96
%22 = or i8 %20, 48
%23 = add nuw nsw i8 %20, 55
%24 = select i1 %21, i8 %22, i8 %23
%25 = tail call i32 @putcharacter(i8 signext %24)
%26 = load i8, i8* %4
%27 = and i8 %26, 15
%28 = icmp ult i8 %27, 10
%29 = or i8 %27, 48
%30 = add nuw nsw i8 %27, 55
%31 = select i1 %28, i8 %29, i8 %30
br label %32
32: ; preds = %6, %10, %17, %16, %15, %14, %13
%33 = phi i8 [ %31, %17 ], [ 92, %16 ], [ 114, %15 ], [ 116, %14 ], [ 110, %13 ], [ %12, %10 ], [ %5, %6 ]
%34 = tail call i32 @putcharacter(i8 signext %33)
%35 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
36: ; preds = %3
%37 = tail call i32 @putcharacter(i8 signext 34)
ret void
}