#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(double *);
double *normrnd(int, double, double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int main(int argc, char *argv[]) {
  int n;
  double m;
  double s;
  sscanf(argv[1], "%d", &n);
  sscanf(argv[2], "%lf", &m);
  sscanf(argv[3], "%lf", &s);
  int rint;
  FILE *fp;
  fp = fopen("/dev/urandom", "r");
  fread(&rint, 1, sizeof(int), fp);
  fclose(fp);
  srand(rint);
  double *arr = normrnd(n, m, s);
  for (int i = 0; i < n; i++) {
    printf("%.20f\n", arr[i]);
  }
  free(arr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe44(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe2a(%rip),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1080 <sscanf@plt>
lea    0xe1c(%rip),%rdi
lea    0xe22(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x2c(%rbp),%edi
call   1070 <srand@plt>
mov    -0x14(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   10a0 <normrnd@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1273 <main+0xf3>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdb6(%rip),%rdi
call   1060 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1240 <main+0xc0>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe69(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0xe55(%rip),%r14
lea    0x18(%rsp),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x18(%rbx),%rdi
lea    0x10(%rsp),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
lea    0xe30(%rip),%rdi
lea    0xe36(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0xc(%rsp),%edi
call   1070 <srand@plt>
mov    0x8(%rsp),%edi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   10a0 <normrnd@plt>
mov    %rax,%r15
cmpl   $0x0,0x8(%rsp)
jle    125c <main+0xdc>
xor    %ebx,%ebx
lea    0xde0(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
call   1060 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1240 <main+0xc0>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"/dev/urandom\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [7 x i8] c"%.20f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32*
%11 = alloca double*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i8*, ...) @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) @sscanf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %8)
%25 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %25, i32** %10
%26 = load i32*, i32** %10
%27 = call i32 @fread(i32* %9, i32 1, i32 4, i32* %26)
%28 = load i32*, i32** %10
%29 = call i32 @fclose(i32* %28)
%30 = load i32, i32* %9
%31 = call i32 @srand(i32 %30)
%32 = load i32, i32* %6
%33 = load double, double* %7
%34 = load double, double* %8
%35 = call double* @normrnd(i32 %32, double %33, double %34)
store double* %35, double** %11
store i32 0, i32* %12
br label %36
36: ; preds = %47, %2
%37 = load i32, i32* %12
%38 = load i32, i32* %6
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load double*, double** %11
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
%45 = load double, double* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %12
%49 = add nsw i32 %48, 1
store i32 %49, i32* %12
br label %36
50: ; preds = %36
%51 = load double*, double** %11
%52 = call i32 @free(double* %51)
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"/dev/urandom\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [7 x i8] c"%.20f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i8*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = call i32 (i8*, i8*, ...) @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%19 = bitcast i32* %6 to i8*
%20 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @fread(i32* %6, i32 1, i32 4, i32* %20)
%22 = call i32 @fclose(i32* %20)
%23 = load i32, i32* %6
%24 = call i32 @srand(i32 %23)
%25 = load i32, i32* %3
%26 = load double, double* %4
%27 = load double, double* %5
%28 = call double* @normrnd(i32 %25, double %26, double %27)
%29 = load i32, i32* %3
%30 = icmp sgt i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %33, %2
%32 = call i32 @free(double* %28)
ret i32 0
33: ; preds = %2, %33
%34 = phi i64 [ %38, %33 ], [ 0, %2 ]
%35 = getelementptr inbounds double, double* %28, i64 %34
%36 = load double, double* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %36)
%38 = add nuw nsw i64 %34, 1
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %33, label %31
}