// File: /workspace/github_cpp_makefile_star2_O1/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 0x2747
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 0x260e
cmpl $0x45, %eax
je 0x2674
cmpl $0x4e, %eax
movsd -0x30(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
jne 0x2747
movsd %xmm0, -0x58(%rbp)
movsd %xmm1, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
cmpl $0x0, 0x8(%rbx)
jle 0x273a
xorl %r12d, %r12d
leaq -0x38(%rbp), %r14
leaq -0x58(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6e9c
movq (%rbx), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x8(%rbx), %rax
cmpq %rax, %r12
jl 0x25e6
jmp 0x273a
cmpl $0x50, %eax
je 0x26cf
cmpl $0x55, %eax
movsd -0x30(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
jne 0x2747
cmpl $0x0, 0x8(%rbx)
jle 0x273a
subsd %xmm0, %xmm1
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movsd %xmm1, -0x28(%rbp)
movq %r14, %rdi
callq 0x6f92
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
addsd -0x30(%rbp), %xmm0
movq (%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x2644
jmp 0x273a
cmpl $0x0, 0x8(%rbx)
jle 0x273a
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6f92
addsd 0x697b(%rip), %xmm0     # 0x9010
movsd 0x696b(%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 0x2685
jmp 0x273a
cmpl $0x0, 0x8(%rbx)
movsd -0x28(%rbp), %xmm0
jle 0x273a
movsd 0x6926(%rip), %xmm1     # 0x9008
divsd %xmm0, %xmm1
movsd %xmm1, -0x28(%rbp)
xorl %r15d, %r15d
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6f92
addsd 0x690e(%rip), %xmm0     # 0x9010
movsd 0x68fe(%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 0x26f2
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x2100
leaq 0xa520(%rip), %rsi      # 0xcc78
movq %rax, %rdi
xorl %edx, %edx
callq 0x2330