// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movsd %xmm1, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
testl %edx, %edx
jle 0x26b4
movl %ecx, %r12d
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movl %edx, 0x8(%rdi)
movl %edx, %edi
shlq $0x3, %rdi
callq 0x2030
movq %rax, (%rbx)
movslq %r12d, %rax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
divq %rcx
cmpq $0x1, %rdx
adcq $0x0, %rdx
movq %rdx, -0x40(%rbp)
movsbl %r15b, %eax
cmpl $0x45, %eax
je 0x25f7
cmpl $0x55, %eax
je 0x2660
cmpl $0x50, %eax
je 0x257c
cmpl $0x4e, %eax
jne 0x26b4
leaq -0x60(%rbp), %r15
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r15)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x8(%r15)
andq $0x0, 0x10(%r15)
movb $0x0, 0x18(%r15)
xorl %r13d, %r13d
leaq -0x40(%rbp), %r12
movslq %r14d, %rax
cmpq %rax, %r13
jge 0x26a5
movq %r15, %rdi
movq %r12, %rsi
callq 0x5bfa
movq (%rbx), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
movl 0x8(%rbx), %r14d
jmp 0x2553
leaq -0x60(%rbp), %r15
andq $0x0, (%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%r15)
movsd 0x5a6e(%rip), %xmm0     # 0x8008
divsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
xorl %r13d, %r13d
leaq -0x40(%rbp), %r12
movslq %r14d, %rax
cmpq %rax, %r13
jge 0x26a5
movq %r15, %rdi
movq %r12, %rsi
callq 0x5c08
movsd 0x5a3e(%rip), %xmm1     # 0x8008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movsd -0x30(%rbp), %xmm1
callq 0x2310
movsd -0x38(%rbp), %xmm1
divsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, (%rax,%r13,8)
incq %r13
movl 0x8(%rbx), %r14d
jmp 0x25ab
leaq -0x60(%rbp), %r15
andq $0x0, (%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%r15)
xorl %r13d, %r13d
leaq -0x40(%rbp), %r12
movslq %r14d, %rax
cmpq %rax, %r13
jge 0x26a5
movq %r15, %rdi
movq %r12, %rsi
callq 0x5c08
movsd 0x59d5(%rip), %xmm1     # 0x8008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x2170
divsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
subsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, (%rax,%r13,8)
incq %r13
movl 0x8(%rbx), %r14d
jmp 0x2614
leaq -0x60(%rbp), %r15
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r15)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x8(%r15)
xorl %r13d, %r13d
leaq -0x40(%rbp), %r12
movslq %r14d, %rax
cmpq %rax, %r13
jge 0x26a5
movq %r15, %rdi
movq %r12, %rsi
callq 0x5c08
movq (%rbx), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
movl 0x8(%rbx), %r14d
jmp 0x2680
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x20e0
leaq 0xa5bd(%rip), %rsi      # 0xcc80
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
nop