#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 get_op(unsigned int);
unsigned make_dsisr(unsigned instr) {
  unsigned dsisr;
  dsisr = (instr & 0x03ff0000) >> 16;
  if ((get_op(instr) == 31)) {
    dsisr |= (instr & 0x00000006) << 14;
    dsisr |= (instr & 0x00000040) << 8;
    dsisr |= (instr & 0x00000780) << 3;
  } else {
    dsisr |= (instr & 0x04000000) >> 12;
    dsisr |= (instr & 0x78000000) >> 17;
    if ((get_op(instr) >= 56))
      dsisr |= (instr & 0x00000003) << 18;
  }
  return dsisr;
}


x86 assembly (clang, -O0):
<make_dsisr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3ff0000,%eax
shr    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <get_op@plt>
cmp    $0x1f,%eax
jne    116e <make_dsisr+0x5e>
mov    -0x4(%rbp),%eax
and    $0x6,%eax
shl    $0xe,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x780,%eax
shl    $0x3,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b5 <make_dsisr+0xa5>
mov    -0x4(%rbp),%eax
and    $0x4000000,%eax
shr    $0xc,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x78000000,%eax
shr    $0x11,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <get_op@plt>
cmp    $0x38,%eax
jl     11b0 <make_dsisr+0xa0>
mov    -0x4(%rbp),%eax
and    $0x3,%eax
shl    $0x12,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b5 <make_dsisr+0xa5>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dsisr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    %edi,%ebx
shr    $0x10,%ebx
and    $0x3ff,%ebx
call   1030 <get_op@plt>
cmp    $0x1f,%eax
jne    114f <make_dsisr+0x3f>
mov    %r14d,%eax
and    $0x6,%eax
shl    $0xe,%eax
or     %eax,%ebx
mov    %r14d,%eax
and    $0x40,%eax
shl    $0x8,%eax
or     %ebx,%eax
and    $0x780,%r14d
lea    (%rax,%r14,8),%ebp
jmp    1182 <make_dsisr+0x72>
mov    %r14d,%eax
shr    $0xc,%eax
and    $0x4000,%eax
or     %eax,%ebx
mov    %r14d,%ebp
shr    $0x11,%ebp
and    $0x3c00,%ebp
or     %ebx,%ebp
mov    %r14d,%edi
call   1030 <get_op@plt>
cmp    $0x38,%eax
jl     1182 <make_dsisr+0x72>
and    $0x3,%r14d
shl    $0x12,%r14d
or     %r14d,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @make_dsisr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 67043328
%6 = lshr i32 %5, 16
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = call i32 @get_op(i32 %7)
%9 = icmp eq i32 %8, 31
br i1 %9, label %10, label %26
10: ; preds = %1
%11 = load i32, i32* %2
%12 = and i32 %11, 6
%13 = shl i32 %12, 14
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = and i32 %16, 64
%18 = shl i32 %17, 8
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = and i32 %21, 1920
%23 = shl i32 %22, 3
%24 = load i32, i32* %3
%25 = or i32 %24, %23
store i32 %25, i32* %3
br label %47
26: ; preds = %1
%27 = load i32, i32* %2
%28 = and i32 %27, 67108864
%29 = lshr i32 %28, 12
%30 = load i32, i32* %3
%31 = or i32 %30, %29
store i32 %31, i32* %3
%32 = load i32, i32* %2
%33 = and i32 %32, 2013265920
%34 = lshr i32 %33, 17
%35 = load i32, i32* %3
%36 = or i32 %35, %34
store i32 %36, i32* %3
%37 = load i32, i32* %2
%38 = call i32 @get_op(i32 %37)
%39 = icmp sge i32 %38, 56
br i1 %39, label %40, label %46
40: ; preds = %26
%41 = load i32, i32* %2
%42 = and i32 %41, 3
%43 = shl i32 %42, 18
%44 = load i32, i32* %3
%45 = or i32 %44, %43
store i32 %45, i32* %3
br label %46
46: ; preds = %40, %26
br label %47
47: ; preds = %46, %10
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
define i32 @make_dsisr(i32 %0) {
%2 = lshr i32 %0, 16
%3 = and i32 %2, 1023
%4 = tail call i32 @get_op(i32 %0)
%5 = icmp eq i32 %4, 31
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = shl i32 %0, 14
%8 = and i32 %7, 98304
%9 = or i32 %3, %8
%10 = shl i32 %0, 8
%11 = and i32 %10, 16384
%12 = or i32 %9, %11
%13 = shl i32 %0, 3
%14 = and i32 %13, 15360
%15 = or i32 %12, %14
br label %29
16: ; preds = %1
%17 = lshr i32 %0, 12
%18 = and i32 %17, 16384
%19 = or i32 %3, %18
%20 = lshr i32 %0, 17
%21 = and i32 %20, 15360
%22 = or i32 %19, %21
%23 = tail call i32 @get_op(i32 %0)
%24 = icmp sgt i32 %23, 55
br i1 %24, label %25, label %29
25: ; preds = %16
%26 = shl i32 %0, 18
%27 = and i32 %26, 786432
%28 = or i32 %22, %27
br label %29
29: ; preds = %16, %25, %6
%30 = phi i32 [ %15, %6 ], [ %28, %25 ], [ %22, %16 ]
ret i32 %30
}