// File: 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
subq $0xc0, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0x2553
movl $0x1, %edi
callq 0x20c0
movq %rax, %rdi
leaq 0x17706(%rip), %rsi     # 0x19c50
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq -0xa8(%rbp), %rax
movl -0x10(%rbp), %ecx
movl %ecx, 0x8(%rax)
movslq 0x8(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, (%rax)
movslq -0x14(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x8810
movsbl -0x9(%rbp), %eax
cmpl $0x4e, %eax
jne 0x2601
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
leaq -0x50(%rbp), %rdi
callq 0x8840
movl $0x0, -0x54(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x54(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x25fc
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x8890
movq -0xa8(%rbp), %rax
movq (%rax), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x25c2
jmp 0x27ea
movsbl -0x9(%rbp), %eax
cmpl $0x55, %eax
jne 0x2663
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
leaq -0x68(%rbp), %rdi
callq 0x88c0
movl $0x0, -0x6c(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x6c(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x265e
leaq -0x68(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x88f0
movq -0xa8(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2624
jmp 0x27e8
movsbl -0x9(%rbp), %eax
cmpl $0x50, %eax
jne 0x2719
leaq -0x80(%rbp), %rdi
xorps %xmm0, %xmm0
movsd 0xf989(%rip), %xmm1     # 0x12008
callq 0x88c0
movl $0x0, -0x84(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x84(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x2714
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x88f0
movaps %xmm0, %xmm1
movsd 0xf943(%rip), %xmm0     # 0x12008
subsd %xmm1, %xmm0
movsd 0xf937(%rip), %xmm1     # 0x12008
divsd -0x28(%rbp), %xmm1
callq 0x2310
movq -0xa8(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0xb0(%rbp), %xmm0
divsd %xmm1, %xmm0
movq (%rax), %rax
movslq -0x84(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x268e
jmp 0x27e6
movsbl -0x9(%rbp), %eax
cmpl $0x45, %eax
jne 0x27c7
leaq -0x98(%rbp), %rdi
xorps %xmm0, %xmm0
movsd 0xf8d0(%rip), %xmm1     # 0x12008
callq 0x88c0
movl $0x0, -0x9c(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x9c(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x27c5
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x88f0
movaps %xmm0, %xmm1
movsd 0xf887(%rip), %xmm0     # 0x12008
subsd %xmm1, %xmm0
callq 0x2140
movq -0xa8(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0xb8(%rbp), %xmm0
divsd -0x28(%rbp), %xmm1
subsd %xmm1, %xmm0
movq (%rax), %rax
movslq -0x9c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x2747
jmp 0x27e4
movl $0x1, %edi
callq 0x20c0
movq %rax, %rdi
leaq 0x17475(%rip), %rsi     # 0x19c50
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x27e6
jmp 0x27e8
jmp 0x27ea
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)