#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 */
scalar_t__ isprint(int);
char *char_to_string(int ch) {
  static char buf[] = "M-\0\0\0\0";
  if (ch == '\\')
    return "\\\\";
  if (isprint(ch)) {
    buf[3] = ch;
    buf[4] = 0;
    return &buf[3];
  }
  if (ch & 0x8000) {
    ch &= (0x8000 - 1);
    if (ch == 0x7f || ch < ' ') {
      buf[2] = '^';
      buf[3] = (ch == 0x7f ? '?' : ch + '@');
      if (buf[3] == '\\') {
        buf[4] = '\\';
        buf[5] = 0;
      } else
        buf[4] = 0;
    } else {
      buf[2] = ch;
      if (buf[2] == '\\') {
        buf[3] = '\\';
        buf[4] = 0;
      } else
        buf[3] = '\0';
    }
    return buf;
  }
  if (ch == 0x7f || ch < ' ') {
    buf[2] = '^';
    buf[3] = (ch == 0x7f ? '?' : ch + '@');
    if (buf[3] == '\\') {
      buf[4] = '\\';
      buf[5] = 0;
    } else
      buf[4] = 0;
    return &buf[2];
  }
  return "huh";
}


x86 assembly (clang, -O0):
<char_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x5c,-0xc(%rbp)
jne    1135 <char_to_string+0x25>
lea    0xed4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12cf <char_to_string+0x1bf>
mov    -0xc(%rbp),%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
je     116b <char_to_string+0x5b>
mov    -0xc(%rbp),%eax
mov    %al,0x2edb(%rip)
movb   $0x0,0x2ed5(%rip)
lea    0x2eca(%rip),%rax
add    $0x3,%rax
mov    %rax,-0x8(%rbp)
jmp    12cf <char_to_string+0x1bf>
mov    -0xc(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1242 <char_to_string+0x132>
mov    -0xc(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7f,-0xc(%rbp)
je     119b <char_to_string+0x8b>
cmpl   $0x20,-0xc(%rbp)
jge    11fa <char_to_string+0xea>
movb   $0x5e,0x2e88(%rip)
cmpl   $0x7f,-0xc(%rbp)
jne    11b9 <char_to_string+0xa9>
mov    $0x3f,%eax
mov    %eax,-0x10(%rbp)
jmp    11c2 <char_to_string+0xb2>
mov    -0xc(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,0x2e60(%rip)
movsbl 0x2e59(%rip),%eax
cmp    $0x5c,%eax
jne    11ee <char_to_string+0xde>
movb   $0x5c,0x2e4a(%rip)
movb   $0x0,0x2e44(%rip)
jmp    11f5 <char_to_string+0xe5>
movb   $0x0,0x2e37(%rip)
jmp    1232 <char_to_string+0x122>
mov    -0xc(%rbp),%eax
mov    %al,0x2e27(%rip)
movsbl 0x2e20(%rip),%eax
cmp    $0x5c,%eax
jne    1226 <char_to_string+0x116>
movb   $0x5c,0x2e11(%rip)
movb   $0x0,0x2e0b(%rip)
jmp    122d <char_to_string+0x11d>
movb   $0x0,0x2dfe(%rip)
jmp    1232 <char_to_string+0x122>
lea    0x2def(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12cf <char_to_string+0x1bf>
cmpl   $0x7f,-0xc(%rbp)
je     1256 <char_to_string+0x146>
cmpl   $0x20,-0xc(%rbp)
jge    12c4 <char_to_string+0x1b4>
movb   $0x5e,0x2dcd(%rip)
cmpl   $0x7f,-0xc(%rbp)
jne    1274 <char_to_string+0x164>
mov    $0x3f,%eax
mov    %eax,-0x14(%rbp)
jmp    127d <char_to_string+0x16d>
mov    -0xc(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,0x2da5(%rip)
movsbl 0x2d9e(%rip),%eax
cmp    $0x5c,%eax
jne    12a9 <char_to_string+0x199>
movb   $0x5c,0x2d8f(%rip)
movb   $0x0,0x2d89(%rip)
jmp    12b0 <char_to_string+0x1a0>
movb   $0x0,0x2d7c(%rip)
lea    0x2d71(%rip),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    12cf <char_to_string+0x1bf>
lea    0xd38(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_to_string>:
push   %rbx
cmp    $0x5c,%edi
jne    111f <char_to_string+0xf>
lea    0xee3(%rip),%rax
pop    %rbx
ret
mov    %edi,%ebx
call   1030 <isprint@plt>
test   %rax,%rax
je     1144 <char_to_string+0x34>
mov    %bl,0x2efa(%rip)
lea    0x2ef3(%rip),%rax
lea    0x2eed(%rip),%rcx
movb   $0x0,(%rcx)
pop    %rbx
ret
test   $0x8000,%ebx
jne    115f <char_to_string+0x4f>
cmp    $0x7f,%ebx
je     118b <char_to_string+0x7b>
cmp    $0x1f,%ebx
jle    118b <char_to_string+0x7b>
lea    0xea6(%rip),%rax
pop    %rbx
ret
mov    %ebx,%eax
and    $0x7fff,%eax
cmp    $0x7f,%eax
je     11a4 <char_to_string+0x94>
cmp    $0x1f,%eax
jbe    11a4 <char_to_string+0x94>
mov    %bl,0x2eb4(%rip)
lea    0x2eab(%rip),%rax
cmp    $0x5c,%bl
jne    11e5 <char_to_string+0xd5>
movb   $0x5c,0x2ea2(%rip)
jmp    1138 <char_to_string+0x28>
lea    0x40(%rbx),%ecx
cmp    $0x7f,%ebx
movb   $0x5e,0x2e92(%rip)
lea    0x2e8b(%rip),%rax
movzbl %cl,%ecx
jmp    11bb <char_to_string+0xab>
add    $0x40,%bl
cmp    $0x7f,%eax
movb   $0x5e,0x2e79(%rip)
lea    0x2e70(%rip),%rax
movzbl %bl,%ecx
mov    $0x3f,%edx
cmovne %ecx,%edx
mov    %dl,0x2e62(%rip)
cmp    $0x5c,%dl
jne    1138 <char_to_string+0x28>
movb   $0x5c,0x2e53(%rip)
lea    0x2e4d(%rip),%rcx
jmp    113f <char_to_string+0x2f>
lea    0x2e3f(%rip),%rcx
jmp    113f <char_to_string+0x2f>

LLVM IR (-O0):
@char_to_string.buf = internal global [7 x i8] c"M-\00\00\00\00\00"
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [4 x i8] c"huh\00"
define i8* @char_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 92
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %75
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @isprint(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
store i8 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3), i8** %2
br label %75
14: ; preds = %7
%15 = load i32, i32* %3
%16 = and i32 %15, 32768
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %52
18: ; preds = %14
%19 = load i32, i32* %3
%20 = and i32 %19, 32767
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 127
br i1 %22, label %26, label %23
23: ; preds = %18
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 32
br i1 %25, label %26, label %42
26: ; preds = %23, %18
store i8 94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 127
br i1 %28, label %29, label %30
29: ; preds = %26
br label %33
30: ; preds = %26
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 64
br label %33
33: ; preds = %30, %29
%34 = phi i32 [ 63, %29 ], [ %32, %30 ]
%35 = trunc i32 %34 to i8
store i8 %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%36 = load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 92
br i1 %38, label %39, label %40
39: ; preds = %33
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 5)
br label %41
40: ; preds = %33
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
br label %41
41: ; preds = %40, %39
br label %51
42: ; preds = %23
%43 = load i32, i32* %3
%44 = trunc i32 %43 to i8
store i8 %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%45 = load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 92
br i1 %47, label %48, label %49
48: ; preds = %42
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
br label %50
49: ; preds = %42
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
br label %50
50: ; preds = %49, %48
br label %51
51: ; preds = %50, %41
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 0), i8** %2
br label %75
52: ; preds = %14
%53 = load i32, i32* %3
%54 = icmp eq i32 %53, 127
br i1 %54, label %58, label %55
55: ; preds = %52
%56 = load i32, i32* %3
%57 = icmp slt i32 %56, 32
br i1 %57, label %58, label %74
58: ; preds = %55, %52
store i8 94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%59 = load i32, i32* %3
%60 = icmp eq i32 %59, 127
br i1 %60, label %61, label %62
61: ; preds = %58
br label %65
62: ; preds = %58
%63 = load i32, i32* %3
%64 = add nsw i32 %63, 64
br label %65
65: ; preds = %62, %61
%66 = phi i32 [ 63, %61 ], [ %64, %62 ]
%67 = trunc i32 %66 to i8
store i8 %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%68 = load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 92
br i1 %70, label %71, label %72
71: ; preds = %65
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 5)
br label %73
72: ; preds = %65
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
br label %73
73: ; preds = %72, %71
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2), i8** %2
br label %75
74: ; preds = %55
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %75
75: ; preds = %74, %73, %51, %11, %6
%76 = load i8*, i8** %2
ret i8* %76
}

LLVM IR (-O2):
@char_to_string.buf = internal global [7 x i8] c"M-\00\00\00\00\00"
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [4 x i8] c"huh\00"
define i8* @char_to_string(i32 %0) {
%2 = icmp eq i32 %0, 92
br i1 %2, label %40, label %3
3: ; preds = %1
%4 = tail call i64 @isprint(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = trunc i32 %0 to i8
store i8 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
br label %37
8: ; preds = %3
%9 = and i32 %0, 32768
%10 = icmp eq i32 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = and i32 %0, 32767
%13 = icmp eq i32 %12, 127
%14 = icmp ult i32 %12, 32
%15 = or i1 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %11
store i8 94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%17 = trunc i32 %0 to i8
%18 = add i8 %17, 64
%19 = select i1 %13, i8 63, i8 %18
store i8 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%20 = icmp eq i8 %19, 92
br i1 %20, label %21, label %37
21: ; preds = %16
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
br label %37
22: ; preds = %11
%23 = trunc i32 %0 to i8
store i8 %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%24 = and i32 %0, 255
%25 = icmp eq i32 %24, 92
br i1 %25, label %26, label %37
26: ; preds = %22
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
br label %37
27: ; preds = %8
%28 = icmp eq i32 %0, 127
%29 = icmp slt i32 %0, 32
%30 = or i1 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %27
store i8 94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2)
%32 = trunc i32 %0 to i8
%33 = add i8 %32, 64
%34 = select i1 %28, i8 63, i8 %33
store i8 %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3)
%35 = icmp eq i8 %34, 92
br i1 %35, label %36, label %37
36: ; preds = %31
store i8 92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4)
br label %37
37: ; preds = %31, %22, %16, %6, %26, %21, %36
%38 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 5), %36 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 5), %21 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4), %26 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4), %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4), %16 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3), %22 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 4), %31 ]
%39 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2), %36 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 0), %21 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 0), %26 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 3), %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 0), %16 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 0), %22 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @char_to_string.buf, i64 0, i64 2), %31 ]
store i8 0, i8* %38
br label %40
40: ; preds = %37, %27, %1
%41 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %27 ], [ %39, %37 ]
ret i8* %41
}