#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*/ create_inv_cov_beta(double *, double *, double, int,
                                       double *);
int /*<<< orphan*/ create_m_beta(double *, float *, double *, double *,
                                 double *, int, int, int, int, float *, int);
scalar_t__ isnan(double);
int /*<<< orphan*/ print_error_global(char *, int /*<<< orphan*/ *,
                                      int /*<<< orphan*/);
int /*<<< orphan*/ rand_beta(double *, double *, double *, double, int, int,
                             int);
void update_beta(double *C, float *dat, double *U, double *V, double *beta,
                 double *CCt, double *m_beta, double *inv_cov_beta,
                 double *alpha_beta, double alpha_R, int M, int N, int K, int D,
                 int num_thrd) {
  create_m_beta(C, dat, U, V, m_beta, M, N, D, K, dat, num_thrd);
  create_inv_cov_beta(inv_cov_beta, alpha_beta, alpha_R, D, CCt);
  rand_beta(beta, m_beta, inv_cov_beta, alpha_R, D, M, num_thrd);
  if (isnan(beta[0]))
    print_error_global("nan", NULL, 0);
}


x86 assembly (clang, -O0):
<update_beta>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x28(%rbp),%r9d
mov    0x30(%rbp),%r14d
mov    0x40(%rbp),%ebx
mov    0x38(%rbp),%r11d
mov    -0x20(%rbp),%r10
mov    0x48(%rbp),%eax
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1030 <create_m_beta@plt>
mov    0x18(%rbp),%rdi
mov    0x20(%rbp),%rsi
movsd  -0x48(%rbp),%xmm0
mov    0x40(%rbp),%edx
mov    -0x40(%rbp),%rcx
call   1040 <create_inv_cov_beta@plt>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
movsd  -0x48(%rbp),%xmm0
mov    0x40(%rbp),%ecx
mov    0x28(%rbp),%r8d
mov    0x48(%rbp),%r9d
call   1070 <rand_beta@plt>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
call   1050 <isnan@plt>
cmp    $0x0,%rax
je     123b <update_beta+0xeb>
lea    0xdd0(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <print_error_global@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_beta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
mov    %r9,0x10(%rsp)
mov    %r8,%r15
mov    0x58(%rsp),%r12
mov    0x60(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x50(%rsp),%rbx
mov    0x68(%rsp),%r13d
mov    0x70(%rsp),%r10d
mov    0x80(%rsp),%r14d
mov    0x78(%rsp),%eax
mov    0x88(%rsp),%ebp
sub    $0x8,%rsp
mov    %rbx,%r8
mov    %r13d,%r9d
push   %rbp
push   %rsi
push   %rax
push   %r14
push   %r10
call   1030 <create_m_beta@plt>
add    $0x30,%rsp
mov    %r12,%rdi
mov    0x8(%rsp),%rsi
movsd  (%rsp),%xmm0
mov    %r14d,%edx
mov    0x10(%rsp),%rcx
call   1040 <create_inv_cov_beta@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
movsd  (%rsp),%xmm0
mov    %r14d,%ecx
mov    %r13d,%r8d
mov    %ebp,%r9d
call   1070 <rand_beta@plt>
movsd  (%r15),%xmm0
call   1050 <isnan@plt>
test   %rax,%rax
je     1219 <update_beta+0xc9>
lea    0xdfe(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <print_error_global@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"nan\00"
define void @update_beta(double* %0, float* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, double %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14) {
%16 = alloca double*
%17 = alloca float*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca double
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
store double* %0, double** %16
store float* %1, float** %17
store double* %2, double** %18
store double* %3, double** %19
store double* %4, double** %20
store double* %5, double** %21
store double* %6, double** %22
store double* %7, double** %23
store double* %8, double** %24
store double %9, double* %25
store i32 %10, i32* %26
store i32 %11, i32* %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store i32 %14, i32* %30
%31 = load double*, double** %16
%32 = load float*, float** %17
%33 = load double*, double** %18
%34 = load double*, double** %19
%35 = load double*, double** %22
%36 = load i32, i32* %26
%37 = load i32, i32* %27
%38 = load i32, i32* %29
%39 = load i32, i32* %28
%40 = load float*, float** %17
%41 = load i32, i32* %30
%42 = call i32 @create_m_beta(double* %31, float* %32, double* %33, double* %34, double* %35, i32 %36, i32 %37, i32 %38, i32 %39, float* %40, i32 %41)
%43 = load double*, double** %23
%44 = load double*, double** %24
%45 = load double, double* %25
%46 = load i32, i32* %29
%47 = load double*, double** %21
%48 = call i32 @create_inv_cov_beta(double* %43, double* %44, double %45, i32 %46, double* %47)
%49 = load double*, double** %20
%50 = load double*, double** %22
%51 = load double*, double** %23
%52 = load double, double* %25
%53 = load i32, i32* %29
%54 = load i32, i32* %26
%55 = load i32, i32* %30
%56 = call i32 @rand_beta(double* %49, double* %50, double* %51, double %52, i32 %53, i32 %54, i32 %55)
%57 = load double*, double** %20
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = call i64 @isnan(double %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %15
%63 = call i32 @print_error_global(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* null, i32 0)
br label %64
64: ; preds = %62, %15
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"nan\00"
define void @update_beta(double* %0, float* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, double %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14) {
%16 = tail call i32 @create_m_beta(double* %0, float* %1, double* %2, double* %3, double* %6, i32 %10, i32 %11, i32 %13, i32 %12, float* %1, i32 %14)
%17 = tail call i32 @create_inv_cov_beta(double* %7, double* %8, double %9, i32 %13, double* %5)
%18 = tail call i32 @rand_beta(double* %4, double* %6, double* %7, double %9, i32 %13, i32 %10, i32 %14)
%19 = load double, double* %4
%20 = tail call i64 @isnan(double %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %15
%23 = tail call i32 @print_error_global(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* null, i32 0)
br label %24
24: ; preds = %22, %15
ret void
}