#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 */
typedef int wchar_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ wprintf(char *, int);
int printPrimitive(uint64_t result) {
  if ((result & 0b00000011) == 0b00) {
    result = result >> 2;
    printf("%d", result);
    return 0;
  } else if ((result & 0b1111111) == 0b0011111) {
    result = result >> 7;
    if (result == 1) {
      printf("true");
      return 0;
    }
    printf("false");
    return 1;
  } else if (result == 0b00101111) {
    printf("()");
    return 0;
  } else if ((result & 0b11111111) == 0b00001111) {
    result = result >> 8;
    setlocale(LC_CTYPE, "");
    wchar_t test = result;
    wprintf(L"#\\%lc", test);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<printPrimitive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    1170 <printPrimitive+0x40>
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1250 <printPrimitive+0x120>
mov    -0x8(%rbp),%eax
and    $0x7f,%eax
cmp    $0x1f,%eax
jne    11c6 <printPrimitive+0x96>
mov    -0x8(%rbp),%eax
sar    $0x7,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ac <printPrimitive+0x7c>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1250 <printPrimitive+0x120>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1250 <printPrimitive+0x120>
cmpl   $0x2f,-0x8(%rbp)
jne    11ea <printPrimitive+0xba>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1250 <printPrimitive+0x120>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0xf,%eax
jne    123a <printPrimitive+0x10a>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xdfc(%rip),%rsi
call   1050 <setlocale@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdeb(%rip),%rdi
call   1040 <wprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1250 <printPrimitive+0x120>
jmp    123f <printPrimitive+0x10f>
jmp    1244 <printPrimitive+0x114>
jmp    1249 <printPrimitive+0x119>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPrimitive>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   $0x3,%bl
je     1158 <printPrimitive+0x28>
mov    %ebx,%eax
and    $0x7f,%eax
cmp    $0x1f,%eax
jne    116f <printPrimitive+0x3f>
and    $0xffffff80,%ebx
cmp    $0x80,%ebx
jne    1186 <printPrimitive+0x56>
lea    0xead(%rip),%rdi
jmp    117b <printPrimitive+0x4b>
sar    $0x2,%ebx
lea    0xe9e(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11cd <printPrimitive+0x9d>
cmp    $0x2f,%ebx
jne    119b <printPrimitive+0x6b>
lea    0xe93(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11cd <printPrimitive+0x9d>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
jmp    11cd <printPrimitive+0x9d>
mov    $0x1,%ebp
cmp    $0xf,%bl
jne    11cd <printPrimitive+0x9d>
sar    $0x8,%ebx
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
call   1050 <setlocale@plt>
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
call   1040 <wprintf@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
@.str.3 = [3 x i8] c"()\00"
@LC_CTYPE = global i32 0
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [6 x i32] [i32 35, i32 92, i32 37, i32 108, i32 99, i32 0]
define i32 @printPrimitive(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = ashr i32 %9, 2
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 0, i32* %2
br label %47
13: ; preds = %1
%14 = load i32, i32* %3
%15 = and i32 %14, 127
%16 = icmp eq i32 %15, 31
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i32, i32* %3
%19 = ashr i32 %18, 7
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %47
24: ; preds = %17
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %47
26: ; preds = %13
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 47
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %47
31: ; preds = %26
%32 = load i32, i32* %3
%33 = and i32 %32, 255
%34 = icmp eq i32 %33, 15
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i32, i32* %3
%37 = ashr i32 %36, 8
store i32 %37, i32* %3
%38 = load i32, i32* @LC_CTYPE
%39 = call i32 @setlocale(i32 %38, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* %3
store i32 %40, i32* %4
%41 = load i32, i32* %4
%42 = call i32 @wprintf(i8* bitcast ([6 x i32]* @.str.5 to i8*), i32 %41)
store i32 0, i32* %2
br label %47
43: ; preds = %31
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
store i32 1, i32* %2
br label %47
47: ; preds = %46, %35, %29, %24, %22, %8
%48 = load i32, i32* %2
ret i32 %48
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
@.str.3 = [3 x i8] c"()\00"
@LC_CTYPE = global i32 0
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [6 x i32] [i32 35, i32 92, i32 37, i32 108, i32 99, i32 0]
define i32 @printPrimitive(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = ashr i32 %0, 2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %29
7: ; preds = %1
%8 = and i32 %0, 127
%9 = icmp eq i32 %8, 31
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = and i32 %0, -128
%12 = icmp eq i32 %11, 128
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %29
15: ; preds = %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
17: ; preds = %7
%18 = icmp eq i32 %0, 47
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %29
21: ; preds = %17
%22 = and i32 %0, 255
%23 = icmp eq i32 %22, 15
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = ashr i32 %0, 8
%26 = load i32, i32* @LC_CTYPE
%27 = tail call i32 @setlocale(i32 %26, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%28 = tail call i32 @wprintf(i8* bitcast ([6 x i32]* @.str.5 to i8*), i32 %25)
br label %29
29: ; preds = %21, %24, %19, %15, %13, %4
%30 = phi i32 [ 0, %4 ], [ 0, %13 ], [ 1, %15 ], [ 0, %19 ], [ 0, %24 ], [ 1, %21 ]
ret i32 %30
}