// File: bitwiseshiftleft[P]crandom/bench.cpp
// Function: void test<crandom::v_chacha<12, 128>, 22u, 22u>(int)
void test(int n) {
  unsigned int old_features = crandom_features,
    good = HAVE(new_features) && ((new_features & MUST_MASK) == (MUST_MASK & of_features));
  crandom_features = (crandom_features & ~of_features) | new_features | 1;
  print_features(new_features);
  
  if (good) {
    unsigned char key[generator::input_size], output[generator::output_size];
    int i;
    u_int64_t iv=0, ctr=0;
    bzero(key, sizeof(key));
    bzero(output, sizeof(output));
    
    double start=now();
    for (i=0; i<n; i++) {
      generator::expand(iv, ctr, key, output);
    }
    start = now() - start;
    
    printf("%s: %0.1f MB / %0.3f sec = %0.1f MB/sec\nchecksum = ",
           generator::get_name().c_str(),
           i * generator::output_size / 1000000.0,
           start,
           i * generator::output_size / 1000000.0 / start);
    for (i=16; i<32; i++) {
      printf("%02x", output[i]);
      if ((i&3)==3) printf(" ");
    }
    printf("\n\n");
  } else {
    printf("(unsupported)\n\n");
  }
  
  crandom_features = old_features;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl %edi, -0x4(%rbp)
leaq 0x606b(%rip), %rax      # 0x8540
movl (%rax), %eax
movl %eax, -0x8(%rbp)
movl $0x16, %edi
callq 0x2400
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xfd(%rbp)
je 0x24fd
movb $0x1, %al
movb %al, -0xfd(%rbp)
jmp 0x24fd
movb -0xfd(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xc(%rbp)
leaq 0x602e(%rip), %rax      # 0x8540
movl (%rax), %ecx
andl $-0x17, %ecx
orl $0x16, %ecx
orl $0x1, %ecx
leaq 0x601c(%rip), %rax      # 0x8540
movl %ecx, (%rax)
movl $0x16, %edi
callq 0x2300
cmpl $0x0, -0xc(%rbp)
je 0x26d4
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2090
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2090
callq 0x2480
movsd %xmm0, -0xd0(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x25c4
movq -0xc0(%rbp), %rdi
leaq -0x30(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
leaq -0xc8(%rbp), %rsi
callq 0x3280
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x258a
callq 0x2480
movsd -0xd0(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x32d0
movq -0x108(%rbp), %rdi
callq 0x2070
movq %rax, %rsi
movl -0xb4(%rbp), %eax
shll $0x7, %eax
cvtsi2sd %eax, %xmm0
movsd 0x39f4(%rip), %xmm1     # 0x6008
divsd %xmm1, %xmm0
movsd -0xd0(%rbp), %xmm1
movaps %xmm0, %xmm2
divsd %xmm1, %xmm2
leaq 0x3a0e(%rip), %rdi      # 0x603c
movb $0x3, %al
callq 0x2030
jmp 0x2637
leaq -0xf0(%rbp), %rdi
callq 0x20a0
movl $0x10, -0xb4(%rbp)
cmpl $0x20, -0xb4(%rbp)
jge 0x26c4
movslq -0xb4(%rbp), %rax
movzbl -0xb0(%rbp,%rax), %esi
leaq 0x3a04(%rip), %rdi      # 0x6070
movb $0x0, %al
callq 0x2030
movl -0xb4(%rbp), %eax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x26b1
leaq 0x39e6(%rip), %rdi      # 0x606e
movb $0x0, %al
callq 0x2030
jmp 0x26b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf8(%rbp)
movl %eax, -0xfc(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x20a0
jmp 0x26f7
jmp 0x26b3
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x264d
leaq 0x39b7(%rip), %rdi      # 0x6082
movb $0x0, %al
callq 0x2030
jmp 0x26e2
leaq 0x399a(%rip), %rdi      # 0x6075
movb $0x0, %al
callq 0x2030
movl -0x8(%rbp), %ecx
leaq 0x5e54(%rip), %rax      # 0x8540
movl %ecx, (%rax)
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0xf8(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
nopl (%rax)