#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 K;

/* Variables and functions */
int /*<<< orphan*/ resample_post_theta(int, int, int **, int *, double **,
                                       double **, int *, int ***);
void initialize_post_theta(double **post_theta, double **post_theta_train,
                           int *entity_map, int D, int K, int **M, int *N,
                           int ***z) {
  int dvv_loop_var_1;
  int dvv_loop_var_2;
  for (dvv_loop_var_1 = 1; dvv_loop_var_1 <= D; dvv_loop_var_1++) {
    for (dvv_loop_var_2 = 1; dvv_loop_var_2 <= K; dvv_loop_var_2++) {
      post_theta[dvv_loop_var_1 - 1][dvv_loop_var_2 - 1] = 0.0;
    }
    post_theta[dvv_loop_var_1 - 1][(K) + (1) - 1] = (0.0) * (((1) + (K)) - (1));
  }
  resample_post_theta(D, K, M, N, post_theta, post_theta_train, entity_map, z);
}


x86 assembly (clang, -O0):
<initialize_post_theta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11d1 <initialize_post_theta+0xc1>
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     118d <initialize_post_theta+0x7d>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1151 <initialize_post_theta+0x41>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113e <initialize_post_theta+0x2e>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x18(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <resample_post_theta@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_post_theta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8d,%ebp
mov    %rdx,%r15
mov    %rsi,%rax
mov    %rdi,%r12
mov    0x88(%rsp),%rbx
test   %ecx,%ecx
jle    11ec <initialize_post_theta+0xcc>
cvtsi2sd %ebp,%xmm0
xorpd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movslq %ebp,%r13
mov    %r13d,%edx
shl    $0x3,%rdx
mov    %rdx,0x10(%rsp)
mov    %ecx,%edx
cmp    $0x1,%ecx
mov    %r15,0x38(%rsp)
mov    %r9,0x28(%rsp)
mov    %rax,0x20(%rsp)
mov    %ecx,0xc(%rsp)
mov    %rdx,0x30(%rsp)
jne    1218 <initialize_post_theta+0xf8>
xor    %r14d,%r14d
testb  $0x1,0x30(%rsp)
mov    0x38(%rsp),%r15
mov    0x28(%rsp),%r9
mov    0x20(%rsp),%rax
mov    0x88(%rsp),%rbx
mov    0xc(%rsp),%ecx
je     11ec <initialize_post_theta+0xcc>
mov    (%r12,%r14,8),%rbx
test   %ebp,%ebp
jle    11ca <initialize_post_theta+0xaa>
mov    %rbx,%rdi
xor    %esi,%esi
mov    0x10(%rsp),%rdx
call   1030 <memset@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rbx,%r13,8)
mov    0x28(%rsp),%r9
mov    0x20(%rsp),%rax
mov    0x88(%rsp),%rbx
mov    0xc(%rsp),%ecx
mov    %ecx,%edi
mov    %ebp,%esi
mov    %r9,%rdx
mov    0x80(%rsp),%rcx
mov    %r12,%r8
mov    %rax,%r9
push   %rbx
push   %r15
call   1040 <resample_post_theta@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
and    $0xfffffffe,%edx
mov    %rdx,0x40(%rsp)
xor    %r14d,%r14d
jmp    124b <initialize_post_theta+0x12b>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rbx,%r13,8)
add    $0x2,%r14
cmp    %r14,0x40(%rsp)
je     1191 <initialize_post_theta+0x71>
mov    (%r12,%r14,8),%r15
test   %ebp,%ebp
jle    1262 <initialize_post_theta+0x142>
mov    %r15,%rdi
xor    %esi,%esi
mov    0x10(%rsp),%rdx
call   1030 <memset@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r15,%r13,8)
mov    0x8(%r12,%r14,8),%rbx
test   %ebp,%ebp
jle    1230 <initialize_post_theta+0x110>
mov    %rbx,%rdi
xor    %esi,%esi
mov    0x10(%rsp),%rdx
call   1030 <memset@plt>
jmp    1230 <initialize_post_theta+0x110>

LLVM IR (-O0):
define void @initialize_post_theta(double** %0, double** %1, i32* %2, i32 %3, i32 %4, i32** %5, i32* %6, i32*** %7) {
%9 = alloca double**
%10 = alloca double**
%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 double** %1, double*** %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* %12
%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* %13
%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* %13
%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* %13
%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* %12
%64 = load i32, i32* %13
%65 = load i32**, i32*** %14
%66 = load i32*, i32** %15
%67 = load double**, double*** %9
%68 = load double**, double*** %10
%69 = load i32*, i32** %11
%70 = load i32***, i32**** %16
%71 = call i32 @resample_post_theta(i32 %63, i32 %64, i32** %65, i32* %66, double** %67, double** %68, i32* %69, i32*** %70)
ret void
}

LLVM IR (-O2):
define void @initialize_post_theta(double** %0, double** %1, i32* %2, i32 %3, i32 %4, i32** %5, i32* %6, i32*** %7) {
%9 = icmp slt i32 %3, 1
br i1 %9, label %53, label %10
10: ; preds = %8
%11 = icmp slt i32 %4, 1
%12 = sitofp i32 %4 to double
%13 = fmul double %12, 0.000000e+00
%14 = sext i32 %4 to i64
%15 = zext i32 %4 to i64
%16 = shl nuw nsw i64 %15, 3
%17 = zext i32 %3 to i64
%18 = and i64 %17, 1
%19 = icmp eq i32 %3, 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_theta(i32 %3, i32 %4, i32** %5, i32* %6, double** %0, double** %1, i32* %2, i32*** %7)
ret void
}