#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 */
unsigned char *unw_decode_b1(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_b2(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_b3_x4(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_p1(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_p2_p5(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_p6(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_p7_p10(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_r1(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_r2(unsigned char *, unsigned char, void *);
unsigned char *unw_decode_r3(unsigned char *, unsigned char, void *);
unsigned char *unw_decode(unsigned char *dp, int inside_body, void *arg) {
  unsigned char code, primary;
  code = *dp++;
  primary = code >> 5;
  if (primary < 2)
    dp = unw_decode_r1(dp, code, arg);
  else if (primary == 2)
    dp = unw_decode_r2(dp, code, arg);
  else if (primary == 3)
    dp = unw_decode_r3(dp, code, arg);
  else if (inside_body)
    switch (primary) {
    case 4:
    case 5:
      dp = unw_decode_b1(dp, code, arg);
      break;
    case 6:
      dp = unw_decode_b2(dp, code, arg);
      break;
    case 7:
      dp = unw_decode_b3_x4(dp, code, arg);
      break;
    }
  else
    switch (primary) {
    case 4:
      dp = unw_decode_p1(dp, code, arg);
      break;
    case 5:
      dp = unw_decode_p2_p5(dp, code, arg);
      break;
    case 6:
      dp = unw_decode_p6(dp, code, arg);
      break;
    case 7:
      dp = unw_decode_p7_p10(dp, code, arg);
      break;
    }
  return dp;
}


x86 assembly (clang, -O0):
<unw_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
sar    $0x5,%eax
mov    %al,-0x1a(%rbp)
movzbl -0x1a(%rbp),%eax
cmp    $0x2,%eax
jge    11fa <unw_decode+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1090 <unw_decode_r1@plt>
mov    %rax,-0x8(%rbp)
jmp    138d <unw_decode+0x1ed>
movzbl -0x1a(%rbp),%eax
cmp    $0x2,%eax
jne    1223 <unw_decode+0x83>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1030 <unw_decode_r2@plt>
mov    %rax,-0x8(%rbp)
jmp    1388 <unw_decode+0x1e8>
movzbl -0x1a(%rbp),%eax
cmp    $0x3,%eax
jne    124c <unw_decode+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1080 <unw_decode_r3@plt>
mov    %rax,-0x8(%rbp)
jmp    1383 <unw_decode+0x1e3>
cmpl   $0x0,-0xc(%rbp)
je     12e4 <unw_decode+0x144>
movzbl -0x1a(%rbp),%eax
mov    %eax,-0x20(%rbp)
add    $0xfffffffc,%eax
sub    $0x2,%eax
jb     1290 <unw_decode+0xf0>
jmp    126e <unw_decode+0xce>
mov    -0x20(%rbp),%eax
sub    $0x6,%eax
je     12ac <unw_decode+0x10c>
jmp    127f <unw_decode+0xdf>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
je     12c8 <unw_decode+0x128>
jmp    12df <unw_decode+0x13f>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   10a0 <unw_decode_b1@plt>
mov    %rax,-0x8(%rbp)
jmp    12df <unw_decode+0x13f>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1040 <unw_decode_b2@plt>
mov    %rax,-0x8(%rbp)
jmp    12df <unw_decode+0x13f>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1070 <unw_decode_b3_x4@plt>
mov    %rax,-0x8(%rbp)
jmp    137e <unw_decode+0x1de>
movzbl -0x1a(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     1379 <unw_decode+0x1d9>
mov    -0x28(%rbp),%rax
lea    0xcfb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1060 <unw_decode_p1@plt>
mov    %rax,-0x8(%rbp)
jmp    1379 <unw_decode+0x1d9>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   10b0 <unw_decode_p2_p5@plt>
mov    %rax,-0x8(%rbp)
jmp    1379 <unw_decode+0x1d9>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   10c0 <unw_decode_p6@plt>
mov    %rax,-0x8(%rbp)
jmp    1379 <unw_decode+0x1d9>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1050 <unw_decode_p7_p10@plt>
mov    %rax,-0x8(%rbp)
jmp    137e <unw_decode+0x1de>
jmp    1383 <unw_decode+0x1e3>
jmp    1388 <unw_decode+0x1e8>
jmp    138d <unw_decode+0x1ed>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unw_decode>:
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %ecx,%eax
cmp    $0x3f,%ecx
ja     11b6 <unw_decode+0x16>
movzbl %al,%esi
jmp    1090 <unw_decode_r1@plt>
shr    $0x5,%ecx
cmp    $0x3,%cl
je     11cb <unw_decode+0x2b>
cmp    $0x2,%cl
jne    11d3 <unw_decode+0x33>
movzbl %al,%esi
jmp    1030 <unw_decode_r2@plt>
movzbl %al,%esi
jmp    1080 <unw_decode_r3@plt>
test   %esi,%esi
je     11f1 <unw_decode+0x51>
lea    -0x4(%rcx),%esi
cmp    $0x2,%esi
jb     1211 <unw_decode+0x71>
cmp    $0x6,%ecx
je     121d <unw_decode+0x7d>
cmp    $0x7,%ecx
jne    1219 <unw_decode+0x79>
movzbl %al,%esi
jmp    1070 <unw_decode_b3_x4@plt>
add    $0xfffffffc,%ecx
cmp    $0x3,%ecx
ja     1219 <unw_decode+0x79>
lea    0xe00(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
movzbl %al,%esi
jmp    1060 <unw_decode_p1@plt>
movzbl %al,%esi
jmp    10a0 <unw_decode_b1@plt>
mov    %rdi,%rax
ret
movzbl %al,%esi
jmp    1040 <unw_decode_b2@plt>
movzbl %al,%esi
jmp    10c0 <unw_decode_p6@plt>
movzbl %al,%esi
jmp    1050 <unw_decode_p7_p10@plt>
movzbl %al,%esi
jmp    10b0 <unw_decode_p2_p5@plt>

LLVM IR (-O0):
define i8* @unw_decode(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %4
%11 = load i8, i8* %9
store i8 %11, i8* %7
%12 = load i8, i8* %7
%13 = zext i8 %12 to i32
%14 = ashr i32 %13, 5
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %24
19: ; preds = %3
%20 = load i8*, i8** %4
%21 = load i8, i8* %7
%22 = load i8*, i8** %6
%23 = call i8* @unw_decode_r1(i8* %20, i8 zeroext %21, i8* %22)
store i8* %23, i8** %4
br label %91
24: ; preds = %3
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8*, i8** %4
%30 = load i8, i8* %7
%31 = load i8*, i8** %6
%32 = call i8* @unw_decode_r2(i8* %29, i8 zeroext %30, i8* %31)
store i8* %32, i8** %4
br label %90
33: ; preds = %24
%34 = load i8, i8* %8
%35 = zext i8 %34 to i32
%36 = icmp eq i32 %35, 3
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = load i8, i8* %7
%40 = load i8*, i8** %6
%41 = call i8* @unw_decode_r3(i8* %38, i8 zeroext %39, i8* %40)
store i8* %41, i8** %4
br label %89
42: ; preds = %33
%43 = load i32, i32* %5
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %64
45: ; preds = %42
%46 = load i8, i8* %8
%47 = zext i8 %46 to i32
switch i32 %47, label %63 [
i32 4, label %48
i32 5, label %48
i32 6, label %53
i32 7, label %58
]
48: ; preds = %45, %45
%49 = load i8*, i8** %4
%50 = load i8, i8* %7
%51 = load i8*, i8** %6
%52 = call i8* @unw_decode_b1(i8* %49, i8 zeroext %50, i8* %51)
store i8* %52, i8** %4
br label %63
53: ; preds = %45
%54 = load i8*, i8** %4
%55 = load i8, i8* %7
%56 = load i8*, i8** %6
%57 = call i8* @unw_decode_b2(i8* %54, i8 zeroext %55, i8* %56)
store i8* %57, i8** %4
br label %63
58: ; preds = %45
%59 = load i8*, i8** %4
%60 = load i8, i8* %7
%61 = load i8*, i8** %6
%62 = call i8* @unw_decode_b3_x4(i8* %59, i8 zeroext %60, i8* %61)
store i8* %62, i8** %4
br label %63
63: ; preds = %45, %58, %53, %48
br label %88
64: ; preds = %42
%65 = load i8, i8* %8
%66 = zext i8 %65 to i32
switch i32 %66, label %87 [
i32 4, label %67
i32 5, label %72
i32 6, label %77
i32 7, label %82
]
67: ; preds = %64
%68 = load i8*, i8** %4
%69 = load i8, i8* %7
%70 = load i8*, i8** %6
%71 = call i8* @unw_decode_p1(i8* %68, i8 zeroext %69, i8* %70)
store i8* %71, i8** %4
br label %87
72: ; preds = %64
%73 = load i8*, i8** %4
%74 = load i8, i8* %7
%75 = load i8*, i8** %6
%76 = call i8* @unw_decode_p2_p5(i8* %73, i8 zeroext %74, i8* %75)
store i8* %76, i8** %4
br label %87
77: ; preds = %64
%78 = load i8*, i8** %4
%79 = load i8, i8* %7
%80 = load i8*, i8** %6
%81 = call i8* @unw_decode_p6(i8* %78, i8 zeroext %79, i8* %80)
store i8* %81, i8** %4
br label %87
82: ; preds = %64
%83 = load i8*, i8** %4
%84 = load i8, i8* %7
%85 = load i8*, i8** %6
%86 = call i8* @unw_decode_p7_p10(i8* %83, i8 zeroext %84, i8* %85)
store i8* %86, i8** %4
br label %87
87: ; preds = %64, %82, %77, %72, %67
br label %88
88: ; preds = %87, %63
br label %89
89: ; preds = %88, %37
br label %90
90: ; preds = %89, %28
br label %91
91: ; preds = %90, %19
%92 = load i8*, i8** %4
ret i8* %92
}

LLVM IR (-O2):
define i8* @unw_decode(i8* %0, i32 %1, i8* %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %0
%6 = lshr i8 %5, 5
%7 = zext i8 %6 to i32
%8 = icmp ult i8 %5, 64
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i8* @unw_decode_r1(i8* %4, i8 zeroext %5, i8* %2)
br label %34
11: ; preds = %3
switch i8 %6, label %16 [
i8 2, label %12
i8 3, label %14
]
12: ; preds = %11
%13 = tail call i8* @unw_decode_r2(i8* %4, i8 zeroext %5, i8* %2)
br label %34
14: ; preds = %11
%15 = tail call i8* @unw_decode_r3(i8* %4, i8 zeroext %5, i8* %2)
br label %34
16: ; preds = %11
%17 = icmp eq i32 %1, 0
br i1 %17, label %25, label %18
18: ; preds = %16
switch i32 %7, label %34 [
i32 4, label %19
i32 5, label %19
i32 6, label %21
i32 7, label %23
]
19: ; preds = %18, %18
%20 = tail call i8* @unw_decode_b1(i8* %4, i8 zeroext %5, i8* %2)
br label %34
21: ; preds = %18
%22 = tail call i8* @unw_decode_b2(i8* %4, i8 zeroext %5, i8* %2)
br label %34
23: ; preds = %18
%24 = tail call i8* @unw_decode_b3_x4(i8* %4, i8 zeroext %5, i8* %2)
br label %34
25: ; preds = %16
switch i32 %7, label %34 [
i32 4, label %26
i32 5, label %28
i32 6, label %30
i32 7, label %32
]
26: ; preds = %25
%27 = tail call i8* @unw_decode_p1(i8* %4, i8 zeroext %5, i8* %2)
br label %34
28: ; preds = %25
%29 = tail call i8* @unw_decode_p2_p5(i8* %4, i8 zeroext %5, i8* %2)
br label %34
30: ; preds = %25
%31 = tail call i8* @unw_decode_p6(i8* %4, i8 zeroext %5, i8* %2)
br label %34
32: ; preds = %25
%33 = tail call i8* @unw_decode_p7_p10(i8* %4, i8 zeroext %5, i8* %2)
br label %34
34: ; preds = %12, %18, %23, %21, %19, %25, %32, %30, %28, %26, %14, %9
%35 = phi i8* [ %10, %9 ], [ %13, %12 ], [ %15, %14 ], [ %4, %18 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %4, %25 ], [ %33, %32 ], [ %31, %30 ], [ %29, %28 ], [ %27, %26 ]
ret i8* %35
}