#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*/ update_sum(double *, double *, int);
int /*<<< orphan*/ update_sum2(double *, double *, int);
void update_sums(double *beta, double *U, double *V, double *sum, double *sum2,
                 double *mean_U, double *mean_V, double *deviance,
                 double thrd_m2, int N, int M, int K, int D, double alpha_R) {
  double dv;
  update_sum(beta, sum, D * M);
  update_sum2(beta, sum2, D * M);
  update_sum(U, mean_U, K * N);
  update_sum(V, mean_V, K * M);
  dv = thrd_m2 * alpha_R;
  update_sum(&dv, deviance, 1);
}


x86 assembly (clang, -O0):
<update_sums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x38(%rbp),%edx
imul   0x28(%rbp),%edx
call   1040 <update_sum@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x38(%rbp),%edx
imul   0x28(%rbp),%edx
call   1030 <update_sum2@plt>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x30(%rbp),%edx
imul   0x20(%rbp),%edx
call   1040 <update_sum@plt>
mov    -0x18(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x30(%rbp),%edx
imul   0x28(%rbp),%edx
call   1040 <update_sum@plt>
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x18(%rbp),%rsi
lea    -0x48(%rbp),%rdi
mov    $0x1,%edx
call   1040 <update_sum@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_sums>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %r9,%r13
mov    %r8,%rbx
mov    %rdx,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x80(%rsp),%ebp
mov    0x88(%rsp),%r12d
imul   0x78(%rsp),%r12d
mov    %rcx,%rsi
mov    %r12d,%edx
call   1040 <update_sum@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <update_sum2@plt>
mov    0x70(%rsp),%edx
imul   %ebp,%edx
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <update_sum@plt>
imul   0x78(%rsp),%ebp
mov    0x8(%rsp),%rdi
mov    0x60(%rsp),%rsi
mov    %ebp,%edx
call   1040 <update_sum@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    0x68(%rsp),%rsi
mov    $0x1,%edx
call   1040 <update_sum@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @update_sums(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double %8, i32 %9, i32 %10, i32 %11, i32 %12, double %13) {
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca double
%29 = alloca double
store double* %0, double** %15
store double* %1, double** %16
store double* %2, double** %17
store double* %3, double** %18
store double* %4, double** %19
store double* %5, double** %20
store double* %6, double** %21
store double* %7, double** %22
store double %8, double* %23
store i32 %9, i32* %24
store i32 %10, i32* %25
store i32 %11, i32* %26
store i32 %12, i32* %27
store double %13, double* %28
%30 = load double*, double** %15
%31 = load double*, double** %18
%32 = load i32, i32* %27
%33 = load i32, i32* %25
%34 = mul nsw i32 %32, %33
%35 = call i32 @update_sum(double* %30, double* %31, i32 %34)
%36 = load double*, double** %15
%37 = load double*, double** %19
%38 = load i32, i32* %27
%39 = load i32, i32* %25
%40 = mul nsw i32 %38, %39
%41 = call i32 @update_sum2(double* %36, double* %37, i32 %40)
%42 = load double*, double** %16
%43 = load double*, double** %20
%44 = load i32, i32* %26
%45 = load i32, i32* %24
%46 = mul nsw i32 %44, %45
%47 = call i32 @update_sum(double* %42, double* %43, i32 %46)
%48 = load double*, double** %17
%49 = load double*, double** %21
%50 = load i32, i32* %26
%51 = load i32, i32* %25
%52 = mul nsw i32 %50, %51
%53 = call i32 @update_sum(double* %48, double* %49, i32 %52)
%54 = load double, double* %23
%55 = load double, double* %28
%56 = fmul double %54, %55
store double %56, double* %29
%57 = load double*, double** %22
%58 = call i32 @update_sum(double* %29, double* %57, i32 1)
ret void
}

LLVM IR (-O2):
define void @update_sums(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double %8, i32 %9, i32 %10, i32 %11, i32 %12, double %13) {
%15 = alloca double
%16 = bitcast double* %15 to i8*
%17 = mul nsw i32 %12, %10
%18 = tail call i32 @update_sum(double* %0, double* %3, i32 %17)
%19 = tail call i32 @update_sum2(double* %0, double* %4, i32 %17)
%20 = mul nsw i32 %11, %9
%21 = tail call i32 @update_sum(double* %1, double* %5, i32 %20)
%22 = mul nsw i32 %11, %10
%23 = tail call i32 @update_sum(double* %2, double* %6, i32 %22)
%24 = fmul double %8, %13
store double %24, double* %15
%25 = call i32 @update_sum(double* %15, double* %7, i32 1)
ret void
}