#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*/ _regname(long);
int /*<<< orphan*/ decode_indirect_address(long, long, long);
int /*<<< orphan*/ mask_and_sign_extend_word(long, int);
int /*<<< orphan*/ myprint(char *, ...);
int /*<<< orphan*/ pad_to(int);
void decode_integer_store(long int op_code) {
  long int dest;
  dest = (op_code >> 16) & 0x1f;
  switch ((op_code >> 21) & 0x3) {
  case 0:
    myprint("STIK");
    pad_to(10);
    myprint("%-3ld, @%#04.4lx", mask_and_sign_extend_word(dest, 0x1f),
            (op_code & 0xffff));
    break;
  case 1:
    myprint("STI");
    pad_to(10);
    myprint("%s, @%#04.4lx", _regname(dest), (op_code & 0xffff));
    break;
  case 2:
    myprint("STI");
    pad_to(10);
    myprint("%s, ", _regname(dest));
    decode_indirect_address((op_code >> 11) & 0x1f, (op_code >> 8) & 0x7,
                            op_code & 0xff);
    break;
  case 3:
    myprint("STIK");
    pad_to(10);
    myprint("%-3ld, ", mask_and_sign_extend_word(dest, 0x1f));
    decode_indirect_address((op_code >> 11) & 0x1f, (op_code >> 8) & 0x7,
                            op_code & 0xff);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<decode_integer_store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movzwl -0x6(%rbp),%eax
and    $0x1f,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x15,%eax
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     12d6 <decode_integer_store+0x186>
mov    -0x18(%rbp),%rax
lea    0xe76(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1f,%esi
call   1070 <mask_and_sign_extend_word@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
and    $0xffff,%rdx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
jmp    12d6 <decode_integer_store+0x186>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    -0x10(%rbp),%rdi
call   1040 <_regname@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
and    $0xffff,%rdx
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
jmp    12d6 <decode_integer_store+0x186>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    -0x10(%rbp),%rdi
call   1040 <_regname@plt>
mov    %eax,%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    -0x8(%rbp),%rdi
sar    $0xb,%rdi
and    $0x1f,%rdi
mov    -0x8(%rbp),%rsi
sar    $0x8,%rsi
and    $0x7,%rsi
mov    -0x8(%rbp),%rdx
and    $0xff,%rdx
call   1060 <decode_indirect_address@plt>
jmp    12d6 <decode_integer_store+0x186>
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1f,%esi
call   1070 <mask_and_sign_extend_word@plt>
mov    %eax,%esi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <myprint@plt>
mov    -0x8(%rbp),%rdi
sar    $0xb,%rdi
and    $0x1f,%rdi
mov    -0x8(%rbp),%rsi
sar    $0x8,%rsi
and    $0x7,%rsi
mov    -0x8(%rbp),%rdx
and    $0xff,%rdx
call   1060 <decode_indirect_address@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_integer_store>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %r14d,%ebx
shr    $0x10,%ebx
and    $0x1f,%ebx
mov    %r14d,%eax
shr    $0x15,%eax
and    $0x3,%eax
lea    0xe90(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    %rbx,%rdi
mov    $0x1f,%esi
call   1070 <mask_and_sign_extend_word@plt>
movzwl %r14w,%edx
lea    0xe6c(%rip),%rdi
jmp    1259 <decode_integer_store+0x109>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    %rbx,%rdi
call   1040 <_regname@plt>
lea    0xe63(%rip),%rdi
jmp    1203 <decode_integer_store+0xb3>
lea    0xe32(%rip),%rdi
xor    %eax,%eax
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    %rbx,%rdi
mov    $0x1f,%esi
call   1070 <mask_and_sign_extend_word@plt>
lea    0xe3a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <myprint@plt>
mov    %r14d,%edi
shr    $0xb,%edi
and    $0x1f,%edi
mov    %r14d,%esi
shr    $0x8,%esi
and    $0x7,%esi
movzbl %r14b,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <decode_indirect_address@plt>
lea    0xdf1(%rip),%rdi
xor    %eax,%eax
call   1030 <myprint@plt>
mov    $0xa,%edi
call   1050 <pad_to@plt>
mov    %rbx,%rdi
call   1040 <_regname@plt>
movzwl %r14w,%edx
lea    0xdd1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <myprint@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"STIK\00"
@.str.1 = [17 x i8] c"%-3ld, @%.4lx\00"
@.str.2 = [4 x i8] c"STI\00"
@.str.3 = [14 x i8] c"%s, @%.4lx\00"
@.str.4 = [5 x i8] c"%s, \00"
@.str.5 = [8 x i8] c"%-3ld, \00"
define void @decode_integer_store(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = ashr i64 %4, 16
%6 = and i64 %5, 31
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = ashr i64 %7, 21
%9 = and i64 %8, 3
switch i64 %9, label %56 [
i64 0, label %10
i64 1, label %18
i64 2, label %26
i64 3, label %41
]
10: ; preds = %1
%11 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @pad_to(i32 10)
%13 = load i64, i64* %3
%14 = call i32 @mask_and_sign_extend_word(i64 %13, i32 31)
%15 = load i64, i64* %2
%16 = and i64 %15, 65535
%17 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %14, i64 %16)
br label %56
18: ; preds = %1
%19 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @pad_to(i32 10)
%21 = load i64, i64* %3
%22 = call i32 @_regname(i64 %21)
%23 = load i64, i64* %2
%24 = and i64 %23, 65535
%25 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %22, i64 %24)
br label %56
26: ; preds = %1
%27 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @pad_to(i32 10)
%29 = load i64, i64* %3
%30 = call i32 @_regname(i64 %29)
%31 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = load i64, i64* %2
%33 = ashr i64 %32, 11
%34 = and i64 %33, 31
%35 = load i64, i64* %2
%36 = ashr i64 %35, 8
%37 = and i64 %36, 7
%38 = load i64, i64* %2
%39 = and i64 %38, 255
%40 = call i32 @decode_indirect_address(i64 %34, i64 %37, i64 %39)
br label %56
41: ; preds = %1
%42 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%43 = call i32 @pad_to(i32 10)
%44 = load i64, i64* %3
%45 = call i32 @mask_and_sign_extend_word(i64 %44, i32 31)
%46 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %45)
%47 = load i64, i64* %2
%48 = ashr i64 %47, 11
%49 = and i64 %48, 31
%50 = load i64, i64* %2
%51 = ashr i64 %50, 8
%52 = and i64 %51, 7
%53 = load i64, i64* %2
%54 = and i64 %53, 255
%55 = call i32 @decode_indirect_address(i64 %49, i64 %52, i64 %54)
br label %56
56: ; preds = %1, %41, %26, %18, %10
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"STIK\00"
@.str.1 = [17 x i8] c"%-3ld, @%.4lx\00"
@.str.2 = [4 x i8] c"STI\00"
@.str.3 = [14 x i8] c"%s, @%.4lx\00"
@.str.4 = [5 x i8] c"%s, \00"
@.str.5 = [8 x i8] c"%-3ld, \00"
define void @decode_integer_store(i64 %0) {
%2 = lshr i64 %0, 16
%3 = and i64 %2, 31
%4 = lshr i64 %0, 21
%5 = and i64 %4, 3
switch i64 %5, label %40 [
i64 0, label %6
i64 1, label %12
i64 2, label %18
i64 3, label %29
]
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @pad_to(i32 10)
%9 = tail call i32 @mask_and_sign_extend_word(i64 %3, i32 31)
%10 = and i64 %0, 65535
%11 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %9, i64 %10)
br label %41
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @pad_to(i32 10)
%15 = tail call i32 @_regname(i64 %3)
%16 = and i64 %0, 65535
%17 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %15, i64 %16)
br label %41
18: ; preds = %1
%19 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 @pad_to(i32 10)
%21 = tail call i32 @_regname(i64 %3)
%22 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = lshr i64 %0, 11
%24 = and i64 %23, 31
%25 = lshr i64 %0, 8
%26 = and i64 %25, 7
%27 = and i64 %0, 255
%28 = tail call i32 @decode_indirect_address(i64 %24, i64 %26, i64 %27)
br label %41
29: ; preds = %1
%30 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%31 = tail call i32 @pad_to(i32 10)
%32 = tail call i32 @mask_and_sign_extend_word(i64 %3, i32 31)
%33 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%34 = lshr i64 %0, 11
%35 = and i64 %34, 31
%36 = lshr i64 %0, 8
%37 = and i64 %36, 7
%38 = and i64 %0, 255
%39 = tail call i32 @decode_indirect_address(i64 %35, i64 %37, i64 %38)
br label %41
40: ; preds = %1
unreachable
41: ; preds = %29, %18, %12, %6
ret void
}