// File: /workspace/github_cpp_makefile_star2_O3/ashlall[P]StreamStats/ChiSquareExperiments/./DataGenerator.cpp
// Function: DataGenerator::DataGenerator(char, int, int, double, double)
DataGenerator::DataGenerator(char distribution_type, int size, int seed, double location, double scale)
{
  if (size <= 0)
    throw ParameterError();
  stream_size = size;
  stream = new double[stream_size];
  std::default_random_engine generator(seed);
  if (distribution_type == 'N')
    {
      std::normal_distribution<double> distribution(location, scale); // mean, SD
      for (int i = 0; i < stream_size; i++)
	stream[i] = distribution(generator);
    }
  else if (distribution_type == 'U')
    {
      std::uniform_real_distribution<double> distribution(location, scale); // lower, upper bounds
      for (int i = 0; i < stream_size; i++)
	stream[i] = distribution(generator);
    }
  else if (distribution_type == 'P')
    {
      std::uniform_real_distribution<double> distribution(0.0, 1.0);
      for (int i = 0; i < stream_size; i++)
	stream[i] = location / std::pow(1.0 - distribution(generator), 1.0/scale);
    }
  else if (distribution_type == 'E')
    {
      std::uniform_real_distribution<double> distribution(0.0, 1.0);
      for (int i = 0; i < stream_size; i++)
	stream[i] = location - std::log(1 - distribution(generator))/scale;
    }
  else
    throw ParameterError();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movsd %xmm1, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
testl %edx, %edx
jle 0x271d
movl %ecx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
movl %edx, 0x8(%rdi)
movl %edx, %edi
shlq $0x3, %rdi
callq 0x2030
movq %rax, %rcx
movslq %r15d, %rsi
movabsq $0x200000005, %rdx      # imm = 0x200000005
movq %rsi, %rax
mulq %rdx
movq %rsi, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x1e, %rax
movq %rax, %rdx
shlq $0x1f, %rdx
subq %rdx, %rax
leaq (%rsi,%rax), %rdx
cmpq $0x1, %rdx
adcq %rsi, %rax
movq %rcx, (%rbx)
movq %rax, -0x38(%rbp)
movsbl %r14b, %eax
cmpl $0x4f, %eax
jg 0x2606
cmpl $0x45, %eax
je 0x265e
cmpl $0x4e, %eax
movsd -0x30(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
jne 0x271d
leaq -0x58(%rbp), %r14
movsd %xmm0, (%r14)
movsd %xmm1, 0x8(%r14)
movq $0x0, 0x10(%r14)
movb $0x0, 0x18(%r14)
xorl %r12d, %r12d
leaq -0x38(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6d10
movq (%rbx), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x8(%rbx), %rax
cmpq %rax, %r12
jl 0x25de
jmp 0x2710
cmpl $0x50, %eax
je 0x26af
cmpl $0x55, %eax
movsd -0x30(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
jne 0x271d
subsd %xmm0, %xmm1
movsd %xmm1, -0x28(%rbp)
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6e06
mulsd -0x28(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movq (%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x2632
jmp 0x2710
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6e06
addsd 0x699b(%rip), %xmm0     # 0x9010
movsd 0x698b(%rip), %xmm1     # 0x9008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x21a0
divsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, (%rax,%r15,8)
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x2665
jmp 0x2710
movsd 0x6951(%rip), %xmm0     # 0x9008
divsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6e06
addsd 0x6938(%rip), %xmm0     # 0x9010
movsd 0x6928(%rip), %xmm1     # 0x9008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movsd -0x28(%rbp), %xmm1
callq 0x2350
movsd -0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, (%rax,%r15,8)
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x26c8
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x2100
leaq 0xa54a(%rip), %rsi      # 0xcc78
movq %rax, %rdi
xorl %edx, %edx
callq 0x2330