#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*/ __builtin_mips_append(int, int, int);
int /*<<< orphan*/ __builtin_mips_balign(int, int, int);
int /*<<< orphan*/ __builtin_mips_precr_sra_ph_w(int, int, int);
int /*<<< orphan*/ __builtin_mips_precr_sra_r_ph_w(int, int, int);
int /*<<< orphan*/ __builtin_mips_prepend(int, int, int);
int /*<<< orphan*/ __builtin_mips_rddsp(int);
int /*<<< orphan*/ __builtin_mips_wrdsp(int, int);
void foo() {
  int a = 3;
  __builtin_mips_wrdsp(2052, a);
  __builtin_mips_rddsp(a);
  __builtin_mips_wrdsp(2052, -1);
  __builtin_mips_rddsp(-1);
  __builtin_mips_wrdsp(2052, 64);
  __builtin_mips_rddsp(64);
  __builtin_mips_append(1, 2, a);
  __builtin_mips_balign(1, 2, a);
  __builtin_mips_precr_sra_ph_w(1, 2, a);
  __builtin_mips_precr_sra_r_ph_w(1, 2, a);
  __builtin_mips_prepend(1, 2, a);
  __builtin_mips_append(1, 2, -1);
  __builtin_mips_append(1, 2, 32);
  __builtin_mips_balign(1, 2, -1);
  __builtin_mips_balign(1, 2, 4);
  __builtin_mips_precr_sra_ph_w(1, 2, -1);
  __builtin_mips_precr_sra_ph_w(1, 2, 32);
  __builtin_mips_precr_sra_r_ph_w(1, 2, -1);
  __builtin_mips_precr_sra_r_ph_w(1, 2, 32);
  __builtin_mips_prepend(1, 2, -1);
  __builtin_mips_prepend(1, 2, -1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x804,%edi
call   1060 <__builtin_mips_wrdsp@plt>
mov    -0x4(%rbp),%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    $0x804,%edi
mov    $0xffffffff,%esi
call   1060 <__builtin_mips_wrdsp@plt>
mov    $0xffffffff,%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    $0x804,%edi
mov    $0x40,%esi
call   1060 <__builtin_mips_wrdsp@plt>
mov    $0x40,%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1070 <__builtin_mips_append@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1090 <__builtin_mips_balign@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <__builtin_mips_prepend@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1070 <__builtin_mips_append@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1070 <__builtin_mips_append@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1090 <__builtin_mips_balign@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1090 <__builtin_mips_balign@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1040 <__builtin_mips_prepend@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1040 <__builtin_mips_prepend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    $0x804,%edi
mov    $0x3,%esi
call   1060 <__builtin_mips_wrdsp@plt>
mov    $0x3,%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    $0x804,%edi
mov    $0xffffffff,%esi
call   1060 <__builtin_mips_wrdsp@plt>
mov    $0xffffffff,%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    $0x804,%edi
mov    $0x40,%esi
call   1060 <__builtin_mips_wrdsp@plt>
mov    $0x40,%edi
call   1030 <__builtin_mips_rddsp@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1070 <__builtin_mips_append@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1090 <__builtin_mips_balign@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <__builtin_mips_prepend@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1070 <__builtin_mips_append@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1070 <__builtin_mips_append@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1090 <__builtin_mips_balign@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1090 <__builtin_mips_balign@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1050 <__builtin_mips_precr_sra_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x20,%edx
call   1080 <__builtin_mips_precr_sra_r_ph_w@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1040 <__builtin_mips_prepend@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
pop    %rax
jmp    1040 <__builtin_mips_prepend@plt>

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
store i32 3, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @__builtin_mips_wrdsp(i32 2052, i32 %2)
%4 = load i32, i32* %1
%5 = call i32 @__builtin_mips_rddsp(i32 %4)
%6 = call i32 @__builtin_mips_wrdsp(i32 2052, i32 -1)
%7 = call i32 @__builtin_mips_rddsp(i32 -1)
%8 = call i32 @__builtin_mips_wrdsp(i32 2052, i32 64)
%9 = call i32 @__builtin_mips_rddsp(i32 64)
%10 = load i32, i32* %1
%11 = call i32 @__builtin_mips_append(i32 1, i32 2, i32 %10)
%12 = load i32, i32* %1
%13 = call i32 @__builtin_mips_balign(i32 1, i32 2, i32 %12)
%14 = load i32, i32* %1
%15 = call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 %14)
%16 = load i32, i32* %1
%17 = call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 %16)
%18 = load i32, i32* %1
%19 = call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 %18)
%20 = call i32 @__builtin_mips_append(i32 1, i32 2, i32 -1)
%21 = call i32 @__builtin_mips_append(i32 1, i32 2, i32 32)
%22 = call i32 @__builtin_mips_balign(i32 1, i32 2, i32 -1)
%23 = call i32 @__builtin_mips_balign(i32 1, i32 2, i32 4)
%24 = call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 -1)
%25 = call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 32)
%26 = call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 -1)
%27 = call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 32)
%28 = call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 -1)
%29 = call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 -1)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @__builtin_mips_wrdsp(i32 2052, i32 3)
%2 = tail call i32 @__builtin_mips_rddsp(i32 3)
%3 = tail call i32 @__builtin_mips_wrdsp(i32 2052, i32 -1)
%4 = tail call i32 @__builtin_mips_rddsp(i32 -1)
%5 = tail call i32 @__builtin_mips_wrdsp(i32 2052, i32 64)
%6 = tail call i32 @__builtin_mips_rddsp(i32 64)
%7 = tail call i32 @__builtin_mips_append(i32 1, i32 2, i32 3)
%8 = tail call i32 @__builtin_mips_balign(i32 1, i32 2, i32 3)
%9 = tail call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 3)
%10 = tail call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 3)
%11 = tail call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 3)
%12 = tail call i32 @__builtin_mips_append(i32 1, i32 2, i32 -1)
%13 = tail call i32 @__builtin_mips_append(i32 1, i32 2, i32 32)
%14 = tail call i32 @__builtin_mips_balign(i32 1, i32 2, i32 -1)
%15 = tail call i32 @__builtin_mips_balign(i32 1, i32 2, i32 4)
%16 = tail call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 -1)
%17 = tail call i32 @__builtin_mips_precr_sra_ph_w(i32 1, i32 2, i32 32)
%18 = tail call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 -1)
%19 = tail call i32 @__builtin_mips_precr_sra_r_ph_w(i32 1, i32 2, i32 32)
%20 = tail call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 -1)
%21 = tail call i32 @__builtin_mips_prepend(i32 1, i32 2, i32 -1)
ret void
}