int t2ev_load_halfword(unsigned opcode, unsigned address,
                       struct arm_instruction *instruction, char *cp) {
  int rn = (opcode >> 16) & 0xf;
  int rt = (opcode >> 12) & 0xf;
  int op2 = (opcode >> 6) & 0x3f;
  char *sign = "";
  unsigned immed;
  if (rt == 0xf) {
    sprintf(cp, "HINT (UNALLOCATED)");
    return 0;
  }
  if (opcode & (1 << 24))
    sign = "S";
  if ((opcode & (1 << 23)) == 0) {
    if (rn == 0xf) {
    ldrh_literal:
      immed = opcode & 0xfff;
      address = thumb_alignpc4(address);
      if (opcode & (1 << 23))
        address += immed;
      else
        address -= immed;
      sprintf(cp, "LDR%sH\tr%d, %#8.8x", sign, rt, address);
      return 0;
    }
    if (op2 == 0) {
      int rm = opcode & 0xf;
      immed = (opcode >> 4) & 0x3;
      sprintf(cp, "LDR%sH.W\tr%d, [r%d, r%d, LSL #%d]", sign, rt, rn, rm,
              immed);
      return 0;
    }
    if ((op2 & 0x3c) == 0x38) {
      immed = opcode & 0xff;
      sprintf(cp, "LDR%sHT\tr%d, [r%d, #%d]\t; %#2.2x", sign, rt, rn, immed,
              immed);
      return 0;
    }
    if ((op2 & 0x3c) == 0x30 || (op2 & 0x24) == 0x24) {
      char *p1 = "", *p2 = "]";
      immed = opcode & 0xff;
      if (!(opcode & 0x200))
        immed = -immed;
      if (opcode & 0x100) {
        if (opcode & 0x400)
          p2 = "]!";
        else {
          p1 = "]";
          p2 = "";
        }
      }
      sprintf(cp, "LDR%sH\tr%d, [r%d%s, #%d%s\t; %#8.8x", sign, rt, rn, p1,
              immed, p2, immed);
      return 0;
    }
  } else {
    if (rn == 0xf)
      goto ldrh_literal;
    immed = opcode & 0xfff;
    sprintf(cp, "LDR%sH%s\tr%d, [r%d, #%d]\t; %#6.6x", sign, *sign ? "" : ".W",
            rt, rn, immed, immed);
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<t2ev_load_halfword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
and    $0xf,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
shr    $0xc,%eax
and    $0xf,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x6,%eax
and    $0x3f,%eax
mov    %eax,-0x2c(%rbp)
lea    0xf0c(%rip),%rax
mov    %rax,-0x38(%rbp)
cmpl   $0xf,-0x28(%rbp)
jne    118d <t2ev_load_halfword+0x6d>
mov    -0x20(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
mov    -0x8(%rbp),%eax
and    $0x1000000,%eax
cmp    $0x0,%eax
je     11a9 <t2ev_load_halfword+0x89>
lea    0xe6e(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
and    $0x800000,%eax
cmp    $0x0,%eax
jne    13c2 <t2ev_load_halfword+0x2a2>
cmpl   $0xf,-0x24(%rbp)
jne    1234 <t2ev_load_halfword+0x114>
jmp    11c9 <t2ev_load_halfword+0xa9>
mov    -0x8(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1030 <thumb_alignpc4@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x800000,%eax
cmp    $0x0,%eax
je     1200 <t2ev_load_halfword+0xe0>
mov    -0x3c(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    120b <t2ev_load_halfword+0xeb>
mov    -0x3c(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
cmpl   $0x0,-0x2c(%rbp)
jne    1286 <t2ev_load_halfword+0x166>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
and    $0x3,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x40(%rbp),%r9d
mov    -0x3c(%rbp),%eax
lea    0xdb8(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
mov    -0x2c(%rbp),%eax
and    $0x3c,%eax
cmp    $0x38,%eax
jne    12d3 <t2ev_load_halfword+0x1b3>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x3c(%rbp),%r9d
mov    -0x3c(%rbp),%eax
lea    0xd8d(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
mov    -0x2c(%rbp),%eax
and    $0x3c,%eax
cmp    $0x30,%eax
je     12f1 <t2ev_load_halfword+0x1d1>
mov    -0x2c(%rbp),%eax
and    $0x24,%eax
cmp    $0x24,%eax
jne    13bd <t2ev_load_halfword+0x29d>
lea    0xd75(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xd45(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
jne    132b <t2ev_load_halfword+0x20b>
xor    %eax,%eax
sub    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1378 <t2ev_load_halfword+0x258>
mov    -0x8(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     135d <t2ev_load_halfword+0x23d>
lea    0xd17(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    1373 <t2ev_load_halfword+0x253>
lea    0xce4(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xcfe(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    1378 <t2ev_load_halfword+0x258>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x48(%rbp),%r9
mov    -0x3c(%rbp),%r11d
mov    -0x50(%rbp),%r10
mov    -0x3c(%rbp),%eax
lea    0xcd1(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
jmp    1431 <t2ev_load_halfword+0x311>
cmpl   $0xf,-0x24(%rbp)
jne    13d1 <t2ev_load_halfword+0x2b1>
jmp    11c9 <t2ev_load_halfword+0xa9>
mov    -0x8(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x38(%rbp),%rax
movsbl (%rax),%esi
lea    0xcc1(%rip),%rcx
lea    0xc74(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x3c(%rbp),%r10d
mov    -0x3c(%rbp),%eax
lea    0xc7b(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1438 <t2ev_load_halfword+0x318>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2ev_load_halfword>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edi,%ebx
shr    $0xc,%ebx
and    $0xf,%ebx
cmp    $0xf,%ebx
jne    1156 <t2ev_load_halfword+0x36>
movups 0xebe(%rip),%xmm0
movups %xmm0,(%r14)
movl   $0x294445,0xf(%r14)
xor    %r13d,%r13d
jmp    128d <t2ev_load_halfword+0x16d>
mov    %edi,%r15d
mov    %edi,%r9d
shr    $0x10,%r9d
and    $0xf,%r9d
test   $0x1000000,%edi
lea    0xefc(%rip),%rcx
lea    0xe9b(%rip),%r12
cmove  %rcx,%r12
test   $0x800000,%edi
jne    11db <t2ev_load_halfword+0xbb>
cmp    $0xf,%r9d
je     11e1 <t2ev_load_halfword+0xc1>
mov    %r15d,%eax
test   $0xfc0,%r15d
je     1259 <t2ev_load_halfword+0x139>
shr    $0x6,%eax
and    $0x3c,%eax
cmp    $0x30,%eax
je     12b1 <t2ev_load_halfword+0x191>
cmp    $0x38,%eax
jne    129f <t2ev_load_halfword+0x17f>
movzbl %r15b,%r10d
sub    $0x8,%rsp
lea    0xe89(%rip),%rsi
xor    %r13d,%r13d
mov    %r14,%rdi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %r9d,%r8d
mov    %r10d,%r9d
xor    %eax,%eax
push   %r10
jmp    1284 <t2ev_load_halfword+0x164>
cmp    $0xf,%r9d
jne    1222 <t2ev_load_halfword+0x102>
mov    %r15d,%ebp
and    $0xfff,%ebp
xor    %r13d,%r13d
mov    %esi,%edi
xor    %eax,%eax
call   1030 <thumb_alignpc4@plt>
mov    %ebp,%r8d
neg    %r8d
test   $0x800000,%r15d
cmovne %ebp,%r8d
add    %eax,%r8d
lea    0xe04(%rip),%rsi
mov    %r14,%rdi
mov    %r12,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    128d <t2ev_load_halfword+0x16d>
and    $0xfff,%r15d
cmpb   $0x0,(%r12)
lea    0xe7e(%rip),%rax
cmove  %rax,%rcx
lea    0xe51(%rip),%rsi
xor    %r13d,%r13d
mov    %r14,%rdi
mov    %r12,%rdx
mov    %ebx,%r8d
xor    %eax,%eax
push   %r15
push   %r15
call   1040 <sprintf@plt>
jmp    1289 <t2ev_load_halfword+0x169>
and    $0xf,%eax
shr    $0x4,%r15d
and    $0x3,%r15d
sub    $0x8,%rsp
lea    0xdb9(%rip),%rsi
xor    %r13d,%r13d
mov    %r14,%rdi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
push   %r15
call   1040 <sprintf@plt>
add    $0x10,%rsp
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%eax
not    %eax
mov    $0xffffffff,%r13d
test   $0x900,%eax
jne    128d <t2ev_load_halfword+0x16d>
movzbl %r15b,%eax
mov    %eax,%r10d
neg    %r10d
test   $0x200,%r15d
cmovne %eax,%r10d
test   $0x400,%r15d
lea    0xd74(%rip),%rdx
mov    %rcx,%rax
cmove  %rdx,%rax
lea    0xd89(%rip),%rbp
cmove  %rcx,%rbp
test   $0x100,%r15d
cmove  %rcx,%rax
cmove  %rdx,%rbp
sub    $0x8,%rsp
lea    0xd6e(%rip),%rsi
xor    %r13d,%r13d
mov    %r14,%rdi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %r9d,%r8d
mov    %rax,%r9
xor    %eax,%eax
push   %r10
push   %rbp
push   %r10
call   1040 <sprintf@plt>
add    $0x20,%rsp
jmp    128d <t2ev_load_halfword+0x16d>

LLVM IR (-O0):
%struct.arm_instruction = type opaque
@.str = [1 x i8] zeroinitializer
@.str.1 = [19 x i8] c"HINT (UNALLOCATED)\00"
@.str.2 = [2 x i8] c"S\00"
@.str.3 = [19 x i8] c"LDR%sH\09r%d, %.8x\00"
@.str.4 = [34 x i8] c"LDR%sH.W\09r%d, [r%d, r%d, LSL #%d]\00"
@.str.5 = [33 x i8] c"LDR%sHT\09r%d, [r%d, #%d]\09; %.2x\00"
@.str.6 = [2 x i8] c"]\00"
@.str.7 = [3 x i8] c"]!\00"
@.str.8 = [35 x i8] c"LDR%sH\09r%d, [r%d%s, #%d%s\09; %.8x\00"
@.str.9 = [34 x i8] c"LDR%sH%s\09r%d, [r%d, #%d]\09; %.6x\00"
@.str.10 = [3 x i8] c".W\00"
define i32 @t2ev_load_halfword(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 i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store %struct.arm_instruction* %2, %struct.arm_instruction** %8
store i8* %3, i8** %9
%18 = load i32, i32* %6
%19 = lshr i32 %18, 16
%20 = and i32 %19, 15
store i32 %20, i32* %10
%21 = load i32, i32* %6
%22 = lshr i32 %21, 12
%23 = and i32 %22, 15
store i32 %23, i32* %11
%24 = load i32, i32* %6
%25 = lshr i32 %24, 6
%26 = and i32 %25, 63
store i32 %26, i32* %12
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %13
%27 = load i32, i32* %11
%28 = icmp eq i32 %27, 15
br i1 %28, label %29, label %32
29: ; preds = %4
%30 = load i8*, i8** %9
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %157
32: ; preds = %4
%33 = load i32, i32* %6
%34 = and i32 %33, 16777216
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %13
br label %37
37: ; preds = %36, %32
%38 = load i32, i32* %6
%39 = and i32 %38, 8388608
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %136
41: ; preds = %37
%42 = load i32, i32* %10
%43 = icmp eq i32 %42, 15
br i1 %43, label %44, label %67
44: ; preds = %41
br label %45
45: ; preds = %139, %44
%46 = load i32, i32* %6
%47 = and i32 %46, 4095
store i32 %47, i32* %14
%48 = load i32, i32* %7
%49 = call i32 (i32, ...) bitcast (i32 (...)* @thumb_alignpc4 to i32 (i32, ...)*)(i32 %48)
store i32 %49, i32* %7
%50 = load i32, i32* %6
%51 = and i32 %50, 8388608
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %45
%54 = load i32, i32* %14
%55 = load i32, i32* %7
%56 = add i32 %55, %54
store i32 %56, i32* %7
br label %61
57: ; preds = %45
%58 = load i32, i32* %14
%59 = load i32, i32* %7
%60 = sub i32 %59, %58
store i32 %60, i32* %7
br label %61
61: ; preds = %57, %53
%62 = load i8*, i8** %9
%63 = load i8*, i8** %13
%64 = load i32, i32* %11
%65 = load i32, i32* %7
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %63, i32 %64, i32 %65)
store i32 0, i32* %5
br label %157
67: ; preds = %41
%68 = load i32, i32* %12
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %83
70: ; preds = %67
%71 = load i32, i32* %6
%72 = and i32 %71, 15
store i32 %72, i32* %15
%73 = load i32, i32* %6
%74 = lshr i32 %73, 4
%75 = and i32 %74, 3
store i32 %75, i32* %14
%76 = load i8*, i8** %9
%77 = load i8*, i8** %13
%78 = load i32, i32* %11
%79 = load i32, i32* %10
%80 = load i32, i32* %15
%81 = load i32, i32* %14
%82 = call i32 (i8*, i8*, ...) @sprintf(i8* %76, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %77, i32 %78, i32 %79, i32 %80, i32 %81)
store i32 0, i32* %5
br label %157
83: ; preds = %67
%84 = load i32, i32* %12
%85 = and i32 %84, 60
%86 = icmp eq i32 %85, 56
br i1 %86, label %87, label %97
87: ; preds = %83
%88 = load i32, i32* %6
%89 = and i32 %88, 255
store i32 %89, i32* %14
%90 = load i8*, i8** %9
%91 = load i8*, i8** %13
%92 = load i32, i32* %11
%93 = load i32, i32* %10
%94 = load i32, i32* %14
%95 = load i32, i32* %14
%96 = call i32 (i8*, i8*, ...) @sprintf(i8* %90, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %91, i32 %92, i32 %93, i32 %94, i32 %95)
store i32 0, i32* %5
br label %157
97: ; preds = %83
%98 = load i32, i32* %12
%99 = and i32 %98, 60
%100 = icmp eq i32 %99, 48
br i1 %100, label %105, label %101
101: ; preds = %97
%102 = load i32, i32* %12
%103 = and i32 %102, 36
%104 = icmp eq i32 %103, 36
br i1 %104, label %105, label %135
105: ; preds = %101, %97
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %16
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %17
%106 = load i32, i32* %6
%107 = and i32 %106, 255
store i32 %107, i32* %14
%108 = load i32, i32* %6
%109 = and i32 %108, 512
%110 = icmp ne i32 %109, 0
br i1 %110, label %114, label %111
111: ; preds = %105
%112 = load i32, i32* %14
%113 = sub i32 0, %112
store i32 %113, i32* %14
br label %114
114: ; preds = %111, %105
%115 = load i32, i32* %6
%116 = and i32 %115, 256
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %125
118: ; preds = %114
%119 = load i32, i32* %6
%120 = and i32 %119, 1024
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %118
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %17
br label %124
123: ; preds = %118
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %16
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %17
br label %124
124: ; preds = %123, %122
br label %125
125: ; preds = %124, %114
%126 = load i8*, i8** %9
%127 = load i8*, i8** %13
%128 = load i32, i32* %11
%129 = load i32, i32* %10
%130 = load i8*, i8** %16
%131 = load i32, i32* %14
%132 = load i8*, i8** %17
%133 = load i32, i32* %14
%134 = call i32 (i8*, i8*, ...) @sprintf(i8* %126, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i8* %127, i32 %128, i32 %129, i8* %130, i32 %131, i8* %132, i32 %133)
store i32 0, i32* %5
br label %157
135: ; preds = %101
br label %156
136: ; preds = %37
%137 = load i32, i32* %10
%138 = icmp eq i32 %137, 15
br i1 %138, label %139, label %140
139: ; preds = %136
br label %45
140: ; preds = %136
%141 = load i32, i32* %6
%142 = and i32 %141, 4095
store i32 %142, i32* %14
%143 = load i8*, i8** %9
%144 = load i8*, i8** %13
%145 = load i8*, i8** %13
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = icmp ne i32 %147, 0
%149 = zext i1 %148 to i64
%150 = select i1 %148, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0)
%151 = load i32, i32* %11
%152 = load i32, i32* %10
%153 = load i32, i32* %14
%154 = load i32, i32* %14
%155 = call i32 (i8*, i8*, ...) @sprintf(i8* %143, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* %144, i8* %150, i32 %151, i32 %152, i32 %153, i32 %154)
store i32 0, i32* %5
br label %157
156: ; preds = %135
store i32 -1, i32* %5
br label %157
157: ; preds = %156, %140, %125, %87, %70, %61, %29
%158 = load i32, i32* %5
ret i32 %158
}

LLVM IR (-O2):
%struct.arm_instruction = type opaque
@.str = [1 x i8] zeroinitializer
@.str.1 = [19 x i8] c"HINT (UNALLOCATED)\00"
@.str.2 = [2 x i8] c"S\00"
@.str.3 = [19 x i8] c"LDR%sH\09r%d, %.8x\00"
@.str.4 = [34 x i8] c"LDR%sH.W\09r%d, [r%d, r%d, LSL #%d]\00"
@.str.5 = [33 x i8] c"LDR%sHT\09r%d, [r%d, #%d]\09; %.2x\00"
@.str.6 = [2 x i8] c"]\00"
@.str.7 = [3 x i8] c"]!\00"
@.str.8 = [35 x i8] c"LDR%sH\09r%d, [r%d%s, #%d%s\09; %.8x\00"
@.str.9 = [34 x i8] c"LDR%sH%s\09r%d, [r%d, #%d]\09; %.6x\00"
@.str.10 = [3 x i8] c".W\00"
define i32 @t2ev_load_halfword(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, 12
%8 = and i32 %7, 15
%9 = lshr i32 %0, 6
%10 = icmp eq i32 %8, 15
br i1 %10, label %11, label %12
11: ; preds = %4
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(19) %3, i8* align 1 dereferenceable(19) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 19, i1 false)
br label %65
12: ; preds = %4
%13 = and i32 %0, 16777216
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%16 = and i32 %0, 8388608
%17 = icmp eq i32 %16, 0
%18 = icmp eq i32 %6, 15
br i1 %17, label %19, label %58
19: ; preds = %12
br i1 %18, label %20, label %27
20: ; preds = %58, %19
%21 = and i32 %0, 4095
%22 = tail call i32 (i32, ...) bitcast (i32 (...)* @thumb_alignpc4 to i32 (i32, ...)*)(i32 %1)
%23 = sub nsw i32 0, %21
%24 = select i1 %17, i32 %23, i32 %21
%25 = add i32 %22, %24
%26 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %15, i32 %8, i32 %25)
br label %65
27: ; preds = %19
%28 = and i32 %0, 4032
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = and i32 %0, 15
%32 = lshr i32 %0, 4
%33 = and i32 %32, 3
%34 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 %8, i32 %6, i32 %31, i32 %33)
br label %65
35: ; preds = %27
%36 = and i32 %9, 60
switch i32 %36, label %40 [
i32 56, label %37
i32 48, label %43
]
37: ; preds = %35
%38 = and i32 %0, 255
%39 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 %8, i32 %6, i32 %38, i32 %38)
br label %65
40: ; preds = %35
%41 = and i32 %0, 2304
%42 = icmp eq i32 %41, 2304
br i1 %42, label %43, label %65
43: ; preds = %35, %40
%44 = and i32 %0, 255
%45 = and i32 %0, 512
%46 = icmp eq i32 %45, 0
%47 = sub nsw i32 0, %44
%48 = select i1 %46, i32 %47, i32 %44
%49 = and i32 %0, 256
%50 = icmp eq i32 %49, 0
%51 = and i32 %0, 1024
%52 = icmp eq i32 %51, 0
%53 = select i1 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%54 = select i1 %52, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%55 = select i1 %50, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %53
%56 = select i1 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* %54
%57 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i8* %15, i32 %8, i32 %6, i8* %55, i32 %48, i8* %56, i32 %48)
br label %65
58: ; preds = %12
br i1 %18, label %20, label %59
59: ; preds = %58
%60 = and i32 %0, 4095
%61 = load i8, i8* %15
%62 = icmp eq i8 %61, 0
%63 = select i1 %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%64 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* %15, i8* %63, i32 %8, i32 %6, i32 %60, i32 %60)
br label %65
65: ; preds = %40, %59, %43, %37, %30, %20, %11
%66 = phi i32 [ 0, %11 ], [ 0, %20 ], [ 0, %30 ], [ 0, %37 ], [ 0, %43 ], [ 0, %59 ], [ -1, %40 ]
ret i32 %66
}