#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*/ getch();
double *nordisrndsq(double, double, double *, int);
int /*<<< orphan*/ printf(char *, ...);
main() {
  double u, g, r, *valsq, *vp;
  int i, n;
  u = 2.7;
  g = 4.3;
  r = 3.0;
  n = 10;
  valsq = nordisrndsq(u, g, &r, n);
  printf("\nThe sequence of normal distributed random number is:\n");
  for (i = 0, vp = valsq; i < n; i++, vp++) {
    if (i < n - 1)
      printf("%5.2lf;", *vp);
    else
      printf("%5.2lf!", *vp);
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe9f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0xa,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x38(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1030 <nordisrndsq@plt>
mov    %rax,-0x28(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1211 <main+0xe1>
mov    -0x34(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11dc <main+0xac>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe7f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11f2 <main+0xc2>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11f7 <main+0xc7>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
jmp    11a4 <main+0x74>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movabs $0x4008000000000000,%rax
mov    %rax,(%rsp)
movsd  0xea6(%rip),%xmm0
movsd  0xea6(%rip),%xmm1
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <nordisrndsq@plt>
mov    %rax,%rbx
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rbx),%xmm0
lea    0xe87(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x18(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x20(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x28(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x30(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x38(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x40(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x48(%rbx),%xmm0
lea    0xe01(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [55 x i8] c"\0AThe sequence of normal distributed random number is:\0A\00"
@.str.1 = [8 x i8] c"%5.2lf;\00"
@.str.2 = [8 x i8] c"%5.2lf!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store double 2.700000e+00, double* %2
store double 4.300000e+00, double* %3
store double 3.000000e+00, double* %4
store i32 10, i32* %8
%9 = load double, double* %2
%10 = load double, double* %3
%11 = load i32, i32* %8
%12 = call double* @nordisrndsq(double %9, double %10, double* %4, i32 %11)
store double* %12, double** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
%14 = load double*, double** %5
store double* %14, double** %6
br label %15
15: ; preds = %33, %0
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %38
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = sub nsw i32 %21, 1
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load double*, double** %6
%26 = load double, double* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %26)
br label %32
28: ; preds = %19
%29 = load double*, double** %6
%30 = load double, double* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %30)
br label %32
32: ; preds = %28, %24
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i32 1
store double* %37, double** %6
br label %15
38: ; preds = %15
%39 = call i32 (...) @getch()
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%5.2lf;\00"
@.str.2 = [8 x i8] c"%5.2lf!\00"
@str = [54 x i8] c"\0AThe sequence of normal distributed random number is:\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 3.000000e+00, double* %1
%3 = call double* @nordisrndsq(double 2.700000e+00, double 4.300000e+00, double* %1, i32 10)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%5 = load double, double* %3
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = getelementptr inbounds double, double* %3, i64 1
%8 = load double, double* %7
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = getelementptr inbounds double, double* %3, i64 2
%11 = load double, double* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = getelementptr inbounds double, double* %3, i64 3
%14 = load double, double* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %14)
%16 = getelementptr inbounds double, double* %3, i64 4
%17 = load double, double* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = getelementptr inbounds double, double* %3, i64 5
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = getelementptr inbounds double, double* %3, i64 6
%23 = load double, double* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = getelementptr inbounds double, double* %3, i64 7
%26 = load double, double* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = getelementptr inbounds double, double* %3, i64 8
%29 = load double, double* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %29)
%31 = getelementptr inbounds double, double* %3, i64 9
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = call i32 (...) @getch()
ret i32 0
}