#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_rx_machi(long, long);
int /*<<< orphan*/ __builtin_rx_maclo(long, long);
int /*<<< orphan*/ __builtin_rx_mulhi(long, long);
int /*<<< orphan*/ __builtin_rx_mullo(long, long);
long __builtin_rx_mvfachi();
scalar_t__ __builtin_rx_mvfacmi();
int /*<<< orphan*/ __builtin_rx_mvtachi(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_rx_mvtaclo(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_rx_racw(int);
long multiply_and_accumulate(long arg1, long arg2, long arg3) {
  __builtin_rx_mvtaclo(0);
  __builtin_rx_mvtachi(0);
  __builtin_rx_mullo(arg1, arg2);
  __builtin_rx_mulhi(arg1, arg2);
  __builtin_rx_maclo(arg1, arg3);
  __builtin_rx_machi(arg1, arg3);
  __builtin_rx_racw(1);
  arg1 = __builtin_rx_mvfachi();
  arg1 += __builtin_rx_mvfacmi();
  return arg1;
}


x86 assembly (clang, -O0):
<multiply_and_accumulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
call   1030 <__builtin_rx_mvtaclo@plt>
xor    %edi,%edi
call   1070 <__builtin_rx_mvtachi@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <__builtin_rx_mullo@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <__builtin_rx_mulhi@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <__builtin_rx_maclo@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <__builtin_rx_machi@plt>
mov    $0x1,%edi
call   1040 <__builtin_rx_racw@plt>
mov    $0x0,%al
call   10b0 <__builtin_rx_mvfachi@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <__builtin_rx_mvfacmi@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_and_accumulate>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <__builtin_rx_mvtaclo@plt>
xor    %edi,%edi
call   1070 <__builtin_rx_mvtachi@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <__builtin_rx_mullo@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <__builtin_rx_mulhi@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <__builtin_rx_maclo@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <__builtin_rx_machi@plt>
mov    $0x1,%edi
call   1040 <__builtin_rx_racw@plt>
xor    %eax,%eax
call   10b0 <__builtin_rx_mvfachi@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <__builtin_rx_mvfacmi@plt>
add    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @multiply_and_accumulate(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = call i32 @__builtin_rx_mvtaclo(i32 0)
%8 = call i32 @__builtin_rx_mvtachi(i32 0)
%9 = load i64, i64* %4
%10 = load i64, i64* %5
%11 = call i32 @__builtin_rx_mullo(i64 %9, i64 %10)
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = call i32 @__builtin_rx_mulhi(i64 %12, i64 %13)
%15 = load i64, i64* %4
%16 = load i64, i64* %6
%17 = call i32 @__builtin_rx_maclo(i64 %15, i64 %16)
%18 = load i64, i64* %4
%19 = load i64, i64* %6
%20 = call i32 @__builtin_rx_machi(i64 %18, i64 %19)
%21 = call i32 @__builtin_rx_racw(i32 1)
%22 = call i64 (...) @__builtin_rx_mvfachi()
store i64 %22, i64* %4
%23 = call i64 (...) @__builtin_rx_mvfacmi()
%24 = load i64, i64* %4
%25 = add nsw i64 %24, %23
store i64 %25, i64* %4
%26 = load i64, i64* %4
ret i64 %26
}

LLVM IR (-O2):
define i64 @multiply_and_accumulate(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @__builtin_rx_mvtaclo(i32 0)
%5 = tail call i32 @__builtin_rx_mvtachi(i32 0)
%6 = tail call i32 @__builtin_rx_mullo(i64 %0, i64 %1)
%7 = tail call i32 @__builtin_rx_mulhi(i64 %0, i64 %1)
%8 = tail call i32 @__builtin_rx_maclo(i64 %0, i64 %2)
%9 = tail call i32 @__builtin_rx_machi(i64 %0, i64 %2)
%10 = tail call i32 @__builtin_rx_racw(i32 1)
%11 = tail call i64 (...) @__builtin_rx_mvfachi()
%12 = tail call i64 (...) @__builtin_rx_mvfacmi()
%13 = add nsw i64 %12, %11
ret i64 %13
}