// File: /workspace/github_cpp_makefile_star2_O1/bitwiseshiftleft[P]crandom/test_random.cpp
// Function: void test<crandom::prg_generator<crandom::v_chacha<12, 128>>, double, false>(int, unsigned int, unsigned int, crandom::prg_generator<crandom::v_chacha<12, 128>>*)
void test(int n, unsigned int new_features, unsigned int of_features, gen *generator) {
  unsigned int old_features = crandom_features,
    good = HAVE(new_features) && ((new_features & MUST_MASK) == (MUST_MASK & of_features));
  int i;
  crandom_features = (crandom_features & ~of_features) | new_features | 1;
  print_features(crandom_features);
  
  t out = 0;
  if (good) {
  
    double start=now();
    for (i=0; i<n; i++) {
      if (slow) {
        t x;
        generator->randomize_slow_case((unsigned char *) &x, sizeof(x));
        out += x;
      } else {
        out += generator->template random<t>();
      }
    }
    start = now() - start;
    
    printf("%0.1f ME (%0.1f MB) / %0.3f sec = %0.1f MB/sec",
           i / 1000000.0,
           i * sizeof(t) / 1000000.0,
           start,
           i * sizeof(t) / 1000000.0 / start);
    printf("\n\n");
  } else {
    printf("(unsupported)\n\n");
  }
  
  crandom_features = old_features;
  opacify(out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movl %esi, %r15d
leaq 0x62ac(%rip), %r12      # 0x84f0
movl (%r12), %ebx
testl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
je 0x2276
notl %ebp
andl (%r12), %ebp
orl %r15d, %ebp
orl $0x1, %ebp
movl %ebp, (%r12)
movl %ebp, %edi
callq 0x125c
leaq 0x2fbb(%rip), %rdi      # 0x5229
xorl %r15d, %r15d
jmp 0x2452
movq %rcx, %r14
movl %edi, %r13d
testl %r15d, %r15d
movl %ebx, 0xc(%rsp)
je 0x22c2
testl %ebx, %ebx
je 0x246d
movl (%r12), %eax
notl %ebp
andl %eax, %ebp
movl %eax, %ebx
notl %ebx
orl %r15d, %ebp
orl $0x1, %ebp
movl %ebp, (%r12)
movl %ebp, %edi
callq 0x125c
testl %ebx, %r15d
movl 0xc(%rsp), %ebx
je 0x22d6
xorl %r15d, %r15d
leaq 0x2f6c(%rip), %rdi      # 0x5229
jmp 0x2452
notl %ebp
andl (%r12), %ebp
orl $0x1, %ebp
movl %ebp, (%r12)
movl %ebp, %edi
callq 0x125c
xorl %ebp, %ebp
leaq 0x28(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x1120
cvtsi2sdq (%r15), %xmm0
cvtsi2sdq 0x8(%r15), %xmm1
divsd 0x2d0e(%rip), %xmm1     # 0x5008
addsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movl $0x0, %r15d
testl %r13d, %r13d
jle 0x23de
xorpd %xmm1, %xmm1
movabsq $0x3ff0000000000000, %rbp # imm = 0x3FF0000000000000
movsd 0x2ce7(%rip), %xmm2     # 0x5010
leaq 0x28(%rsp), %r15
movl %r13d, %ebx
cmpl $0x0, 0x14(%r14)
je 0x2372
movl 0x14(%r14), %ecx
cmpl $0x8, %ecx
jb 0x2391
addl $-0x8, %ecx
movl %ecx, 0x14(%r14)
movq 0x18(%r14), %rdx
movq (%rdx,%rcx), %rax
movq $0x0, (%rdx,%rcx)
shrq $0xc, %rax
orq %rbp, %rax
movq %rax, %xmm0
addsd %xmm2, %xmm0
addsd %xmm0, %xmm1
decl %ebx
jne 0x2331
jmp 0x23bc
movq (%r14), %rax
movq %r14, %rdi
movapd %xmm1, 0x10(%rsp)
callq *0x8(%rax)
movsd 0x2c87(%rip), %xmm2     # 0x5010
movapd 0x10(%rsp), %xmm1
jmp 0x2338
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rsi
movapd %xmm1, 0x10(%rsp)
callq 0x2d14
movsd 0x2c61(%rip), %xmm2     # 0x5010
movapd 0x10(%rsp), %xmm1
movq 0x28(%rsp), %rax
jmp 0x2358
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x2c4c(%rip), %xmm1     # 0x5018
cvttsd2si %xmm1, %r15
sarq $0x3f, %rcx
andq %rcx, %r15
orq %rax, %r15
movl %r13d, %ebp
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1120
xorps %xmm0, %xmm0
cvtsi2sdq (%rbx), %xmm0
xorps %xmm2, %xmm2
cvtsi2sdq 0x8(%rbx), %xmm2
movsd 0x2c02(%rip), %xmm3     # 0x5008
divsd %xmm3, %xmm2
addsd %xmm0, %xmm2
subsd 0x20(%rsp), %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movl %ebp, %eax
shlq $0x3, %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd %xmm3, %xmm0
divsd %xmm3, %xmm1
movapd %xmm1, %xmm3
divsd %xmm2, %xmm3
leaq 0x2c15(%rip), %rdi      # 0x5055
movb $0x4, %al
callq 0x1030
leaq 0x2de8(%rip), %rdi      # 0x5236
movl 0xc(%rsp), %ebx
callq 0x1110
movl %ebx, (%r12)
movq %r15, %r15
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x48e8
movl %eax, (%r12)
jmp 0x228d