#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 */
struct arm_instruction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, ...);
unsigned int thumb_alignpc4(unsigned int);
int t2ev_data_immed(unsigned opcode, unsigned address,
                    struct arm_instruction *instruction, char *cp) {
  char *mnemonic = NULL;
  int rn = (opcode >> 16) & 0xf;
  int rd = (opcode >> 8) & 0xf;
  unsigned immed;
  int add = 0;
  int is_signed = 0;
  immed = (opcode & 0x0ff) | ((opcode & 0x7000) >> 4);
  if (opcode & (1 << 26))
    immed |= (1 << 11);
  switch ((opcode >> 20) & 0x1f) {
  case 0:
    if (rn == 0xf) {
      add = 1;
      goto do_adr;
    }
    mnemonic = "ADDW";
    break;
  case 4:
    immed |= (opcode >> 4) & 0xf000;
    sprintf(cp, "MOVW\tr%d, #%d\t; %#3.3x", rd, immed, immed);
    return 0;
  case 0x0a:
    if (rn == 0xf)
      goto do_adr;
    mnemonic = "SUBW";
    break;
  case 0x0c:
    immed |= (opcode >> 4) & 0xf000;
    sprintf(cp, "MOVT\tr%d, #%d\t; %#4.4x", rd, immed, immed);
    return 0;
  case 0x10:
  case 0x12:
    is_signed = 1;
  case 0x18:
  case 0x1a:
    immed = (opcode >> 6) & 0x03;
    immed |= (opcode >> 10) & 0x1c;
    sprintf(cp, "%sSAT\tr%d, #%d, r%d, %s #%d\t", is_signed ? "S" : "U", rd,
            (int)(opcode & 0x1f) + is_signed, rn,
            (opcode & (1 << 21)) ? "ASR" : "LSL", immed ? immed : 32);
    return 0;
  case 0x14:
    is_signed = 1;
  case 0x1c:
    immed = (opcode >> 6) & 0x03;
    immed |= (opcode >> 10) & 0x1c;
    sprintf(cp, "%sBFX\tr%d, r%d, #%d, #%d\t", is_signed ? "S" : "U", rd, rn,
            immed, (int)(opcode & 0x1f) + 1);
    return 0;
  case 0x16:
    immed = (opcode >> 6) & 0x03;
    immed |= (opcode >> 10) & 0x1c;
    if (rn == 0xf)
      sprintf(cp, "BFC\tr%d, #%d, #%d\t", rd, immed,
              (int)(opcode & 0x1f) + 1 - immed);
    else
      sprintf(cp, "BFI\tr%d, r%d, #%d, #%d\t", rd, rn, immed,
              (int)(opcode & 0x1f) + 1 - immed);
    return 0;
  default:
    return -1;
  }
  sprintf(cp, "%s\tr%d, r%d, #%d\t; %#3.3x", mnemonic, rd, rn, immed, immed);
  return 0;
do_adr:
  address = thumb_alignpc4(address);
  if (add)
    address += immed;
  else
    address -= immed;
  sprintf(cp, "ADR.W\tr%d, %#8.8x", rd, address);
  return 0;
}


x86 assembly (clang, -O0):
<t2ev_data_immed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
and    $0xf,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
and    $0xf,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%ecx
and    $0x7000,%ecx
shr    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
and    $0x4000000,%eax
cmp    $0x0,%eax
je     119c <t2ev_data_immed+0x7c>
mov    -0x34(%rbp),%eax
or     $0x800,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x14,%eax
and    $0x1f,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x1c,%eax
ja     1456 <t2ev_data_immed+0x336>
mov    -0x48(%rbp),%rax
lea    0xe41(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0xf,-0x2c(%rbp)
jne    11de <t2ev_data_immed+0xbe>
movl   $0x1,-0x38(%rbp)
jmp    1495 <t2ev_data_immed+0x375>
lea    0xe8f(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1462 <t2ev_data_immed+0x342>
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
and    $0xf000,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x34(%rbp),%r8d
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
cmpl   $0xf,-0x2c(%rbp)
jne    1236 <t2ev_data_immed+0x116>
jmp    1495 <t2ev_data_immed+0x375>
lea    0xe53(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1462 <t2ev_data_immed+0x342>
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
and    $0xf000,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x34(%rbp),%r8d
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
movl   $0x1,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
shr    $0xa,%eax
and    $0x1c,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x3c(%rbp),%edx
lea    0xe18(%rip),%rax
lea    0xe0f(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1f,%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%edx
and    $0x200000,%edx
lea    0xde4(%rip),%rax
lea    0xdd9(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1314 <t2ev_data_immed+0x1f4>
mov    -0x34(%rbp),%eax
mov    %eax,-0x74(%rbp)
jmp    1321 <t2ev_data_immed+0x201>
mov    $0x20,%eax
mov    %eax,-0x74(%rbp)
jmp    1321 <t2ev_data_immed+0x201>
mov    -0x50(%rbp),%r10
mov    -0x54(%rbp),%r9d
mov    -0x58(%rbp),%r8d
mov    -0x5c(%rbp),%ecx
mov    -0x68(%rbp),%rdx
mov    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%eax
lea    0xd6a(%rip),%rsi
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
movl   $0x1,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
shr    $0xa,%eax
and    $0x1c,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%ecx
lea    0xd3e(%rip),%rdx
lea    0xd35(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    -0x8(%rbp),%eax
and    $0x1f,%eax
add    $0x1,%eax
lea    0xd1f(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
mov    -0x8(%rbp),%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
shr    $0xa,%eax
and    $0x1c,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0xf,-0x2c(%rbp)
jne    141e <t2ev_data_immed+0x2fe>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x8(%rbp),%r8d
and    $0x1f,%r8d
add    $0x1,%r8d
sub    -0x34(%rbp),%r8d
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    144a <t2ev_data_immed+0x32a>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x8(%rbp),%r9d
and    $0x1f,%r9d
add    $0x1,%r9d
sub    -0x34(%rbp),%r9d
lea    0xcbf(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    -0x34(%rbp),%eax
lea    0xc9b(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e2 <t2ev_data_immed+0x3c2>
mov    -0xc(%rbp),%edi
call   1030 <thumb_alignpc4@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     14b8 <t2ev_data_immed+0x398>
mov    -0x34(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    14c3 <t2ev_data_immed+0x3a3>
mov    -0x34(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xc60(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2ev_data_immed>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
rol    $0xb,%edi
and    $0x8000000f,%edi
mov    $0xffffffff,%r15d
cmp    $0xe,%edi
ja     1331 <t2ev_data_immed+0x211>
mov    %rcx,%r14
mov    %ebx,%r9d
shr    $0x10,%r9d
and    $0xf,%r9d
mov    %ebx,%r12d
shr    $0x8,%r12d
and    $0xf,%r12d
movzbl %bl,%edx
mov    %ebx,%eax
shr    $0x4,%eax
mov    %eax,%ecx
and    $0x700,%ecx
or     %edx,%ecx
mov    %ebx,%ebp
shr    $0xf,%ebp
and    $0x800,%ebp
or     %ecx,%ebp
xor    %r10d,%r10d
lea    0xf0b(%rip),%rdx
lea    0xe71(%rip),%rcx
movslq (%rcx,%rdi,4),%rdi
add    %rcx,%rdi
jmp    *%rdi
mov    $0x1,%r10d
lea    0xeec(%rip),%rdx
mov    %ebx,%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %ebx,%ecx
shr    $0xa,%ecx
and    $0x1c,%ecx
or     %eax,%ecx
mov    %ebx,%r8d
and    $0x1f,%r8d
add    %r10d,%r8d
test   $0x200000,%ebx
lea    0xecb(%rip),%rax
lea    0xec0(%rip),%rsi
cmove  %rax,%rsi
test   %ecx,%ecx
mov    $0x20,%eax
cmovne %ecx,%eax
mov    %rsi,(%rsp)
mov    %eax,0x8(%rsp)
lea    0xe82(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%ecx
jmp    132a <t2ev_data_immed+0x20a>
cmp    $0xf,%r9d
jne    12e2 <t2ev_data_immed+0x1c2>
mov    %esi,%edi
call   1030 <thumb_alignpc4@plt>
add    %ebp,%eax
jmp    12c7 <t2ev_data_immed+0x1a7>
and    $0xf000,%eax
or     %eax,%ebp
lea    0xe37(%rip),%rsi
jmp    12a1 <t2ev_data_immed+0x181>
lea    0xe62(%rip),%rdx
mov    %ebx,%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %ebx,%ebp
shr    $0xa,%ebp
and    $0x1c,%ebp
or     %eax,%ebp
and    $0x1f,%ebx
add    $0x1,%ebx
mov    %ebx,(%rsp)
lea    0xe4c(%rip),%rsi
jmp    131b <t2ev_data_immed+0x1fb>
mov    %ebx,%eax
shr    $0x6,%eax
and    $0x3,%eax
mov    %ebx,%r8d
shr    $0xa,%r8d
and    $0x1c,%r8d
or     %eax,%r8d
and    $0x1f,%ebx
sub    %r8d,%ebx
add    $0x1,%ebx
cmp    $0xf,%r9d
jne    12eb <t2ev_data_immed+0x1cb>
lea    0xe35(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%edx
mov    %r8d,%ecx
mov    %ebx,%r8d
jmp    12af <t2ev_data_immed+0x18f>
and    $0xf000,%eax
or     %eax,%ebp
lea    0xda0(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1331 <t2ev_data_immed+0x211>
cmp    $0xf,%r9d
jne    130a <t2ev_data_immed+0x1ea>
mov    %esi,%edi
call   1030 <thumb_alignpc4@plt>
sub    %ebp,%eax
lea    0xe2e(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1331 <t2ev_data_immed+0x211>
lea    0xd53(%rip),%rdx
jmp    1311 <t2ev_data_immed+0x1f1>
lea    0xdd8(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%edx
mov    %r9d,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1331 <t2ev_data_immed+0x211>
lea    0xd47(%rip),%rdx
mov    %ebp,(%rsp)
lea    0xdc7(%rip),%rsi
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12d,%ecx
mov    %r9d,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r15d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.arm_instruction = type { i32 }
@.str = [5 x i8] c"ADDW\00"
@.str.1 = [23 x i8] c"MOVW\09r%d, #%d\09; %.3x\00"
@.str.2 = [5 x i8] c"SUBW\00"
@.str.3 = [23 x i8] c"MOVT\09r%d, #%d\09; %.4x\00"
@.str.4 = [29 x i8] c"%sSAT\09r%d, #%d, r%d, %s #%d\09\00"
@.str.5 = [2 x i8] c"S\00"
@.str.6 = [2 x i8] c"U\00"
@.str.7 = [4 x i8] c"ASR\00"
@.str.8 = [4 x i8] c"LSL\00"
@.str.9 = [26 x i8] c"%sBFX\09r%d, r%d, #%d, #%d\09\00"
@.str.10 = [19 x i8] c"BFC\09r%d, #%d, #%d\09\00"
@.str.11 = [24 x i8] c"BFI\09r%d, r%d, #%d, #%d\09\00"
@.str.12 = [26 x i8] c"%s\09r%d, r%d, #%d\09; %.3x\00"
@.str.13 = [18 x i8] c"ADR.W\09r%d, %.8x\00"
define i32 @t2ev_data_immed(i32 %0, i32 %1, %struct.arm_instruction* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.arm_instruction*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store %struct.arm_instruction* %2, %struct.arm_instruction** %8
store i8* %3, i8** %9
store i8* null, i8** %10
%16 = load i32, i32* %6
%17 = lshr i32 %16, 16
%18 = and i32 %17, 15
store i32 %18, i32* %11
%19 = load i32, i32* %6
%20 = lshr i32 %19, 8
%21 = and i32 %20, 15
store i32 %21, i32* %12
store i32 0, i32* %14
store i32 0, i32* %15
%22 = load i32, i32* %6
%23 = and i32 %22, 255
%24 = load i32, i32* %6
%25 = and i32 %24, 28672
%26 = lshr i32 %25, 4
%27 = or i32 %23, %26
store i32 %27, i32* %13
%28 = load i32, i32* %6
%29 = and i32 %28, 67108864
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %4
%32 = load i32, i32* %13
%33 = or i32 %32, 2048
store i32 %33, i32* %13
br label %34
34: ; preds = %31, %4
%35 = load i32, i32* %6
%36 = lshr i32 %35, 20
%37 = and i32 %36, 31
switch i32 %37, label %159 [
i32 0, label %38
i32 4, label %43
i32 10, label %54
i32 12, label %59
i32 16, label %70
i32 18, label %70
i32 24, label %71
i32 26, label %71
i32 20, label %104
i32 28, label %105
i32 22, label %126
]
38: ; preds = %34
%39 = load i32, i32* %11
%40 = icmp eq i32 %39, 15
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 1, i32* %14
br label %168
42: ; preds = %38
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %10
br label %160
43: ; preds = %34
%44 = load i32, i32* %6
%45 = lshr i32 %44, 4
%46 = and i32 %45, 61440
%47 = load i32, i32* %13
%48 = or i32 %47, %46
store i32 %48, i32* %13
%49 = load i8*, i8** %9
%50 = load i32, i32* %12
%51 = load i32, i32* %13
%52 = load i32, i32* %13
%53 = call i32 (i8*, i8*, ...) @sprintf(i8* %49, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %51, i32 %52)
store i32 0, i32* %5
br label %186
54: ; preds = %34
%55 = load i32, i32* %11
%56 = icmp eq i32 %55, 15
br i1 %56, label %57, label %58
57: ; preds = %54
br label %168
58: ; preds = %54
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %10
br label %160
59: ; preds = %34
%60 = load i32, i32* %6
%61 = lshr i32 %60, 4
%62 = and i32 %61, 61440
%63 = load i32, i32* %13
%64 = or i32 %63, %62
store i32 %64, i32* %13
%65 = load i8*, i8** %9
%66 = load i32, i32* %12
%67 = load i32, i32* %13
%68 = load i32, i32* %13
%69 = call i32 (i8*, i8*, ...) @sprintf(i8* %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %66, i32 %67, i32 %68)
store i32 0, i32* %5
br label %186
70: ; preds = %34, %34
store i32 1, i32* %15
br label %71
71: ; preds = %34, %34, %70
%72 = load i32, i32* %6
%73 = lshr i32 %72, 6
%74 = and i32 %73, 3
store i32 %74, i32* %13
%75 = load i32, i32* %6
%76 = lshr i32 %75, 10
%77 = and i32 %76, 28
%78 = load i32, i32* %13
%79 = or i32 %78, %77
store i32 %79, i32* %13
%80 = load i8*, i8** %9
%81 = load i32, i32* %15
%82 = icmp ne i32 %81, 0
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%85 = load i32, i32* %12
%86 = load i32, i32* %6
%87 = and i32 %86, 31
%88 = load i32, i32* %15
%89 = add nsw i32 %87, %88
%90 = load i32, i32* %11
%91 = load i32, i32* %6
%92 = and i32 %91, 2097152
%93 = icmp ne i32 %92, 0
%94 = zext i1 %93 to i64
%95 = select i1 %93, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
%96 = load i32, i32* %13
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %71
%99 = load i32, i32* %13
br label %101
100: ; preds = %71
br label %101
101: ; preds = %100, %98
%102 = phi i32 [ %99, %98 ], [ 32, %100 ]
%103 = call i32 (i8*, i8*, ...) @sprintf(i8* %80, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %84, i32 %85, i32 %89, i32 %90, i8* %95, i32 %102)
store i32 0, i32* %5
br label %186
104: ; preds = %34
store i32 1, i32* %15
br label %105
105: ; preds = %34, %104
%106 = load i32, i32* %6
%107 = lshr i32 %106, 6
%108 = and i32 %107, 3
store i32 %108, i32* %13
%109 = load i32, i32* %6
%110 = lshr i32 %109, 10
%111 = and i32 %110, 28
%112 = load i32, i32* %13
%113 = or i32 %112, %111
store i32 %113, i32* %13
%114 = load i8*, i8** %9
%115 = load i32, i32* %15
%116 = icmp ne i32 %115, 0
%117 = zext i1 %116 to i64
%118 = select i1 %116, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%119 = load i32, i32* %12
%120 = load i32, i32* %11
%121 = load i32, i32* %13
%122 = load i32, i32* %6
%123 = and i32 %122, 31
%124 = add nsw i32 %123, 1
%125 = call i32 (i8*, i8*, ...) @sprintf(i8* %114, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %118, i32 %119, i32 %120, i32 %121, i32 %124)
store i32 0, i32* %5
br label %186
126: ; preds = %34
%127 = load i32, i32* %6
%128 = lshr i32 %127, 6
%129 = and i32 %128, 3
store i32 %129, i32* %13
%130 = load i32, i32* %6
%131 = lshr i32 %130, 10
%132 = and i32 %131, 28
%133 = load i32, i32* %13
%134 = or i32 %133, %132
store i32 %134, i32* %13
%135 = load i32, i32* %11
%136 = icmp eq i32 %135, 15
br i1 %136, label %137, label %147
137: ; preds = %126
%138 = load i8*, i8** %9
%139 = load i32, i32* %12
%140 = load i32, i32* %13
%141 = load i32, i32* %6
%142 = and i32 %141, 31
%143 = add nsw i32 %142, 1
%144 = load i32, i32* %13
%145 = sub i32 %143, %144
%146 = call i32 (i8*, i8*, ...) @sprintf(i8* %138, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %139, i32 %140, i32 %145)
br label %158
147: ; preds = %126
%148 = load i8*, i8** %9
%149 = load i32, i32* %12
%150 = load i32, i32* %11
%151 = load i32, i32* %13
%152 = load i32, i32* %6
%153 = and i32 %152, 31
%154 = add nsw i32 %153, 1
%155 = load i32, i32* %13
%156 = sub i32 %154, %155
%157 = call i32 (i8*, i8*, ...) @sprintf(i8* %148, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %149, i32 %150, i32 %151, i32 %156)
br label %158
158: ; preds = %147, %137
store i32 0, i32* %5
br label %186
159: ; preds = %34
store i32 -1, i32* %5
br label %186
160: ; preds = %58, %42
%161 = load i8*, i8** %9
%162 = load i8*, i8** %10
%163 = load i32, i32* %12
%164 = load i32, i32* %11
%165 = load i32, i32* %13
%166 = load i32, i32* %13
%167 = call i32 (i8*, i8*, ...) @sprintf(i8* %161, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* %162, i32 %163, i32 %164, i32 %165, i32 %166)
store i32 0, i32* %5
br label %186
168: ; preds = %57, %41
%169 = load i32, i32* %7
%170 = call i32 @thumb_alignpc4(i32 %169)
store i32 %170, i32* %7
%171 = load i32, i32* %14
%172 = icmp ne i32 %171, 0
br i1 %172, label %173, label %177
173: ; preds = %168
%174 = load i32, i32* %13
%175 = load i32, i32* %7
%176 = add i32 %175, %174
store i32 %176, i32* %7
br label %181
177: ; preds = %168
%178 = load i32, i32* %13
%179 = load i32, i32* %7
%180 = sub i32 %179, %178
store i32 %180, i32* %7
br label %181
181: ; preds = %177, %173
%182 = load i8*, i8** %9
%183 = load i32, i32* %12
%184 = load i32, i32* %7
%185 = call i32 (i8*, i8*, ...) @sprintf(i8* %182, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 %183, i32 %184)
store i32 0, i32* %5
br label %186
186: ; preds = %181, %160, %159, %158, %105, %101, %59, %43
%187 = load i32, i32* %5
ret i32 %187
}

LLVM IR (-O2):
%struct.arm_instruction = type { i32 }
@.str = [5 x i8] c"ADDW\00"
@.str.1 = [23 x i8] c"MOVW\09r%d, #%d\09; %.3x\00"
@.str.2 = [5 x i8] c"SUBW\00"
@.str.3 = [23 x i8] c"MOVT\09r%d, #%d\09; %.4x\00"
@.str.4 = [29 x i8] c"%sSAT\09r%d, #%d, r%d, %s #%d\09\00"
@.str.5 = [2 x i8] c"S\00"
@.str.6 = [2 x i8] c"U\00"
@.str.7 = [4 x i8] c"ASR\00"
@.str.8 = [4 x i8] c"LSL\00"
@.str.9 = [26 x i8] c"%sBFX\09r%d, r%d, #%d, #%d\09\00"
@.str.10 = [19 x i8] c"BFC\09r%d, #%d, #%d\09\00"
@.str.11 = [24 x i8] c"BFI\09r%d, r%d, #%d, #%d\09\00"
@.str.12 = [26 x i8] c"%s\09r%d, r%d, #%d\09; %.3x\00"
@.str.13 = [18 x i8] c"ADR.W\09r%d, %.8x\00"
define i32 @t2ev_data_immed(i32 %0, i32 %1, %struct.arm_instruction* nocapture readnone %2, i8* nocapture writeonly %3) {
%5 = lshr i32 %0, 16
%6 = and i32 %5, 15
%7 = lshr i32 %0, 8
%8 = and i32 %7, 15
%9 = and i32 %0, 255
%10 = lshr i32 %0, 4
%11 = and i32 %10, 1792
%12 = or i32 %11, %9
%13 = lshr i32 %0, 15
%14 = and i32 %13, 2048
%15 = or i32 %12, %14
%16 = lshr i32 %0, 21
%17 = and i32 %16, 15
%18 = shl i32 %0, 11
%19 = and i32 %18, -2147483648
%20 = or i32 %17, %19
switch i32 %20, label %87 [
i32 0, label %21
i32 2, label %23
i32 5, label %27
i32 6, label %29
i32 8, label %33
i32 9, label %33
i32 12, label %34
i32 13, label %34
i32 10, label %50
i32 14, label %51
i32 11, label %61
]
21: ; preds = %4
%22 = icmp eq i32 %6, 15
br i1 %22, label %78, label %75
23: ; preds = %4
%24 = and i32 %10, 61440
%25 = or i32 %15, %24
%26 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %25, i32 %25)
br label %87
27: ; preds = %4
%28 = icmp eq i32 %6, 15
br i1 %28, label %81, label %75
29: ; preds = %4
%30 = and i32 %10, 61440
%31 = or i32 %15, %30
%32 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %31, i32 %31)
br label %87
33: ; preds = %4, %4
br label %34
34: ; preds = %4, %4, %33
%35 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %33 ]
%36 = phi i32 [ 0, %4 ], [ 0, %4 ], [ 1, %33 ]
%37 = lshr i32 %0, 6
%38 = and i32 %37, 3
%39 = lshr i32 %0, 10
%40 = and i32 %39, 28
%41 = or i32 %38, %40
%42 = and i32 %0, 31
%43 = add nuw nsw i32 %36, %42
%44 = and i32 %0, 2097152
%45 = icmp eq i32 %44, 0
%46 = select i1 %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%47 = icmp eq i32 %41, 0
%48 = select i1 %47, i32 32, i32 %41
%49 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %35, i32 %8, i32 %43, i32 %6, i8* %46, i32 %48)
br label %87
50: ; preds = %4
br label %51
51: ; preds = %4, %50
%52 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %50 ]
%53 = lshr i32 %0, 6
%54 = and i32 %53, 3
%55 = lshr i32 %0, 10
%56 = and i32 %55, 28
%57 = or i32 %54, %56
%58 = and i32 %0, 31
%59 = add nuw nsw i32 %58, 1
%60 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %52, i32 %8, i32 %6, i32 %57, i32 %59)
br label %87
61: ; preds = %4
%62 = lshr i32 %0, 6
%63 = and i32 %62, 3
%64 = lshr i32 %0, 10
%65 = and i32 %64, 28
%66 = or i32 %63, %65
%67 = icmp eq i32 %6, 15
%68 = and i32 %0, 31
%69 = add nuw nsw i32 %68, 1
%70 = sub nsw i32 %69, %66
br i1 %67, label %71, label %73
71: ; preds = %61
%72 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %8, i32 %66, i32 %70)
br label %87
73: ; preds = %61
%74 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %8, i32 %6, i32 %66, i32 %70)
br label %87
75: ; preds = %27, %21
%76 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %21 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %27 ]
%77 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* %76, i32 %8, i32 %6, i32 %15, i32 %15)
br label %87
78: ; preds = %21
%79 = tail call i32 @thumb_alignpc4(i32 %1)
%80 = add i32 %79, %15
br label %84
81: ; preds = %27
%82 = tail call i32 @thumb_alignpc4(i32 %1)
%83 = sub i32 %82, %15
br label %84
84: ; preds = %78, %81
%85 = phi i32 [ %83, %81 ], [ %80, %78 ]
%86 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 %8, i32 %85)
br label %87
87: ; preds = %4, %71, %73, %84, %75, %51, %34, %29, %23
%88 = phi i32 [ 0, %51 ], [ 0, %34 ], [ 0, %29 ], [ 0, %84 ], [ 0, %75 ], [ 0, %23 ], [ 0, %73 ], [ 0, %71 ], [ -1, %4 ]
ret i32 %88
}