#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*/ generateSurfacePointOnUnitSphere(int, double *);
double getRandom();
void generateInsidePoints(double rayon, double *centre, int nbDePoints,
                          double *points) {
  generateSurfacePointOnUnitSphere(nbDePoints, points);
  int j = 0;
  double u;
  for (j = 0; j < nbDePoints; ++j) {
    u = getRandom();
    points[j] *= (rayon + centre[0]) * u;
    points[j + 1] *= (rayon + centre[1]) * u;
    points[j + 2] *= (rayon + centre[2]) * u;
  }
}


x86 assembly (clang, -O0):
<generateInsidePoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <generateSurfacePointOnUnitSphere@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f0 <generateInsidePoints+0xd0>
mov    $0x0,%al
call   1040 <getRandom@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x8(%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x10(%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1152 <generateInsidePoints+0x32>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateInsidePoints>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
movsd  %xmm0,(%rsp)
mov    %esi,%edi
mov    %rdx,%rsi
call   1030 <generateSurfacePointOnUnitSphere@plt>
test   %ebp,%ebp
jle    11b3 <generateInsidePoints+0x93>
mov    %ebp,%r15d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getRandom@plt>
movsd  (%r14),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%rbx,%rbp,8),%xmm1
movsd  %xmm1,(%rbx,%rbp,8)
movsd  0x8(%r14),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rbx,%rbp,8),%xmm1
movsd  %xmm1,0x8(%rbx,%rbp,8)
movsd  0x10(%r14),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x10(%rbx,%rbp,8),%xmm1
movsd  %xmm1,0x10(%rbx,%rbp,8)
lea    0x1(%rbp),%rax
mov    %rax,%rbp
cmp    %rax,%r15
jne    1150 <generateInsidePoints+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @generateInsidePoints(double %0, double* nocapture %1, i32 %2, double* %3) {
%5 = tail call i32 @generateSurfacePointOnUnitSphere(i32 %2, double* %3)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %35
7: ; preds = %4
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = getelementptr inbounds double, double* %1, i64 2
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %23, %11 ]
%13 = tail call double (...) @getRandom()
%14 = load double, double* %1
%15 = fadd double %14, %0
%16 = fmul double %13, %15
%17 = getelementptr inbounds double, double* %3, i64 %12
%18 = load double, double* %17
%19 = fmul double %18, %16
store double %19, double* %17
%20 = load double, double* %8
%21 = fadd double %20, %0
%22 = fmul double %13, %21
%23 = add nuw nsw i64 %12, 1
%24 = getelementptr inbounds double, double* %3, i64 %23
%25 = load double, double* %24
%26 = fmul double %25, %22
store double %26, double* %24
%27 = load double, double* %9
%28 = fadd double %27, %0
%29 = fmul double %13, %28
%30 = add nuw nsw i64 %12, 2
%31 = getelementptr inbounds double, double* %3, i64 %30
%32 = load double, double* %31
%33 = fmul double %32, %29
store double %33, double* %31
%34 = icmp eq i64 %23, %10
br i1 %34, label %35, label %11
35: ; preds = %11, %4
ret void
}