// File: /workspace/github_cpp_makefile_star2_O2/bitwiseshiftleft[P]crandom/test_random.cpp
// Function: main
int main(int argc, char **argv) {
  (void) argc; (void) argv;
  
  crandom_features = crandom_detect_features();
  
  unsigned int chacha_features = SSE2 | SSSE3 | XOP, aes_features = AESNI;
  
  prg_generator<chacha> *ch = new prg_generator<chacha>(true);
  prg_generator<aes> *ae = new prg_generator<aes>(true);
  printf("****** Generators and processor features ******\n\n");
  
  printf("chacha, direct, u_int32_t");
  test<prg_generator<chacha>, u_int32_t, false>(100000000, SSE2 | SSSE3 | XOP, chacha_features, ch);
  printf("chacha, direct, u_int32_t");
  test<prg_generator<chacha>, u_int32_t, false>(100000000, SSE2 | SSSE3, chacha_features, ch);
  printf("chacha, direct, u_int32_t");
  test<prg_generator<chacha>, u_int32_t, false>(100000000, SSE2, chacha_features, ch);
  printf("chacha, direct, u_int32_t");
  test<prg_generator<chacha>, u_int32_t, false>(10000000, 0, chacha_features, ch);
  
  printf("aes, direct, u_int32_t");
  test<prg_generator<aes>, u_int32_t, false>(100000000, AESNI, aes_features, ae);
  printf("aes, direct, u_int32_t");
  test<prg_generator<aes>, u_int32_t, false>(10000000, 0, aes_features, ae);
  
  printf("rand, int\n");
  test_rand(100000000);
  
  printf("random, int\n");
  test_random(100000000);
  
  #ifdef __MAC_10_0
    printf("arc4random, int\n");
    test_arc4random(10000000);
  #endif
  
  printf("drand48, int\n");
  test_drand48(10000000);
  
  printf("****** Data sizes ******\n\n");
  
  printf("chacha, direct, u_int128_t");
  test<prg_generator<chacha>, u_int128_t, false>(100000000, 0, 0, ch);
  printf("chacha, direct, u_int8_t");
  test<prg_generator<chacha>, u_int8_t, false>(100000000, 0, 0, ch);
  printf("chacha, direct, float");
  test<prg_generator<chacha>, float, false>(100000000, 0, 0, ch);
  printf("chacha, direct, double");
  test<prg_generator<chacha>, double, false>(100000000, 0, 0, ch);
  printf("aes, direct, u_int128_t");
  test<prg_generator<aes>, u_int128_t, false>(100000000, AESNI, aes_features, ae);
  printf("aes, direct, u_int8_t");
  test<prg_generator<aes>, u_int8_t, false>(100000000, 0, 0, ae);
  
  printf("****** Indirection ******\n\n");
  
  printf("aes, indirect, u_int32_t");
  test<generator_base, u_int32_t, false>(100000000, 0, 0,
    opacify(1) ? static_cast<generator_base *>(ae) : static_cast<generator_base *>(ch));
  printf("chacha, indirect, u_int32_t");
  test<generator_base, u_int32_t, false>(100000000, 0, 0,
    opacify(1) ? static_cast<generator_base *>(ch) : static_cast<generator_base *>(ae));
  printf("chacha, indirect, u_int32_t, slow case");
  test<generator_base, u_int32_t, true>(100000000, 0, 0,
    opacify(1) ? static_cast<generator_base *>(ch) : static_cast<generator_base *>(ae));
  
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x3ce0
leaq 0x607d(%rip), %rcx      # 0x74f0
movl %eax, (%rcx)
pushq $0x28
popq %rdi
callq 0x10e0
movq %rax, %rbx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x176e
pushq $0x28
popq %rdi
callq 0x10e0
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x1792
leaq 0x2cf8(%rip), %rdi      # 0x41a0
callq 0x1110
leaq 0x2bd0(%rip), %r15      # 0x4084
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
pushq $0x16
popq %rbp
movl $0x5f5e100, %edi        # imm = 0x5F5E100
movl %ebp, %esi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x17b6
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
pushq $0x6
popq %rsi
movl $0x5f5e100, %edi        # imm = 0x5F5E100
movl %ebp, %edx
movq %rbx, %rcx
callq 0x17b6
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
pushq $0x2
popq %rsi
movl $0x5f5e100, %edi        # imm = 0x5F5E100
movl %ebp, %edx
movq %rbx, %rcx
callq 0x17b6
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
movl $0x989680, %edi         # imm = 0x989680
xorl %esi, %esi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x17b6
leaq 0x2b72(%rip), %r15      # 0x409e
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
pushq $0x8
popq %rbp
movl $0x5f5e100, %edi        # imm = 0x5F5E100
movl %ebp, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x18a6
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
movl $0x989680, %edi         # imm = 0x989680
xorl %esi, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x18a6
leaq 0x2c65(%rip), %rdi      # 0x41d1
callq 0x1110
movl $0x5f5e100, %edi        # imm = 0x5F5E100
callq 0x12ca
leaq 0x2c59(%rip), %rdi      # 0x41db
callq 0x1110
movl $0x5f5e100, %edi        # imm = 0x5F5E100
callq 0x1372
leaq 0x2c4f(%rip), %rdi      # 0x41e7
callq 0x1110
movl $0x989680, %edi         # imm = 0x989680
callq 0x13eb
leaq 0x2c46(%rip), %rdi      # 0x41f4
callq 0x1110
leaq 0x2afb(%rip), %rdi      # 0x40b5
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1996
leaq 0x2af7(%rip), %rdi      # 0x40d0
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1a91
leaq 0x2af1(%rip), %rdi      # 0x40e9
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1b75
leaq 0x2ae8(%rip), %rdi      # 0x40ff
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1ca3
leaq 0x2ae0(%rip), %rdi      # 0x4116
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
movl %ebp, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x1dd7
leaq 0x2ad9(%rip), %rdi      # 0x412e
xorl %eax, %eax
callq 0x1030
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1ed2
leaq 0x2b9a(%rip), %rdi      # 0x420e
callq 0x1110
leaq 0x2ac4(%rip), %rdi      # 0x4144
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %r15
movq %r15, %rax
movq %rax, %rax
testq %rax, %rax
movq %r14, %rcx
cmoveq %rbx, %rcx
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
callq 0x1fb6
leaq 0x2aad(%rip), %rdi      # 0x415d
xorl %eax, %eax
callq 0x1030
movq %r15, %rax
movq %rax, %rax
testq %rax, %rax
movq %rbx, %rcx
cmoveq %r14, %rcx
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
callq 0x1fb6
leaq 0x2a9d(%rip), %rdi      # 0x4179
xorl %eax, %eax
callq 0x1030
movq %r15, %r15
testq %r15, %r15
cmoveq %r14, %rbx
movl $0x5f5e100, %edi        # imm = 0x5F5E100
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x20a6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %r14, %rbx
jmp 0x1716
movq %rax, %r15
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x10f0
movq %r15, %rdi
callq 0x1150