#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ branch_conditional_is_conditional(int);
bool is_unconditional_branch(uint32_t insn) {
  uint32_t opcode = insn >> (32 - 6);
  if ((opcode == 16) && !branch_conditional_is_conditional(insn))
    return true;
  if (opcode == 17 || opcode == 18)
    return true;
  if (opcode == 19) {
    uint32_t sub_opcode = (((insn) >> 1) & 0x3ff);
    switch (sub_opcode) {
    case 16:
    case 528:
    case 560:
      if (!branch_conditional_is_conditional(insn))
        return true;
      break;
    case 50:
    case 18:
    case 274:
    case 82:
      return true;
      break;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<is_unconditional_branch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1a,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jne    114b <is_unconditional_branch+0x3b>
mov    -0x8(%rbp),%edi
call   1030 <branch_conditional_is_conditional@plt>
cmp    $0x0,%eax
jne    114b <is_unconditional_branch+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    123c <is_unconditional_branch+0x12c>
cmpl   $0x11,-0xc(%rbp)
je     115f <is_unconditional_branch+0x4f>
cmpl   $0x12,-0xc(%rbp)
jne    116b <is_unconditional_branch+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    123c <is_unconditional_branch+0x12c>
cmpl   $0x13,-0xc(%rbp)
jne    1235 <is_unconditional_branch+0x125>
mov    -0x8(%rbp),%eax
shr    %eax
and    $0x3ff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x10,%eax
je     1202 <is_unconditional_branch+0xf2>
jmp    1196 <is_unconditional_branch+0x86>
mov    -0x14(%rbp),%eax
sub    $0x12,%eax
je     1224 <is_unconditional_branch+0x114>
jmp    11a7 <is_unconditional_branch+0x97>
mov    -0x14(%rbp),%eax
sub    $0x32,%eax
je     1224 <is_unconditional_branch+0x114>
jmp    11b8 <is_unconditional_branch+0xa8>
mov    -0x14(%rbp),%eax
sub    $0x52,%eax
je     1224 <is_unconditional_branch+0x114>
jmp    11c9 <is_unconditional_branch+0xb9>
mov    -0x14(%rbp),%eax
sub    $0x112,%eax
je     1224 <is_unconditional_branch+0x114>
jmp    11dc <is_unconditional_branch+0xcc>
mov    -0x14(%rbp),%eax
sub    $0x210,%eax
je     1202 <is_unconditional_branch+0xf2>
jmp    11ef <is_unconditional_branch+0xdf>
mov    -0x14(%rbp),%eax
sub    $0x230,%eax
jne    1230 <is_unconditional_branch+0x120>
jmp    1202 <is_unconditional_branch+0xf2>
mov    -0x8(%rbp),%edi
call   1030 <branch_conditional_is_conditional@plt>
cmp    $0x0,%eax
jne    121f <is_unconditional_branch+0x10f>
movl   $0x1,-0x4(%rbp)
jmp    123c <is_unconditional_branch+0x12c>
jmp    1230 <is_unconditional_branch+0x120>
movl   $0x1,-0x4(%rbp)
jmp    123c <is_unconditional_branch+0x12c>
jmp    1235 <is_unconditional_branch+0x125>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_unconditional_branch>:
push   %rbx
mov    %edi,%eax
sar    $0x1a,%eax
cmp    $0x10,%eax
jne    1129 <is_unconditional_branch+0x19>
call   1030 <branch_conditional_is_conditional@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
jmp    1188 <is_unconditional_branch+0x78>
lea    -0x11(%rax),%ecx
mov    $0x1,%ebx
cmp    $0x2,%ecx
jb     1188 <is_unconditional_branch+0x78>
cmp    $0x13,%eax
jne    1186 <is_unconditional_branch+0x76>
mov    %edi,%eax
shr    %eax
and    $0x3ff,%eax
cmp    $0x51,%eax
jle    115e <is_unconditional_branch+0x4e>
cmp    $0x20f,%eax
jg     116f <is_unconditional_branch+0x5f>
cmp    $0x52,%eax
je     1188 <is_unconditional_branch+0x78>
cmp    $0x112,%eax
je     1188 <is_unconditional_branch+0x78>
jmp    1186 <is_unconditional_branch+0x76>
cmp    $0x10,%eax
je     117d <is_unconditional_branch+0x6d>
cmp    $0x12,%eax
je     1188 <is_unconditional_branch+0x78>
cmp    $0x32,%eax
je     1188 <is_unconditional_branch+0x78>
jmp    1186 <is_unconditional_branch+0x76>
cmp    $0x230,%eax
je     117d <is_unconditional_branch+0x6d>
cmp    $0x210,%eax
jne    1186 <is_unconditional_branch+0x76>
call   1030 <branch_conditional_is_conditional@plt>
test   %eax,%eax
je     1188 <is_unconditional_branch+0x78>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_unconditional_branch(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 26
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 16
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @branch_conditional_is_conditional(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 1, i32* %2
br label %39
15: ; preds = %10, %1
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 17
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 18
br i1 %20, label %21, label %22
21: ; preds = %18, %15
store i32 1, i32* %2
br label %39
22: ; preds = %18
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 19
br i1 %24, label %25, label %38
25: ; preds = %22
%26 = load i32, i32* %3
%27 = ashr i32 %26, 1
%28 = and i32 %27, 1023
store i32 %28, i32* %5
%29 = load i32, i32* %5
switch i32 %29, label %37 [
i32 16, label %30
i32 528, label %30
i32 560, label %30
i32 50, label %36
i32 18, label %36
i32 274, label %36
i32 82, label %36
]
30: ; preds = %25, %25, %25
%31 = load i32, i32* %3
%32 = call i32 @branch_conditional_is_conditional(i32 %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %35, label %34
34: ; preds = %30
store i32 1, i32* %2
br label %39
35: ; preds = %30
br label %37
36: ; preds = %25, %25, %25, %25
store i32 1, i32* %2
br label %39
37: ; preds = %25, %35
br label %38
38: ; preds = %37, %22
store i32 0, i32* %2
br label %39
39: ; preds = %38, %36, %34, %21, %14
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @is_unconditional_branch(i32 %0) {
%2 = ashr i32 %0, 26
%3 = icmp eq i32 %2, 16
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @branch_conditional_is_conditional(i32 %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %20
8: ; preds = %1
%9 = add nsw i32 %2, -17
%10 = icmp ult i32 %9, 2
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = icmp eq i32 %2, 19
br i1 %12, label %13, label %20
13: ; preds = %11
%14 = lshr i32 %0, 1
%15 = and i32 %14, 1023
switch i32 %15, label %19 [
i32 16, label %16
i32 528, label %16
i32 560, label %16
i32 50, label %20
i32 18, label %20
i32 274, label %20
i32 82, label %20
]
16: ; preds = %13, %13, %13
%17 = tail call i32 @branch_conditional_is_conditional(i32 %0)
%18 = icmp eq i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %13, %16
br label %20
20: ; preds = %4, %11, %19, %16, %13, %13, %13, %13, %8
%21 = phi i32 [ 1, %8 ], [ 1, %13 ], [ 1, %13 ], [ 1, %13 ], [ 1, %13 ], [ 1, %16 ], [ 0, %19 ], [ 0, %11 ], [ %7, %4 ]
ret i32 %21
}