#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 */
double doublemod(double, double);
scalar_t__ malloc(int);
double *edisrndsq(double *r, int n) {
  double *value, *vp;
  int i;
  if (n >= 1) {
    value = (double *)malloc(n * sizeof(double));
    for (i = 0, vp = value; i < n; i++, vp++) {
      *r = doublemod(*r, 65536.0);
      *r = doublemod((*r) * 2053.0 + 13849.0, 65536.0);
      *vp = *r / 65536.0;
    }
    return value;
  }
}


x86 assembly (clang, -O0):
<edisrndsq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     11f7 <edisrndsq+0xd7>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ef <edisrndsq+0xcf>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe89(%rip),%xmm1
call   1040 <doublemod@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe74(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe70(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe54(%rip),%xmm1
call   1040 <doublemod@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe37(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    115b <edisrndsq+0x3b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edisrndsq>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11a5 <edisrndsq+0x85>
mov    %esi,%r15d
mov    %rdi,%r12
lea    0x0(,%r15,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    %r15d,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12),%xmm0
movsd  0xea2(%rip),%xmm1
call   1040 <doublemod@plt>
movsd  %xmm0,(%r12)
mulsd  0xe97(%rip),%xmm0
addsd  0xe97(%rip),%xmm0
movsd  0xe7f(%rip),%xmm1
call   1040 <doublemod@plt>
movsd  %xmm0,(%r12)
mulsd  0xe84(%rip),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1150 <edisrndsq+0x30>
jmp    11a5 <edisrndsq+0x85>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double* @edisrndsq(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 1
br i1 %10, label %11, label %44
11: ; preds = %2
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
store double* %17, double** %6
store i32 0, i32* %8
%18 = load double*, double** %6
store double* %18, double** %7
br label %19
19: ; preds = %37, %11
%20 = load i32, i32* %8
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %42
23: ; preds = %19
%24 = load double*, double** %4
%25 = load double, double* %24
%26 = call double @doublemod(double %25, double 6.553600e+04)
%27 = load double*, double** %4
store double %26, double* %27
%28 = load double*, double** %4
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %29, double 2.053000e+03, double 1.384900e+04)
%31 = call double @doublemod(double %30, double 6.553600e+04)
%32 = load double*, double** %4
store double %31, double* %32
%33 = load double*, double** %4
%34 = load double, double* %33
%35 = fdiv double %34, 6.553600e+04
%36 = load double*, double** %7
store double %35, double* %36
br label %37
37: ; preds = %23
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
%40 = load double*, double** %7
%41 = getelementptr inbounds double, double* %40, i32 1
store double* %41, double** %7
br label %19
42: ; preds = %19
%43 = load double*, double** %6
store double* %43, double** %3
br label %44
44: ; preds = %42, %2
%45 = load double*, double** %3
ret double* %45
}

LLVM IR (-O2):
define double* @edisrndsq(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = shl i32 %1, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
br label %8
8: ; preds = %4, %8
%9 = phi i32 [ 0, %4 ], [ %16, %8 ]
%10 = phi double* [ %7, %4 ], [ %17, %8 ]
%11 = load double, double* %0
%12 = tail call double @doublemod(double %11, double 6.553600e+04)
store double %12, double* %0
%13 = tail call double @llvm.fmuladd.f64(double %12, double 2.053000e+03, double 1.384900e+04)
%14 = tail call double @doublemod(double %13, double 6.553600e+04)
store double %14, double* %0
%15 = fmul double %14, 0x3EF0000000000000
store double %15, double* %10
%16 = add nuw nsw i32 %9, 1
%17 = getelementptr inbounds double, double* %10, i64 1
%18 = icmp eq i32 %16, %1
br i1 %18, label %19, label %8
19: ; preds = %8, %2
%20 = phi double* [ undef, %2 ], [ %7, %8 ]
ret double* %20
}