#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 */
typedef size_t V;

/* Variables and functions */
int /*<<< orphan*/ resample_post_beta(int, int, int **, int *, int, double **,
                                      int ***, int ***);
void initialize_post_beta(double **post_beta, int D, int K, int **M, int *N,
                          int V, int ***w, int ***z) {
  int dvv_loop_var_1;
  int dvv_loop_var_2;
  for (dvv_loop_var_1 = 1; dvv_loop_var_1 <= K; dvv_loop_var_1++) {
    for (dvv_loop_var_2 = 1; dvv_loop_var_2 <= V; dvv_loop_var_2++) {
      post_beta[dvv_loop_var_1 - 1][dvv_loop_var_2 - 1] = 0.0;
    }
    post_beta[dvv_loop_var_1 - 1][(V) + (1) - 1] = (0.0) * (((1) + (V)) - (1));
  }
  resample_post_beta(D, K, M, N, V, post_beta, w, z);
}


x86 assembly (clang, -O0):
<initialize_post_beta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d0 <initialize_post_beta+0xc0>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     118c <initialize_post_beta+0x7c>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1150 <initialize_post_beta+0x40>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113d <initialize_post_beta+0x2d>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x8(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <resample_post_beta@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_post_beta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9d,%ebx
mov    %r8,%rbp
mov    %rdi,%r15
test   %edx,%edx
jle    11c7 <initialize_post_beta+0xa7>
cvtsi2sd %ebx,%xmm0
xorpd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movslq %ebx,%r13
mov    %r13d,%eax
shl    $0x3,%rax
mov    %rax,0x8(%rsp)
mov    %edx,%eax
cmp    $0x1,%edx
mov    %rbp,0x28(%rsp)
mov    %rcx,0x18(%rsp)
mov    %edx,0x4(%rsp)
mov    %esi,(%rsp)
mov    %rax,0x20(%rsp)
jne    11ea <initialize_post_beta+0xca>
xor    %r14d,%r14d
testb  $0x1,0x20(%rsp)
mov    0x28(%rsp),%rbp
mov    0x18(%rsp),%rcx
mov    0x4(%rsp),%edx
mov    (%rsp),%esi
je     11c7 <initialize_post_beta+0xa7>
mov    (%r15,%r14,8),%r12
test   %ebx,%ebx
jle    11af <initialize_post_beta+0x8f>
mov    %r12,%rdi
xor    %esi,%esi
mov    0x8(%rsp),%rdx
call   1030 <memset@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r12,%r13,8)
mov    0x18(%rsp),%rcx
mov    0x4(%rsp),%edx
mov    (%rsp),%esi
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %rbp,%rcx
mov    %ebx,%r8d
mov    %r15,%r9
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <resample_post_beta@plt>
and    $0xfffffffe,%eax
mov    %rax,0x30(%rsp)
xor    %r14d,%r14d
jmp    121c <initialize_post_beta+0xfc>
nopw   0x0(%rax,%rax,1)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp,%r13,8)
add    $0x2,%r14
cmp    %r14,0x30(%rsp)
je     1180 <initialize_post_beta+0x60>
mov    (%r15,%r14,8),%r12
test   %ebx,%ebx
jle    1233 <initialize_post_beta+0x113>
mov    %r12,%rdi
xor    %esi,%esi
mov    0x8(%rsp),%rdx
call   1030 <memset@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r12,%r13,8)
mov    0x8(%r15,%r14,8),%rbp
test   %ebx,%ebx
jle    1200 <initialize_post_beta+0xe0>
mov    %rbp,%rdi
xor    %esi,%esi
mov    0x8(%rsp),%rdx
call   1030 <memset@plt>
jmp    1200 <initialize_post_beta+0xe0>

LLVM IR (-O0):
define void @initialize_post_beta(double** %0, i32 %1, i32 %2, i32** %3, i32* %4, i32 %5, i32*** %6, i32*** %7) {
%9 = alloca double**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32**
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32***
%16 = alloca i32***
%17 = alloca i32
%18 = alloca i32
store double** %0, double*** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32** %3, i32*** %12
store i32* %4, i32** %13
store i32 %5, i32* %14
store i32*** %6, i32**** %15
store i32*** %7, i32**** %16
store i32 1, i32* %17
br label %19
19: ; preds = %59, %8
%20 = load i32, i32* %17
%21 = load i32, i32* %11
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %62
23: ; preds = %19
store i32 1, i32* %18
br label %24
24: ; preds = %39, %23
%25 = load i32, i32* %18
%26 = load i32, i32* %14
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load double**, double*** %9
%30 = load i32, i32* %17
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double*, double** %29, i64 %32
%34 = load double*, double** %33
%35 = load i32, i32* %18
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %34, i64 %37
store double 0.000000e+00, double* %38
br label %39
39: ; preds = %28
%40 = load i32, i32* %18
%41 = add nsw i32 %40, 1
store i32 %41, i32* %18
br label %24
42: ; preds = %24
%43 = load i32, i32* %14
%44 = add nsw i32 1, %43
%45 = sub nsw i32 %44, 1
%46 = sitofp i32 %45 to double
%47 = fmul double 0.000000e+00, %46
%48 = load double**, double*** %9
%49 = load i32, i32* %17
%50 = sub nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double*, double** %48, i64 %51
%53 = load double*, double** %52
%54 = load i32, i32* %14
%55 = add nsw i32 %54, 1
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %53, i64 %57
store double %47, double* %58
br label %59
59: ; preds = %42
%60 = load i32, i32* %17
%61 = add nsw i32 %60, 1
store i32 %61, i32* %17
br label %19
62: ; preds = %19
%63 = load i32, i32* %10
%64 = load i32, i32* %11
%65 = load i32**, i32*** %12
%66 = load i32*, i32** %13
%67 = load i32, i32* %14
%68 = load double**, double*** %9
%69 = load i32***, i32**** %15
%70 = load i32***, i32**** %16
%71 = call i32 @resample_post_beta(i32 %63, i32 %64, i32** %65, i32* %66, i32 %67, double** %68, i32*** %69, i32*** %70)
ret void
}

LLVM IR (-O2):
define void @initialize_post_beta(double** %0, i32 %1, i32 %2, i32** %3, i32* %4, i32 %5, i32*** %6, i32*** %7) {
%9 = icmp slt i32 %2, 1
br i1 %9, label %53, label %10
10: ; preds = %8
%11 = icmp slt i32 %5, 1
%12 = sitofp i32 %5 to double
%13 = fmul double %12, 0.000000e+00
%14 = sext i32 %5 to i64
%15 = zext i32 %5 to i64
%16 = shl nuw nsw i64 %15, 3
%17 = zext i32 %2 to i64
%18 = and i64 %17, 1
%19 = icmp eq i32 %2, 1
br i1 %19, label %43, label %20
20: ; preds = %10
%21 = and i64 %17, 4294967294
br label %22
22: ; preds = %36, %20
%23 = phi i64 [ 1, %20 ], [ %38, %36 ]
%24 = phi i64 [ 0, %20 ], [ %39, %36 ]
%25 = add nsw i64 %23, -1
%26 = getelementptr inbounds double*, double** %0, i64 %25
%27 = load double*, double** %26
br i1 %11, label %30, label %28
28: ; preds = %22
%29 = bitcast double* %27 to i8*
br label %30
30: ; preds = %22, %28
%31 = getelementptr inbounds double, double* %27, i64 %14
store double %13, double* %31
%32 = getelementptr inbounds double*, double** %0, i64 %23
%33 = load double*, double** %32
br i1 %11, label %36, label %34
34: ; preds = %30
%35 = bitcast double* %33 to i8*
br label %36
36: ; preds = %34, %30
%37 = getelementptr inbounds double, double* %33, i64 %14
store double %13, double* %37
%38 = add nuw nsw i64 %23, 2
%39 = add i64 %24, 2
%40 = icmp eq i64 %39, %21
br i1 %40, label %41, label %22
41: ; preds = %36
%42 = add nuw i64 %23, 1
br label %43
43: ; preds = %41, %10
%44 = phi i64 [ 0, %10 ], [ %42, %41 ]
%45 = icmp eq i64 %18, 0
br i1 %45, label %53, label %46
46: ; preds = %43
%47 = getelementptr inbounds double*, double** %0, i64 %44
%48 = load double*, double** %47
br i1 %11, label %51, label %49
49: ; preds = %46
%50 = bitcast double* %48 to i8*
br label %51
51: ; preds = %49, %46
%52 = getelementptr inbounds double, double* %48, i64 %14
store double %13, double* %52
br label %53
53: ; preds = %51, %43, %8
%54 = tail call i32 @resample_post_beta(i32 %1, i32 %2, i32** %3, i32* %4, i32 %5, double** %0, i32*** %6, i32*** %7)
ret void
}