#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*/ OUTBYTE(char);
int /*<<< orphan*/ instruction_error(char *, ...);
void OUTSTRING(char *string) {
  int stringt;
  int esc = 0;
  if (*string == '"')
    stringt = 0;
  else if (*string == '\'')
    stringt = 1;
  else
    instruction_error("OUTSTRING <INTERNAL ERROR>. Not a string!");
  string++;
  while (*string) {
    if (*string == '"') {
      if (stringt == 0 && !esc)
        break;
      OUTBYTE('"');
      esc = 0;
    } else if (*string == '\'') {
      if (stringt == 1 && !esc)
        break;
      OUTBYTE('\'');
      esc = 0;
    } else if (*string == 'n') {
      if (esc)
        OUTBYTE('\n');
      else
        OUTBYTE('n');
      esc = 0;
    } else if (*string == 't') {
      if (esc)
        OUTBYTE('\t');
      else
        OUTBYTE('t');
      esc = 0;
    } else if (*string == 'r') {
      if (esc)
        OUTBYTE('\r');
      else
        OUTBYTE('r');
      esc = 0;
    } else if (*string == '\\') {
      if (esc) {
        OUTBYTE('\\');
        esc = 0;
      } else
        esc = 1;
    } else {
      if (esc)
        instruction_error("Invalid escape sequence \\%c in string", *string);
      OUTBYTE(*string);
    }
    string++;
  }
}


x86 assembly (clang, -O0):
<OUTSTRING>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    114f <OUTSTRING+0x2f>
movl   $0x0,-0xc(%rbp)
jmp    117e <OUTSTRING+0x5e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    116b <OUTSTRING+0x4b>
movl   $0x1,-0xc(%rbp)
jmp    1179 <OUTSTRING+0x59>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <instruction_error@plt>
jmp    117e <OUTSTRING+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1363 <OUTSTRING+0x243>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11d6 <OUTSTRING+0xb6>
cmpl   $0x0,-0xc(%rbp)
jne    11c0 <OUTSTRING+0xa0>
cmpl   $0x0,-0x10(%rbp)
jne    11c0 <OUTSTRING+0xa0>
jmp    1363 <OUTSTRING+0x243>
mov    $0x22,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    1352 <OUTSTRING+0x232>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    1215 <OUTSTRING+0xf5>
cmpl   $0x1,-0xc(%rbp)
jne    11ff <OUTSTRING+0xdf>
cmpl   $0x0,-0x10(%rbp)
jne    11ff <OUTSTRING+0xdf>
jmp    1363 <OUTSTRING+0x243>
mov    $0x27,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    134d <OUTSTRING+0x22d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
jne    1254 <OUTSTRING+0x134>
cmpl   $0x0,-0x10(%rbp)
je     123e <OUTSTRING+0x11e>
mov    $0xa,%edi
call   1030 <OUTBYTE@plt>
jmp    1248 <OUTSTRING+0x128>
mov    $0x6e,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    1348 <OUTSTRING+0x228>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
jne    1293 <OUTSTRING+0x173>
cmpl   $0x0,-0x10(%rbp)
je     127d <OUTSTRING+0x15d>
mov    $0x9,%edi
call   1030 <OUTBYTE@plt>
jmp    1287 <OUTSTRING+0x167>
mov    $0x74,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    1343 <OUTSTRING+0x223>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x72,%eax
jne    12d2 <OUTSTRING+0x1b2>
cmpl   $0x0,-0x10(%rbp)
je     12bc <OUTSTRING+0x19c>
mov    $0xd,%edi
call   1030 <OUTBYTE@plt>
jmp    12c6 <OUTSTRING+0x1a6>
mov    $0x72,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    133e <OUTSTRING+0x21e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    130e <OUTSTRING+0x1ee>
cmpl   $0x0,-0x10(%rbp)
je     1302 <OUTSTRING+0x1e2>
mov    $0x5c,%edi
call   1030 <OUTBYTE@plt>
movl   $0x0,-0x10(%rbp)
jmp    1309 <OUTSTRING+0x1e9>
movl   $0x1,-0x10(%rbp)
jmp    1339 <OUTSTRING+0x219>
cmpl   $0x0,-0x10(%rbp)
je     132d <OUTSTRING+0x20d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1040 <instruction_error@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <OUTBYTE@plt>
jmp    133e <OUTSTRING+0x21e>
jmp    1343 <OUTSTRING+0x223>
jmp    1348 <OUTSTRING+0x228>
jmp    134d <OUTSTRING+0x22d>
jmp    1352 <OUTSTRING+0x232>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    118a <OUTSTRING+0x6a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OUTSTRING>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x22,%al
je     1140 <OUTSTRING+0x20>
cmp    $0x27,%al
jne    1148 <OUTSTRING+0x28>
mov    $0x1,%r12b
xor    %r15d,%r15d
jmp    1156 <OUTSTRING+0x36>
mov    $0x1,%r15b
xor    %r12d,%r12d
jmp    1156 <OUTSTRING+0x36>
lea    0xf15(%rip),%rdi
xor    %eax,%eax
call   1040 <instruction_error@plt>
mov    0x1(%rbx),%al
test   %al,%al
je     1261 <OUTSTRING+0x141>
add    $0x2,%rbx
lea    0xe94(%rip),%rbp
mov    $0x74,%r13d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x5c(%rax),%ecx
cmp    $0x18,%cl
ja     11b0 <OUTSTRING+0x90>
movzbl %cl,%ecx
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
test   %r14d,%r14d
je     1259 <OUTSTRING+0x139>
xor    %r14d,%r14d
mov    $0x5c,%al
jmp    1240 <OUTSTRING+0x120>
nopl   0x0(%rax,%rax,1)
cmp    $0x27,%al
je     1221 <OUTSTRING+0x101>
cmp    $0x22,%al
jne    11d0 <OUTSTRING+0xb0>
test   %r14d,%r14d
setne  %al
or     %r12b,%al
test   $0x1,%al
je     1261 <OUTSTRING+0x141>
xor    %r14d,%r14d
mov    $0x22,%al
jmp    1240 <OUTSTRING+0x120>
test   %r14d,%r14d
je     1240 <OUTSTRING+0x120>
movsbl %al,%esi
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <instruction_error@plt>
movzbl -0x1(%rbx),%eax
jmp    1240 <OUTSTRING+0x120>
test   %r14d,%r14d
mov    $0xa,%eax
mov    $0x6e,%ecx
jmp    1208 <OUTSTRING+0xe8>
test   %r14d,%r14d
mov    $0xd,%eax
mov    $0x72,%ecx
cmove  %ecx,%eax
xor    %r14d,%r14d
jmp    1240 <OUTSTRING+0x120>
test   %r14d,%r14d
mov    $0x9,%eax
cmove  %r13d,%eax
xor    %r14d,%r14d
jmp    1240 <OUTSTRING+0x120>
test   %r14d,%r14d
setne  %al
or     %r15b,%al
test   $0x1,%al
je     1261 <OUTSTRING+0x141>
xor    %r14d,%r14d
mov    $0x27,%al
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <OUTBYTE@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1180 <OUTSTRING+0x60>
jmp    1261 <OUTSTRING+0x141>
mov    $0x1,%r14d
jmp    1248 <OUTSTRING+0x128>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"OUTSTRING <INTERNAL ERROR>. Not a string!\00"
@.str.1 = [38 x i8] c"Invalid escape sequence \\%c in string\00"
define void @OUTSTRING(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 34
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %3
br label %19
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 39
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 1, i32* %3
br label %18
16: ; preds = %10
%17 = call i32 (i8*, ...) @instruction_error(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %15
br label %19
19: ; preds = %18, %9
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
br label %22
22: ; preds = %122, %19
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %125
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 34
br i1 %30, label %31, label %40
31: ; preds = %26
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %34
br label %125
38: ; preds = %34, %31
%39 = call i32 @OUTBYTE(i8 signext 34)
store i32 0, i32* %4
br label %122
40: ; preds = %26
%41 = load i8*, i8** %2
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 39
br i1 %44, label %45, label %54
45: ; preds = %40
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* %4
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %48
br label %125
52: ; preds = %48, %45
%53 = call i32 @OUTBYTE(i8 signext 39)
store i32 0, i32* %4
br label %121
54: ; preds = %40
%55 = load i8*, i8** %2
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 110
br i1 %58, label %59, label %67
59: ; preds = %54
%60 = load i32, i32* %4
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 @OUTBYTE(i8 signext 10)
br label %66
64: ; preds = %59
%65 = call i32 @OUTBYTE(i8 signext 110)
br label %66
66: ; preds = %64, %62
store i32 0, i32* %4
br label %120
67: ; preds = %54
%68 = load i8*, i8** %2
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 116
br i1 %71, label %72, label %80
72: ; preds = %67
%73 = load i32, i32* %4
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 @OUTBYTE(i8 signext 9)
br label %79
77: ; preds = %72
%78 = call i32 @OUTBYTE(i8 signext 116)
br label %79
79: ; preds = %77, %75
store i32 0, i32* %4
br label %119
80: ; preds = %67
%81 = load i8*, i8** %2
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 114
br i1 %84, label %85, label %93
85: ; preds = %80
%86 = load i32, i32* %4
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 @OUTBYTE(i8 signext 13)
br label %92
90: ; preds = %85
%91 = call i32 @OUTBYTE(i8 signext 114)
br label %92
92: ; preds = %90, %88
store i32 0, i32* %4
br label %118
93: ; preds = %80
%94 = load i8*, i8** %2
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 92
br i1 %97, label %98, label %105
98: ; preds = %93
%99 = load i32, i32* %4
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 @OUTBYTE(i8 signext 92)
store i32 0, i32* %4
br label %104
103: ; preds = %98
store i32 1, i32* %4
br label %104
104: ; preds = %103, %101
br label %117
105: ; preds = %93
%106 = load i32, i32* %4
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %113
108: ; preds = %105
%109 = load i8*, i8** %2
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = call i32 (i8*, ...) @instruction_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %108, %105
%114 = load i8*, i8** %2
%115 = load i8, i8* %114
%116 = call i32 @OUTBYTE(i8 signext %115)
br label %117
117: ; preds = %113, %104
br label %118
118: ; preds = %117, %92
br label %119
119: ; preds = %118, %79
br label %120
120: ; preds = %119, %66
br label %121
121: ; preds = %120, %52
br label %122
122: ; preds = %121, %38
%123 = load i8*, i8** %2
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %2
br label %22
125: ; preds = %51, %37, %22
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"OUTSTRING <INTERNAL ERROR>. Not a string!\00"
@.str.1 = [38 x i8] c"Invalid escape sequence \\%c in string\00"
define void @OUTSTRING(i8* nocapture %0) {
%2 = load i8, i8* %0
switch i8 %2, label %4 [
i8 34, label %6
i8 39, label %3
]
3: ; preds = %1
br label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @instruction_error(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %3, %4
%7 = phi i1 [ false, %3 ], [ undef, %4 ], [ true, %1 ]
%8 = phi i1 [ true, %3 ], [ undef, %4 ], [ false, %1 ]
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %48, label %12
12: ; preds = %6, %43
%13 = phi i8 [ %46, %43 ], [ %10, %6 ]
%14 = phi i8* [ %45, %43 ], [ %9, %6 ]
%15 = phi i32 [ %44, %43 ], [ 0, %6 ]
%16 = sext i8 %13 to i32
switch i8 %13, label %34 [
i8 34, label %17
i8 39, label %20
i8 110, label %23
i8 116, label %26
i8 114, label %29
i8 92, label %32
]
17: ; preds = %12
%18 = icmp ne i32 %15, 0
%19 = select i1 %8, i1 true, i1 %18
br i1 %19, label %39, label %48
20: ; preds = %12
%21 = icmp ne i32 %15, 0
%22 = select i1 %7, i1 true, i1 %21
br i1 %22, label %39, label %48
23: ; preds = %12
%24 = icmp eq i32 %15, 0
%25 = select i1 %24, i8 110, i8 10
br label %39
26: ; preds = %12
%27 = icmp eq i32 %15, 0
%28 = select i1 %27, i8 116, i8 9
br label %39
29: ; preds = %12
%30 = icmp eq i32 %15, 0
%31 = select i1 %30, i8 114, i8 13
br label %39
32: ; preds = %12
%33 = icmp eq i32 %15, 0
br i1 %33, label %43, label %39
34: ; preds = %12
%35 = icmp eq i32 %15, 0
br i1 %35, label %39, label %36
36: ; preds = %34
%37 = tail call i32 (i8*, ...) @instruction_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%38 = load i8, i8* %14
br label %39
39: ; preds = %34, %36, %32, %29, %26, %23, %20, %17
%40 = phi i8 [ 34, %17 ], [ 39, %20 ], [ %25, %23 ], [ %28, %26 ], [ %31, %29 ], [ 92, %32 ], [ %38, %36 ], [ %13, %34 ]
%41 = phi i32 [ 0, %17 ], [ 0, %20 ], [ 0, %23 ], [ 0, %26 ], [ 0, %29 ], [ 0, %32 ], [ %15, %36 ], [ %15, %34 ]
%42 = tail call i32 @OUTBYTE(i8 signext %40)
br label %43
43: ; preds = %39, %32
%44 = phi i32 [ 1, %32 ], [ %41, %39 ]
%45 = getelementptr inbounds i8, i8* %14, i64 1
%46 = load i8, i8* %45
%47 = icmp eq i8 %46, 0
br i1 %47, label %48, label %12
48: ; preds = %43, %17, %20, %6
ret void
}