#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 *, ...);
void decode_digit(unsigned char raw_digit) {
  unsigned char digit_pattern[] = {0x00, 0x5f, 0x06, 0x6b, 0x2f, 0x36,
                                   0x3d, 0x7d, 0x07, 0x7f, 0x3f, 0x58};
  char *digit_string[] = {"",  "0", "1", "2", "3", "4",
                          "5", "6", "7", "8", "9", "L"};
  if (raw_digit & 0x80)
    printf(".");
  for (int i = 0; i <= 11; i++)
    if (digit_pattern[i] == (raw_digit & 0x7f))
      printf("%s", digit_string[i]);
}


x86 assembly (clang, -O0):
<decode_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xec6(%rip),%eax
mov    %eax,-0x5(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c70(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     117a <decode_digit+0x5a>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0xb,-0x74(%rbp)
jg     11cd <decode_digit+0xad>
movslq -0x74(%rbp),%rax
movzbl -0xd(%rbp,%rax,1),%eax
movzbl -0x1(%rbp),%ecx
and    $0x7f,%ecx
cmp    %ecx,%eax
jne    11ba <decode_digit+0x9a>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <decode_digit+0x9f>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1181 <decode_digit+0x61>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_digit>:
push   %rbx
mov    %edi,%ebx
test   $0x80,%bl
je     1122 <decode_digit+0x12>
mov    $0x2e,%edi
call   1030 <putchar@plt>
and    $0x7f,%ebx
lea    -0x6(%rbx),%eax
cmp    $0x39,%eax
ja     1148 <decode_digit+0x38>
lea    0xecc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x31,%edi
pop    %rbx
jmp    1030 <putchar@plt>
add    $0xffffffa8,%ebx
cmp    $0x27,%ebx
ja     11a7 <decode_digit+0x97>
mov    $0x30,%edi
lea    0xf8c(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    $0x4c,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x37,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x33,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x34,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x35,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x39,%edi
pop    %rbx
jmp    1030 <putchar@plt>
pop    %rbx
ret
mov    $0x32,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x36,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x38,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__const.decode_digit.digit_pattern = [12 x i8] c"\00_\06k/6=}\07\7F?X"
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"5\00"
@.str.7 = [2 x i8] c"6\00"
@.str.8 = [2 x i8] c"7\00"
@.str.9 = [2 x i8] c"8\00"
@.str.10 = [2 x i8] c"9\00"
@.str.11 = [2 x i8] c"L\00"
@__const.decode_digit.digit_string = [12 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [2 x i8] c".\00"
@.str.13 = [3 x i8] c"%s\00"
define void @decode_digit(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca [12 x i8]
%4 = alloca [12 x i8*]
%5 = alloca i32
store i8 %0, i8* %2
%6 = bitcast [12 x i8]* %3 to i8*
%7 = bitcast [12 x i8*]* %4 to i8*
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
store i32 0, i32* %5
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %5
%17 = icmp sle i32 %16, 11
br i1 %17, label %18, label %38
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = and i32 %25, 127
%27 = icmp eq i32 %23, %26
br i1 %27, label %28, label %34
28: ; preds = %18
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [12 x i8*], [12 x i8*]* %4, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %28, %18
br label %35
35: ; preds = %34
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %15
38: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @decode_digit(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @putchar(i32 46)
br label %7
7: ; preds = %5, %1
%8 = and i32 %2, 127
switch i32 %8, label %22 [
i32 95, label %19
i32 6, label %9
i32 107, label %10
i32 47, label %11
i32 54, label %12
i32 61, label %13
i32 125, label %14
i32 7, label %15
i32 127, label %16
i32 63, label %17
i32 88, label %18
]
9: ; preds = %7
br label %19
10: ; preds = %7
br label %19
11: ; preds = %7
br label %19
12: ; preds = %7
br label %19
13: ; preds = %7
br label %19
14: ; preds = %7
br label %19
15: ; preds = %7
br label %19
16: ; preds = %7
br label %19
17: ; preds = %7
br label %19
18: ; preds = %7
br label %19
19: ; preds = %7, %18, %16, %17, %15, %14, %12, %13, %10, %11, %9
%20 = phi i32 [ 49, %9 ], [ 51, %11 ], [ 50, %10 ], [ 53, %13 ], [ 52, %12 ], [ 54, %14 ], [ 55, %15 ], [ 57, %17 ], [ 56, %16 ], [ 76, %18 ], [ 48, %7 ]
%21 = tail call i32 @putchar(i32 %20)
br label %22
22: ; preds = %19, %7
ret void
}