#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*/ insn_arithmetic_op(int);
int /*<<< orphan*/ insn_iterative_op(int);
int /*<<< orphan*/ insn_logic_op(int);
int /*<<< orphan*/ sim_warning(char *);
void insn_type01(uint32_t insn) {
  switch (insn & 0xf8000000) {
  case 0x40000000:
    insn_arithmetic_op(insn);
    break;
  case 0x50000000:
    insn_logic_op(insn);
    break;
  case 0x68000000:
    insn_iterative_op(insn);
    break;
  default:
    sim_warning("Unimplemented type01");
  }
}


x86 assembly (clang, -O0):
<insn_type01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8000000,%eax
mov    %eax,-0x8(%rbp)
sub    $0x40000000,%eax
je     118c <insn_type01+0x4c>
jmp    1166 <insn_type01+0x26>
mov    -0x8(%rbp),%eax
sub    $0x50000000,%eax
je     1199 <insn_type01+0x59>
jmp    1179 <insn_type01+0x39>
mov    -0x8(%rbp),%eax
sub    $0x68000000,%eax
je     11a6 <insn_type01+0x66>
jmp    11b3 <insn_type01+0x73>
mov    -0x4(%rbp),%edi
call   1030 <insn_arithmetic_op@plt>
jmp    11bf <insn_type01+0x7f>
mov    -0x4(%rbp),%edi
call   1040 <insn_logic_op@plt>
jmp    11bf <insn_type01+0x7f>
mov    -0x4(%rbp),%edi
call   1060 <insn_iterative_op@plt>
jmp    11bf <insn_type01+0x7f>
lea    0xe46(%rip),%rdi
call   1050 <sim_warning@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insn_type01>:
mov    %edi,%eax
and    $0xf8000000,%eax
cmp    $0x68000000,%eax
je     1161 <insn_type01+0x21>
cmp    $0x50000000,%eax
je     1166 <insn_type01+0x26>
cmp    $0x40000000,%eax
jne    116b <insn_type01+0x2b>
jmp    1030 <insn_arithmetic_op@plt>
jmp    1060 <insn_iterative_op@plt>
jmp    1040 <insn_logic_op@plt>
lea    0xe8e(%rip),%rdi
jmp    1050 <sim_warning@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Unimplemented type01\00"
define void @insn_type01(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -134217728
switch i32 %4, label %14 [
i32 1073741824, label %5
i32 1342177280, label %8
i32 1744830464, label %11
]
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @insn_arithmetic_op(i32 %6)
br label %16
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @insn_logic_op(i32 %9)
br label %16
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i32 @insn_iterative_op(i32 %12)
br label %16
14: ; preds = %1
%15 = call i32 @sim_warning(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11, %8, %5
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Unimplemented type01\00"
define void @insn_type01(i32 %0) {
%2 = and i32 %0, -134217728
switch i32 %2, label %9 [
i32 1073741824, label %3
i32 1342177280, label %5
i32 1744830464, label %7
]
3: ; preds = %1
%4 = tail call i32 @insn_arithmetic_op(i32 %0)
br label %11
5: ; preds = %1
%6 = tail call i32 @insn_logic_op(i32 %0)
br label %11
7: ; preds = %1
%8 = tail call i32 @insn_iterative_op(i32 %0)
br label %11
9: ; preds = %1
%10 = tail call i32 @sim_warning(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %7, %5, %3
ret void
}