#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*/ Wd(int, int);
int /*<<< orphan*/ Wreg(int);
int /*<<< orphan*/ Ws(char *);
int /*<<< orphan*/ wRelative7(int, int);
int WinstF(int i, int code) {
  if (!(code & 0x800)) {
    int s = code & 7;
    int k = (code >> 3) & 0x7f;
    if (code & 0x400) {
      switch (s) {
      case 0:
        Ws("brsh  ");
        break;
      case 1:
        Ws("brne  ");
        break;
      case 2:
        Ws("brpl  ");
        break;
      case 3:
        Ws("brvc  ");
        break;
      case 4:
        Ws("brge  ");
        break;
      case 5:
        Ws("brhc  ");
        break;
      case 6:
        Ws("brtc  ");
        break;
      case 7:
        Ws("brid  ");
        break;
      }
    } else {
      switch (s) {
      case 0:
        Ws("brlo  ");
        break;
      case 1:
        Ws("breq  ");
        break;
      case 2:
        Ws("brmi  ");
        break;
      case 3:
        Ws("brvs  ");
        break;
      case 4:
        Ws("brlt  ");
        break;
      case 5:
        Ws("brhs  ");
        break;
      case 6:
        Ws("brts  ");
        break;
      case 7:
        Ws("brie  ");
        break;
      }
    }
    wRelative7(i, k);
  } else if ((code & 8) == 0) {
    int bit = code & 7;
    int reg = (code >> 4) & 0x1f;
    switch ((code >> 9) & 3) {
    case 0:
      Ws("bld   ");
      break;
    case 1:
      Ws("bst   ");
      break;
    case 2:
      Ws("sbrc  ");
      break;
    case 3:
      Ws("sbrs  ");
      break;
    }
    Wreg(reg);
    Ws(", ");
    Wd(bit, 1);
  } else {
    if (code != 0xffff) {
      Ws("???");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<WinstF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x800,%eax
cmp    $0x0,%eax
jne    12ef <WinstF+0x1af>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
and    $0x7f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     1232 <WinstF+0xf2>
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x7,%rax
ja     122d <WinstF+0xed>
mov    -0x20(%rbp),%rax
lea    0xe7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe9f(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe95(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe8b(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe81(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe77(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe6d(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe63(%rip),%rdi
call   1030 <Ws@plt>
jmp    122d <WinstF+0xed>
lea    0xe59(%rip),%rdi
call   1030 <Ws@plt>
jmp    12df <WinstF+0x19f>
mov    -0xc(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x7,%rax
ja     12da <WinstF+0x19a>
mov    -0x28(%rbp),%rax
lea    0xdb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe2a(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xe20(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xe16(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xe0c(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xe02(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xdf8(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xdee(%rip),%rdi
call   1030 <Ws@plt>
jmp    12da <WinstF+0x19a>
lea    0xde4(%rip),%rdi
call   1030 <Ws@plt>
jmp    12df <WinstF+0x19f>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <wRelative7@plt>
jmp    13c7 <WinstF+0x287>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    13a4 <WinstF+0x264>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
and    $0x1f,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x9,%eax
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     137e <WinstF+0x23e>
mov    -0x30(%rbp),%rax
lea    0xd0a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd7a(%rip),%rdi
call   1030 <Ws@plt>
jmp    137e <WinstF+0x23e>
lea    0xd70(%rip),%rdi
call   1030 <Ws@plt>
jmp    137e <WinstF+0x23e>
lea    0xd66(%rip),%rdi
call   1030 <Ws@plt>
jmp    137e <WinstF+0x23e>
lea    0xd5c(%rip),%rdi
call   1030 <Ws@plt>
mov    -0x18(%rbp),%edi
call   1060 <Wreg@plt>
lea    0xd4f(%rip),%rdi
call   1030 <Ws@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1050 <Wd@plt>
jmp    13c2 <WinstF+0x282>
cmpl   $0xffff,-0x8(%rbp)
je     13bd <WinstF+0x27d>
lea    0xd27(%rip),%rdi
call   1030 <Ws@plt>
jmp    13c2 <WinstF+0x282>
jmp    13c7 <WinstF+0x287>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WinstF>:
push   %rbp
push   %rbx
push   %rax
test   $0x800,%esi
jne    1186 <WinstF+0x46>
mov    %edi,%ebx
mov    %esi,%eax
and    $0x7,%eax
mov    %esi,%ebp
shr    $0x3,%ebp
and    $0x7f,%ebp
test   $0x400,%esi
lea    0x2c79(%rip),%rcx
lea    0x2c32(%rip),%rdx
cmove  %rcx,%rdx
mov    (%rdx,%rax,8),%rdi
call   1030 <Ws@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <wRelative7@plt>
jmp    11e7 <WinstF+0xa7>
test   $0x8,%sil
jne    11d3 <WinstF+0x93>
mov    %esi,%ebx
and    $0x7,%ebx
mov    %esi,%ebp
shr    $0x4,%ebp
and    $0x1f,%ebp
shr    $0x9,%esi
and    $0x3,%esi
lea    0xeee(%rip),%rax
movslq (%rax,%rsi,4),%rdi
add    %rax,%rdi
call   1030 <Ws@plt>
mov    %ebp,%edi
call   1060 <Wreg@plt>
lea    0xecc(%rip),%rdi
call   1030 <Ws@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <Wd@plt>
jmp    11e7 <WinstF+0xa7>
cmp    $0xffff,%esi
je     11e7 <WinstF+0xa7>
lea    0xead(%rip),%rdi
call   1030 <Ws@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"brsh \00"
@.str.1 = [7 x i8] c"brne \00"
@.str.2 = [7 x i8] c"brpl \00"
@.str.3 = [7 x i8] c"brvc \00"
@.str.4 = [7 x i8] c"brge \00"
@.str.5 = [7 x i8] c"brhc \00"
@.str.6 = [7 x i8] c"brtc \00"
@.str.7 = [7 x i8] c"brid \00"
@.str.8 = [7 x i8] c"brlo \00"
@.str.9 = [7 x i8] c"breq \00"
@.str.10 = [7 x i8] c"brmi \00"
@.str.11 = [7 x i8] c"brvs \00"
@.str.12 = [7 x i8] c"brlt \00"
@.str.13 = [7 x i8] c"brhs \00"
@.str.14 = [7 x i8] c"brts \00"
@.str.15 = [7 x i8] c"brie \00"
@.str.16 = [7 x i8] c"bld \00"
@.str.17 = [7 x i8] c"bst \00"
@.str.18 = [7 x i8] c"sbrc \00"
@.str.19 = [7 x i8] c"sbrs \00"
@.str.20 = [3 x i8] c", \00"
@.str.21 = [4 x i8] c"???\00"
define i32 @WinstF(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = and i32 %9, 2048
%11 = icmp ne i32 %10, 0
br i1 %11, label %63, label %12
12: ; preds = %2
%13 = load i32, i32* %4
%14 = and i32 %13, 7
store i32 %14, i32* %5
%15 = load i32, i32* %4
%16 = ashr i32 %15, 3
%17 = and i32 %16, 127
store i32 %17, i32* %6
%18 = load i32, i32* %4
%19 = and i32 %18, 1024
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %40
21: ; preds = %12
%22 = load i32, i32* %5
switch i32 %22, label %39 [
i32 0, label %23
i32 1, label %25
i32 2, label %27
i32 3, label %29
i32 4, label %31
i32 5, label %33
i32 6, label %35
i32 7, label %37
]
23: ; preds = %21
%24 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %39
25: ; preds = %21
%26 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %39
27: ; preds = %21
%28 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %39
29: ; preds = %21
%30 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %39
31: ; preds = %21
%32 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %39
33: ; preds = %21
%34 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %39
35: ; preds = %21
%36 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %39
37: ; preds = %21
%38 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %21, %37, %35, %33, %31, %29, %27, %25, %23
br label %59
40: ; preds = %12
%41 = load i32, i32* %5
switch i32 %41, label %58 [
i32 0, label %42
i32 1, label %44
i32 2, label %46
i32 3, label %48
i32 4, label %50
i32 5, label %52
i32 6, label %54
i32 7, label %56
]
42: ; preds = %40
%43 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %58
44: ; preds = %40
%45 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %58
46: ; preds = %40
%47 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %58
48: ; preds = %40
%49 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %58
50: ; preds = %40
%51 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %58
52: ; preds = %40
%53 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
br label %58
54: ; preds = %40
%55 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
br label %58
56: ; preds = %40
%57 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
br label %58
58: ; preds = %40, %56, %54, %52, %50, %48, %46, %44, %42
br label %59
59: ; preds = %58, %39
%60 = load i32, i32* %3
%61 = load i32, i32* %6
%62 = call i32 @wRelative7(i32 %60, i32 %61)
br label %97
63: ; preds = %2
%64 = load i32, i32* %4
%65 = and i32 %64, 8
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %90
67: ; preds = %63
%68 = load i32, i32* %4
%69 = and i32 %68, 7
store i32 %69, i32* %7
%70 = load i32, i32* %4
%71 = ashr i32 %70, 4
%72 = and i32 %71, 31
store i32 %72, i32* %8
%73 = load i32, i32* %4
%74 = ashr i32 %73, 9
%75 = and i32 %74, 3
switch i32 %75, label %84 [
i32 0, label %76
i32 1, label %78
i32 2, label %80
i32 3, label %82
]
76: ; preds = %67
%77 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
br label %84
78: ; preds = %67
%79 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
br label %84
80: ; preds = %67
%81 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0))
br label %84
82: ; preds = %67
%83 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %84
84: ; preds = %67, %82, %80, %78, %76
%85 = load i32, i32* %8
%86 = call i32 @Wreg(i32 %85)
%87 = call i32 @Ws(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
%88 = load i32, i32* %7
%89 = call i32 @Wd(i32 %88, i32 1)
br label %96
90: ; preds = %63
%91 = load i32, i32* %4
%92 = icmp ne i32 %91, 65535
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = call i32 @Ws(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
br label %95
95: ; preds = %93, %90
br label %96
96: ; preds = %95, %84
br label %97
97: ; preds = %96, %59
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"brsh \00"
@.str.1 = [7 x i8] c"brne \00"
@.str.2 = [7 x i8] c"brpl \00"
@.str.3 = [7 x i8] c"brvc \00"
@.str.4 = [7 x i8] c"brge \00"
@.str.5 = [7 x i8] c"brhc \00"
@.str.6 = [7 x i8] c"brtc \00"
@.str.7 = [7 x i8] c"brid \00"
@.str.8 = [7 x i8] c"brlo \00"
@.str.9 = [7 x i8] c"breq \00"
@.str.10 = [7 x i8] c"brmi \00"
@.str.11 = [7 x i8] c"brvs \00"
@.str.12 = [7 x i8] c"brlt \00"
@.str.13 = [7 x i8] c"brhs \00"
@.str.14 = [7 x i8] c"brts \00"
@.str.15 = [7 x i8] c"brie \00"
@.str.16 = [7 x i8] c"bld \00"
@.str.17 = [7 x i8] c"bst \00"
@.str.18 = [7 x i8] c"sbrc \00"
@.str.19 = [7 x i8] c"sbrs \00"
@.str.20 = [3 x i8] c", \00"
@.str.21 = [4 x i8] c"???\00"
@switch.table.WinstF = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0)]
@switch.table.WinstF.22 = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0)]
@reltable.WinstF = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.16 to i64), i64 ptrtoint ([4 x i32]* @reltable.WinstF to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.17 to i64), i64 ptrtoint ([4 x i32]* @reltable.WinstF to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.18 to i64), i64 ptrtoint ([4 x i32]* @reltable.WinstF to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.19 to i64), i64 ptrtoint ([4 x i32]* @reltable.WinstF to i64)) to i32)]
define i32 @WinstF(i32 %0, i32 %1) {
%3 = and i32 %1, 2048
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = and i32 %1, 7
%7 = lshr i32 %1, 3
%8 = and i32 %7, 127
%9 = and i32 %1, 1024
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, [8 x i8*]* @switch.table.WinstF.22, [8 x i8*]* @switch.table.WinstF
%12 = zext i32 %6 to i64
%13 = getelementptr inbounds [8 x i8*], [8 x i8*]* %11, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @Ws(i8* %14)
%16 = tail call i32 @wRelative7(i32 %0, i32 %8)
br label %37
17: ; preds = %2
%18 = and i32 %1, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %17
%21 = and i32 %1, 7
%22 = lshr i32 %1, 4
%23 = and i32 %22, 31
%24 = lshr i32 %1, 9
%25 = and i32 %24, 3
%26 = zext i32 %25 to i64
%27 = shl i64 %26, 2
%28 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.WinstF to i8*), i64 %27)
%29 = tail call i32 @Ws(i8* %28)
%30 = tail call i32 @Wreg(i32 %23)
%31 = tail call i32 @Ws(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
%32 = tail call i32 @Wd(i32 %21, i32 1)
br label %37
33: ; preds = %17
%34 = icmp eq i32 %1, 65535
br i1 %34, label %37, label %35
35: ; preds = %33
%36 = tail call i32 @Ws(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
br label %37
37: ; preds = %20, %35, %33, %5
ret i32 0
}