#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*/ branch_offset(int);
int /*<<< orphan*/ i_type_inst_free(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ r_sh_type_inst(int, int, int, int);
int /*<<< orphan*/ r_type_inst(int, int, int, int);
int /*<<< orphan*/ trap_inst();
void mult_inst(int op, int rd, int rs, int rt) {
  if (op == 582)
    r_type_inst(464, 0, rs, rt);
  else
    r_type_inst(463, 0, rs, rt);
  if (op == 582 && rd != 0) {
    r_type_inst(426, 1, 0, 0);
    i_type_inst_free(287, 0, 1, branch_offset(2));
    trap_inst();
  } else if (op == 581 && rd != 0) {
    r_type_inst(426, 1, 0, 0);
    r_type_inst(427, rd, 0, 0);
    r_sh_type_inst(514, rd, rd, 31);
    i_type_inst_free(287, rd, 1, branch_offset(2));
    trap_inst();
  }
  if (rd != 0)
    r_type_inst(427, rd, 0, 0);
}


x86 assembly (clang, -O0):
<mult_inst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x246,-0x4(%rbp)
jne    1188 <mult_inst+0x38>
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x1d0,%edi
xor    %esi,%esi
call   1050 <r_type_inst@plt>
jmp    119a <mult_inst+0x4a>
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x1cf,%edi
xor    %esi,%esi
call   1050 <r_type_inst@plt>
cmpl   $0x246,-0x4(%rbp)
jne    11ed <mult_inst+0x9d>
cmpl   $0x0,-0x8(%rbp)
je     11ed <mult_inst+0x9d>
mov    $0x1aa,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <r_type_inst@plt>
mov    $0x2,%edi
call   1030 <branch_offset@plt>
mov    %eax,%ecx
mov    $0x11f,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <i_type_inst_free@plt>
mov    $0x0,%al
call   1060 <trap_inst@plt>
jmp    126d <mult_inst+0x11d>
cmpl   $0x245,-0x4(%rbp)
jne    1268 <mult_inst+0x118>
cmpl   $0x0,-0x8(%rbp)
je     1268 <mult_inst+0x118>
mov    $0x1aa,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <r_type_inst@plt>
mov    -0x8(%rbp),%esi
mov    $0x1ab,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <r_type_inst@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x202,%edi
mov    $0x1f,%ecx
call   1040 <r_sh_type_inst@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
call   1030 <branch_offset@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%ecx
mov    $0x11f,%edi
mov    $0x1,%edx
call   1070 <i_type_inst_free@plt>
mov    $0x0,%al
call   1060 <trap_inst@plt>
jmp    126d <mult_inst+0x11d>
cmpl   $0x0,-0x8(%rbp)
je     1288 <mult_inst+0x138>
mov    -0x8(%rbp),%esi
mov    $0x1ab,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <r_type_inst@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult_inst>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    $0x246,%edi
jne    1188 <mult_inst+0x38>
xor    %ebp,%ebp
mov    $0x1d0,%edi
xor    %esi,%esi
call   1050 <r_type_inst@plt>
test   %ebx,%ebx
je     121a <mult_inst+0xca>
mov    $0x1aa,%edi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <r_type_inst@plt>
jmp    11da <mult_inst+0x8a>
mov    %edi,%ebp
mov    $0x1cf,%edi
xor    %esi,%esi
call   1050 <r_type_inst@plt>
cmp    $0x245,%ebp
jne    1200 <mult_inst+0xb0>
test   %ebx,%ebx
je     1200 <mult_inst+0xb0>
mov    $0x1aa,%edi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <r_type_inst@plt>
mov    $0x1ab,%edi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <r_type_inst@plt>
mov    $0x202,%edi
mov    %ebx,%esi
mov    %ebx,%edx
mov    $0x1f,%ecx
call   1040 <r_sh_type_inst@plt>
mov    %ebx,%ebp
mov    $0x2,%edi
call   1030 <branch_offset@plt>
mov    $0x11f,%edi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %eax,%ecx
call   1070 <i_type_inst_free@plt>
xor    %eax,%eax
call   1060 <trap_inst@plt>
jmp    1204 <mult_inst+0xb4>
test   %ebx,%ebx
je     121a <mult_inst+0xca>
mov    $0x1ab,%edi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <r_type_inst@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @mult_inst(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 582
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @r_type_inst(i32 464, i32 0, i32 %12, i32 %13)
br label %19
15: ; preds = %4
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = call i32 @r_type_inst(i32 463, i32 0, i32 %16, i32 %17)
br label %19
19: ; preds = %15, %11
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 582
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = call i32 @r_type_inst(i32 426, i32 1, i32 0, i32 0)
%27 = call i32 @branch_offset(i32 2)
%28 = call i32 @i_type_inst_free(i32 287, i32 0, i32 1, i32 %27)
%29 = call i32 (...) @trap_inst()
br label %48
30: ; preds = %22, %19
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 581
br i1 %32, label %33, label %47
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = call i32 @r_type_inst(i32 426, i32 1, i32 0, i32 0)
%38 = load i32, i32* %6
%39 = call i32 @r_type_inst(i32 427, i32 %38, i32 0, i32 0)
%40 = load i32, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @r_sh_type_inst(i32 514, i32 %40, i32 %41, i32 31)
%43 = load i32, i32* %6
%44 = call i32 @branch_offset(i32 2)
%45 = call i32 @i_type_inst_free(i32 287, i32 %43, i32 1, i32 %44)
%46 = call i32 (...) @trap_inst()
br label %47
47: ; preds = %36, %33, %30
br label %48
48: ; preds = %47, %25
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %6
%53 = call i32 @r_type_inst(i32 427, i32 %52, i32 0, i32 0)
br label %54
54: ; preds = %51, %48
ret void
}

LLVM IR (-O2):
define void @mult_inst(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, 582
br i1 %5, label %6, label %11
6: ; preds = %4
%7 = tail call i32 @r_type_inst(i32 464, i32 0, i32 %2, i32 %3)
%8 = icmp eq i32 %1, 0
br i1 %8, label %28, label %9
9: ; preds = %6
%10 = tail call i32 @r_type_inst(i32 426, i32 1, i32 0, i32 0)
br label %21
11: ; preds = %4
%12 = tail call i32 @r_type_inst(i32 463, i32 0, i32 %2, i32 %3)
%13 = icmp ne i32 %1, 0
%14 = icmp eq i32 %0, 581
%15 = and i1 %14, %13
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = tail call i32 @r_type_inst(i32 426, i32 1, i32 0, i32 0)
%18 = tail call i32 @r_type_inst(i32 427, i32 %1, i32 0, i32 0)
%19 = tail call i32 @r_sh_type_inst(i32 514, i32 %1, i32 %1, i32 31)
br label %21
20: ; preds = %11
br i1 %13, label %26, label %28
21: ; preds = %9, %16
%22 = phi i32 [ %1, %16 ], [ 0, %9 ]
%23 = tail call i32 @branch_offset(i32 2)
%24 = tail call i32 @i_type_inst_free(i32 287, i32 %22, i32 1, i32 %23)
%25 = tail call i32 (...) @trap_inst()
br label %26
26: ; preds = %21, %20
%27 = tail call i32 @r_type_inst(i32 427, i32 %1, i32 0, i32 0)
br label %28
28: ; preds = %6, %26, %20
ret void
}