#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*/ mvnrand_pcs(double *, double *, double *, double **, int);
int /*<<< orphan*/ normalize(double *, double *, int);
void acgrand_pcs(double *x, double *z, double **V, int d) {
  int i;
  double mu[d];
  for (i = 0; i < d; i++)
    mu[i] = 0;
  mvnrand_pcs(x, mu, z, V, d);
  normalize(x, x, d);
}


x86 assembly (clang, -O0):
<acgrand_pcs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118f <acgrand_pcs+0x6f>
mov    -0x38(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1165 <acgrand_pcs+0x45>
mov    -0x38(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <mvnrand_pcs@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <normalize@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acgrand_pcs>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r13d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
mov    %ecx,%edx
mov    %rsp,%rbx
lea    0xf(,%rdx,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %ecx,%ecx
jle    1173 <acgrand_pcs+0x43>
shl    $0x3,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r13d,%r8d
call   1050 <mvnrand_pcs@plt>
mov    %r14,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1040 <normalize@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @acgrand_pcs(double* %0, double* %1, double** %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
store double* %0, double** %5
store double* %1, double** %6
store double** %2, double*** %7
store i32 %3, i32* %8
%12 = load i32, i32* %8
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %10
%15 = alloca double, i64 %13
store i64 %13, i64* %11
store i32 0, i32* %9
br label %16
16: ; preds = %24, %4
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %15, i64 %22
store double 0.000000e+00, double* %23
br label %24
24: ; preds = %20
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
br label %16
27: ; preds = %16
%28 = load double*, double** %5
%29 = load double*, double** %6
%30 = load double**, double*** %7
%31 = load i32, i32* %8
%32 = call i32 @mvnrand_pcs(double* %28, double* %15, double* %29, double** %30, i32 %31)
%33 = load double*, double** %5
%34 = load double*, double** %5
%35 = load i32, i32* %8
%36 = call i32 @normalize(double* %33, double* %34, i32 %35)
%37 = load i8*, i8** %10
ret void
}

LLVM IR (-O2):
define void @acgrand_pcs(double* %0, double* %1, double** %2, i32 %3) {
%5 = zext i32 %3 to i64
%6 = alloca double, i64 %5
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = bitcast double* %6 to i8*
%10 = shl nuw nsw i64 %5, 3
br label %11
11: ; preds = %8, %4
%12 = call i32 @mvnrand_pcs(double* %0, double* %6, double* %1, double** %2, i32 %3)
%13 = call i32 @normalize(double* %0, double* %0, i32 %3)
ret void
}