#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprint_bit_string(int /*<<< orphan*/ *, unsigned char *,
                                     unsigned char *);
int /*<<< orphan*/ fprint_boolean(int /*<<< orphan*/ *, unsigned char *,
                                  unsigned char *);
int /*<<< orphan*/ fprint_decimal_and_dots(int /*<<< orphan*/ *,
                                           unsigned char *, unsigned char *);
int /*<<< orphan*/ fprint_integer(int /*<<< orphan*/ *, unsigned char *,
                                  unsigned char *);
int /*<<< orphan*/ fprint_null(int /*<<< orphan*/ *, unsigned char *,
                               unsigned char *);
int /*<<< orphan*/ fprint_octet_string(int /*<<< orphan*/ *, unsigned char *,
                                       unsigned char *);
int /*<<< orphan*/ fprint_oid(int /*<<< orphan*/ *, unsigned char *,
                              unsigned char *);
int /*<<< orphan*/ fprint_unsigned(int /*<<< orphan*/ *, unsigned char *,
                                   unsigned char *);
int /*<<< orphan*/ fprint_visible_or_octet_string(int /*<<< orphan*/ *,
                                                  unsigned char *,
                                                  unsigned char *);
int /*<<< orphan*/ fprint_visible_string(int /*<<< orphan*/ *, unsigned char *,
                                         unsigned char *);
void fprint_value(FILE *f, unsigned char *p, unsigned char *e,
                  unsigned char tagcls) {
  switch (tagcls) {
  case 0x01:
    fprint_boolean(f, p, e);
    break;
  case 0x02:
  case (0x40 | 0xa):
    fprint_integer(f, p, e);
    break;
  case 0x03:
    fprint_bit_string(f, p, e);
    break;
  case 0x04:
    fprint_visible_or_octet_string(f, p, e);
    break;
  case 0x05:
    fprint_null(f, p, e);
    break;
  case 0x06:
    fprint_oid(f, p, e);
    break;
  case (0x40 | 0x0):
    fprint_decimal_and_dots(f, p, e);
    break;
  case (0x40 | 0x1):
  case (0x40 | 0x2):
  case (0x40 | 0x3):
  case (0x40 | 0x6):
  case (0x40 | 0x7):
  case (0x40 | 0xb):
    fprint_unsigned(f, p, e);
    break;
  case (0x40 | 0x5):
    fprint_visible_string(f, p, e);
    break;
  case (0x40 | 0x4):
  case (0x40 | 0x8):
  case (0x40 | 0x9):
  default:
    fprint_octet_string(f, p, e);
    break;
  }
}


x86 assembly (clang, -O0):
<fprint_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x4a,%eax
ja     12ae <fprint_value+0x10e>
mov    -0x28(%rbp),%rax
lea    0xe26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1090 <fprint_boolean@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10c0 <fprint_integer@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10a0 <fprint_bit_string@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <fprint_visible_or_octet_string@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <fprint_null@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <fprint_oid@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <fprint_decimal_and_dots@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <fprint_unsigned@plt>
jmp    12bf <fprint_value+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1080 <fprint_visible_string@plt>
jmp    12bf <fprint_value+0x11f>
jmp    12ae <fprint_value+0x10e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10b0 <fprint_octet_string@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_value>:
add    $0xff,%cl
cmp    $0x4a,%cl
ja     11de <fprint_value+0x3e>
movzbl %cl,%eax
lea    0xe4e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1060 <fprint_unsigned@plt>
jmp    10c0 <fprint_integer@plt>
jmp    1090 <fprint_boolean@plt>
jmp    10a0 <fprint_bit_string@plt>
jmp    1030 <fprint_visible_or_octet_string@plt>
jmp    1070 <fprint_null@plt>
jmp    1050 <fprint_oid@plt>
jmp    10b0 <fprint_octet_string@plt>
jmp    1040 <fprint_decimal_and_dots@plt>
jmp    1080 <fprint_visible_string@plt>

LLVM IR (-O0):
define void @fprint_value(i32* %0, i8* %1, i8* %2, i8 zeroext %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8 %3, i8* %8
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
switch i32 %10, label %57 [
i32 1, label %11
i32 2, label %16
i32 74, label %16
i32 3, label %21
i32 4, label %26
i32 5, label %31
i32 6, label %36
i32 64, label %41
i32 65, label %46
i32 66, label %46
i32 67, label %46
i32 70, label %46
i32 71, label %46
i32 75, label %46
i32 69, label %51
i32 68, label %56
i32 72, label %56
i32 73, label %56
]
11: ; preds = %4
%12 = load i32*, i32** %5
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = call i32 @fprint_boolean(i32* %12, i8* %13, i8* %14)
br label %62
16: ; preds = %4, %4
%17 = load i32*, i32** %5
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = call i32 @fprint_integer(i32* %17, i8* %18, i8* %19)
br label %62
21: ; preds = %4
%22 = load i32*, i32** %5
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = call i32 @fprint_bit_string(i32* %22, i8* %23, i8* %24)
br label %62
26: ; preds = %4
%27 = load i32*, i32** %5
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = call i32 @fprint_visible_or_octet_string(i32* %27, i8* %28, i8* %29)
br label %62
31: ; preds = %4
%32 = load i32*, i32** %5
%33 = load i8*, i8** %6
%34 = load i8*, i8** %7
%35 = call i32 @fprint_null(i32* %32, i8* %33, i8* %34)
br label %62
36: ; preds = %4
%37 = load i32*, i32** %5
%38 = load i8*, i8** %6
%39 = load i8*, i8** %7
%40 = call i32 @fprint_oid(i32* %37, i8* %38, i8* %39)
br label %62
41: ; preds = %4
%42 = load i32*, i32** %5
%43 = load i8*, i8** %6
%44 = load i8*, i8** %7
%45 = call i32 @fprint_decimal_and_dots(i32* %42, i8* %43, i8* %44)
br label %62
46: ; preds = %4, %4, %4, %4, %4, %4
%47 = load i32*, i32** %5
%48 = load i8*, i8** %6
%49 = load i8*, i8** %7
%50 = call i32 @fprint_unsigned(i32* %47, i8* %48, i8* %49)
br label %62
51: ; preds = %4
%52 = load i32*, i32** %5
%53 = load i8*, i8** %6
%54 = load i8*, i8** %7
%55 = call i32 @fprint_visible_string(i32* %52, i8* %53, i8* %54)
br label %62
56: ; preds = %4, %4, %4
br label %57
57: ; preds = %4, %56
%58 = load i32*, i32** %5
%59 = load i8*, i8** %6
%60 = load i8*, i8** %7
%61 = call i32 @fprint_octet_string(i32* %58, i8* %59, i8* %60)
br label %62
62: ; preds = %57, %51, %46, %41, %36, %31, %26, %21, %16, %11
ret void
}

LLVM IR (-O2):
define void @fprint_value(i32* %0, i8* %1, i8* %2, i8 zeroext %3) {
switch i8 %3, label %23 [
i8 1, label %5
i8 2, label %7
i8 74, label %7
i8 3, label %9
i8 4, label %11
i8 5, label %13
i8 6, label %15
i8 64, label %17
i8 65, label %19
i8 66, label %19
i8 67, label %19
i8 70, label %19
i8 71, label %19
i8 75, label %19
i8 69, label %21
]
5: ; preds = %4
%6 = tail call i32 @fprint_boolean(i32* %0, i8* %1, i8* %2)
br label %25
7: ; preds = %4, %4
%8 = tail call i32 @fprint_integer(i32* %0, i8* %1, i8* %2)
br label %25
9: ; preds = %4
%10 = tail call i32 @fprint_bit_string(i32* %0, i8* %1, i8* %2)
br label %25
11: ; preds = %4
%12 = tail call i32 @fprint_visible_or_octet_string(i32* %0, i8* %1, i8* %2)
br label %25
13: ; preds = %4
%14 = tail call i32 @fprint_null(i32* %0, i8* %1, i8* %2)
br label %25
15: ; preds = %4
%16 = tail call i32 @fprint_oid(i32* %0, i8* %1, i8* %2)
br label %25
17: ; preds = %4
%18 = tail call i32 @fprint_decimal_and_dots(i32* %0, i8* %1, i8* %2)
br label %25
19: ; preds = %4, %4, %4, %4, %4, %4
%20 = tail call i32 @fprint_unsigned(i32* %0, i8* %1, i8* %2)
br label %25
21: ; preds = %4
%22 = tail call i32 @fprint_visible_string(i32* %0, i8* %1, i8* %2)
br label %25
23: ; preds = %4
%24 = tail call i32 @fprint_octet_string(i32* %0, i8* %1, i8* %2)
br label %25
25: ; preds = %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
ret void
}