#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*/ mips_ejtag_pracc(int);
int /*<<< orphan*/ mips_ejtag_restorev0v1(unsigned long *);
int /*<<< orphan*/ mips_ejtag_storev0v1(unsigned long *);
void mips_ejtag_flushDCacheLine(unsigned long addr) {
  unsigned long v[3];
  mips_ejtag_storev0v1(v);
  mips_ejtag_pracc(((0x0F << 26) | ((2) << 16) | ((addr >> 16) & 0xffff)));
  mips_ejtag_pracc(
      ((0x0D << 26) | ((2) << 21) | ((2) << 16) | ((addr & 0xffff))));
  mips_ejtag_pracc((0xBC << 24 | (2) << 21 | ((0x14 | 0x1)) << 16 | (0)));
  mips_ejtag_restorev0v1(v);
}


x86 assembly (clang, -O0):
<mips_ejtag_flushDCacheLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <mips_ejtag_storev0v1@plt>
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xffff,%rax
or     $0x3c020000,%rax
mov    %eax,%edi
call   1050 <mips_ejtag_pracc@plt>
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
or     $0x34420000,%rax
mov    %eax,%edi
call   1050 <mips_ejtag_pracc@plt>
mov    $0xbc550000,%edi
call   1050 <mips_ejtag_pracc@plt>
lea    -0x20(%rbp),%rdi
call   1030 <mips_ejtag_restorev0v1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_flushDCacheLine>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <mips_ejtag_storev0v1@plt>
mov    %ebx,%edi
shr    $0x10,%edi
or     $0x3c020000,%edi
call   1050 <mips_ejtag_pracc@plt>
movzwl %bx,%edi
or     $0x34420000,%edi
call   1050 <mips_ejtag_pracc@plt>
mov    $0xbc550000,%edi
call   1050 <mips_ejtag_pracc@plt>
mov    %r14,%rdi
call   1030 <mips_ejtag_restorev0v1@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @mips_ejtag_flushDCacheLine(i64 %0) {
%2 = alloca i64
%3 = alloca [3 x i64]
store i64 %0, i64* %2
%4 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 0
%5 = call i32 @mips_ejtag_storev0v1(i64* %4)
%6 = load i64, i64* %2
%7 = lshr i64 %6, 16
%8 = and i64 %7, 65535
%9 = or i64 1006764032, %8
%10 = trunc i64 %9 to i32
%11 = call i32 @mips_ejtag_pracc(i32 %10)
%12 = load i64, i64* %2
%13 = and i64 %12, 65535
%14 = or i64 876740608, %13
%15 = trunc i64 %14 to i32
%16 = call i32 @mips_ejtag_pracc(i32 %15)
%17 = call i32 @mips_ejtag_pracc(i32 -1135280128)
%18 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 0
%19 = call i32 @mips_ejtag_restorev0v1(i64* %18)
ret void
}

LLVM IR (-O2):
define void @mips_ejtag_flushDCacheLine(i64 %0) {
%2 = alloca [3 x i64]
%3 = bitcast [3 x i64]* %2 to i8*
%4 = getelementptr inbounds [3 x i64], [3 x i64]* %2, i64 0, i64 0
%5 = call i32 @mips_ejtag_storev0v1(i64* %4)
%6 = trunc i64 %0 to i32
%7 = lshr i32 %6, 16
%8 = or i32 %7, 1006764032
%9 = call i32 @mips_ejtag_pracc(i32 %8)
%10 = and i32 %6, 65535
%11 = or i32 %10, 876740608
%12 = call i32 @mips_ejtag_pracc(i32 %11)
%13 = call i32 @mips_ejtag_pracc(i32 -1135280128)
%14 = call i32 @mips_ejtag_restorev0v1(i64* %4)
ret void
}