#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*/ printf(char *, ...);
int scheme_entry();
int main(int argc, char **argv) {
  int val = scheme_entry();
  if ((val & 0x3) == 0x0) {
    printf("%d\n", val >> 2);
  } else if ((val & 0xff) == 0x0f) {
    printf("%c\n", val >> 8);
  } else if ((val & 0x7f) == 0x3f) {
    if (val >> 7) {
      printf("true");
    } else {
      printf("false");
    }
  } else if (val == 47) {
    printf("()\n");
  } else {
    printf("Can't interpret tag for value: %#010x\n", val);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <scheme_entry@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    1168 <main+0x48>
mov    -0x14(%rbp),%esi
sar    $0x2,%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
mov    -0x14(%rbp),%eax
and    $0xff,%eax
cmp    $0xf,%eax
jne    1192 <main+0x72>
mov    -0x14(%rbp),%esi
sar    $0x8,%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120e <main+0xee>
mov    -0x14(%rbp),%eax
and    $0x7f,%eax
cmp    $0x3f,%eax
jne    11d6 <main+0xb6>
mov    -0x14(%rbp),%eax
sar    $0x7,%eax
cmp    $0x0,%eax
je     11c3 <main+0xa3>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
cmpl   $0x2f,-0x14(%rbp)
jne    11f3 <main+0xd3>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xe4>
mov    -0x14(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
jmp    120e <main+0xee>
jmp    1213 <main+0xf3>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <scheme_entry@plt>
test   $0x3,%al
je     114c <main+0x1c>
cmp    $0xf,%al
jne    1163 <main+0x33>
sar    $0x8,%eax
lea    0xeba(%rip),%rdi
jmp    1156 <main+0x26>
sar    $0x2,%eax
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    %eax,%ecx
and    $0x7f,%ecx
cmp    $0x3f,%ecx
jne    117d <main+0x4d>
cmp    $0x80,%eax
jae    1190 <main+0x60>
lea    0xe92(%rip),%rdi
jmp    1197 <main+0x67>
cmp    $0x2f,%eax
jne    11a0 <main+0x70>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
jmp    115f <main+0x2f>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    115f <main+0x2f>
lea    0xe6c(%rip),%rdi
jmp    1156 <main+0x26>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%c\0A\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [6 x i8] c"false\00"
@.str.5 = [39 x i8] c"Can't interpret tag for value: %x\0A\00"
@str = [3 x i8] c"()\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @scheme_entry()
%4 = and i32 %3, 3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = ashr i32 %3, 2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %30
9: ; preds = %2
%10 = and i32 %3, 255
%11 = icmp eq i32 %10, 15
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = ashr i32 %3, 8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %30
15: ; preds = %9
%16 = and i32 %3, 127
%17 = icmp eq i32 %16, 63
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = icmp ult i32 %3, 128
br i1 %19, label %22, label %20
20: ; preds = %18
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %30
22: ; preds = %18
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %30
24: ; preds = %15
%25 = icmp eq i32 %3, 47
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %30
28: ; preds = %24
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %30
30: ; preds = %12, %26, %28, %20, %22, %6
ret i32 0
}