// File: /workspace/github_c_makefile_star2_O0/pyk[P]simple-nn/deps/pcg/sample/pcg32-global-demo.c
// Function: main
int main(int argc, char** argv)
{
    // Read command-line options

    int rounds = 5;
    bool nondeterministic_seed = false;

    ++argv;
    --argc;
    if (argc > 0 && strcmp(argv[0], "-r") == 0) {
        nondeterministic_seed = true;
        ++argv;
        --argc;
    }
    if (argc > 0) {
        rounds = atoi(argv[0]);
    }

    // In this version of the code, we'll use the global rng, rather than a
    // local one.

    // You should *always* seed the RNG.  The usual time to do it is the
    // point in time when you create RNG (typically at the beginning of the
    // program).
    //
    // pcg32_srandom_r takes two 64-bit constants (the initial state, and the
    // rng sequence selector; rngs with different sequence selectors will
    // *never* have random sequences that coincide, at all) - the code below
    // shows three possible ways to do so.

    if (nondeterministic_seed) {
        // Seed with external entropy

        uint64_t seeds[2];
        entropy_getbytes((void*)seeds, sizeof(seeds));
        pcg32_srandom(seeds[0], seeds[1]);
    } else {
        // Seed with a fixed constant

        pcg32_srandom(42u, 54u);
    }

    printf("pcg32_random:\n"
           "      -  result:      32-bit unsigned int (uint32_t)\n"
           "      -  period:      2^64   (* 2^63 streams)\n"
           "      -  state type:  N/A (private global)\n"
           "      -  output func: XSH-RR\n"
           "\n");

    for (int round = 1; round <= rounds; ++round) {
        printf("Round %d:\n", round);

        /* Make some 32-bit numbers */
        printf("  32bit:");
        for (int i = 0; i < 6; ++i)
            printf(" 0x%08x", pcg32_random());
        printf("\n");

        printf("  Again:");
        pcg32_advance(-6);
        for (int i = 0; i < 6; ++i)
            printf(" 0x%08x", pcg32_random());
        printf("\n");

        /* Toss some coins */
        printf("  Coins: ");
        for (int i = 0; i < 65; ++i)
            printf("%c", pcg32_boundedrand(2) ? 'H' : 'T');
        printf("\n");

        /* Roll some dice */
        printf("  Rolls:");
        for (int i = 0; i < 33; ++i)
            printf(" %d", (int)pcg32_boundedrand(6) + 1);
        printf("\n");

        /* Deal some cards */
        enum { SUITS = 4, NUMBERS = 13, CARDS = 52 };
        char cards[CARDS];

        for (int i = 0; i < CARDS; ++i)
            cards[i] = i;

        for (int i = CARDS; i > 1; --i) {
            int chosen = pcg32_boundedrand(i);
            char card = cards[chosen];
            cards[chosen] = cards[i - 1];
            cards[i - 1] = card;
        }

        printf("  Cards:");
        static const char number[] = {'A', '2', '3', '4', '5', '6', '7',
                                      '8', '9', 'T', 'J', 'Q', 'K'};
        static const char suit[] = {'h', 'c', 'd', 's'};
        for (int i = 0; i < CARDS; ++i) {
            printf(" %c%c", number[cards[i] / SUITS], suit[cards[i] % SUITS]);
            if ((i + 1) % 22 == 0)
                printf("\n\t");
        }
        printf("\n");

        printf("\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x5, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x1210
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x1e17(%rip), %rsi      # 0x3004
callq 0x1060
cmpl $0x0, %eax
jne 0x1210
movb $0x1, -0x15(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x1225
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1090
movl %eax, -0x14(%rbp)
testb $0x1, -0x15(%rbp)
je 0x1248
leaq -0x30(%rbp), %rdi
movl $0x10, %esi
callq 0x1570
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x22f0
jmp 0x1257
movl $0x2a, %edi
movl $0x36, %esi
callq 0x22f0
leaq 0x1da9(%rip), %rdi      # 0x3007
movb $0x0, %al
callq 0x1030
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x1561
movl -0x34(%rbp), %esi
leaq 0x1e40(%rip), %rdi      # 0x30c2
movb $0x0, %al
callq 0x1030
leaq 0x1e3d(%rip), %rdi      # 0x30cd
movb $0x0, %al
callq 0x1030
movl $0x0, -0x38(%rbp)
cmpl $0x6, -0x38(%rbp)
jge 0x12c6
movb $0x0, %al
callq 0x22b0
movl %eax, %esi
leaq 0x1e22(%rip), %rdi      # 0x30d6
movb $0x0, %al
callq 0x1030
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x129e
leaq 0x1df3(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
leaq 0x1e03(%rip), %rdi      # 0x30de
movb $0x0, %al
callq 0x1030
movq $-0x6, %rdi
callq 0x2320
movl $0x0, -0x3c(%rbp)
cmpl $0x6, -0x3c(%rbp)
jge 0x131d
movb $0x0, %al
callq 0x22b0
movl %eax, %esi
leaq 0x1dcb(%rip), %rdi      # 0x30d6
movb $0x0, %al
callq 0x1030
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x12f5
leaq 0x1d9c(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
leaq 0x1db5(%rip), %rdi      # 0x30e7
movb $0x0, %al
callq 0x1030
movl $0x0, -0x40(%rbp)
cmpl $0x41, -0x40(%rbp)
jge 0x137b
movl $0x2, %edi
callq 0x22d0
movl %eax, %ecx
movl $0x54, %esi
movl $0x48, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
leaq 0x1da1(%rip), %rdi      # 0x310a
movb $0x0, %al
callq 0x1030
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1340
leaq 0x1d3e(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
leaq 0x1d61(%rip), %rdi      # 0x30f1
movb $0x0, %al
callq 0x1030
movl $0x0, -0x44(%rbp)
cmpl $0x21, -0x44(%rbp)
jge 0x13cc
movl $0x6, %edi
callq 0x22d0
movl %eax, %esi
addl $0x1, %esi
leaq 0x1d40(%rip), %rdi      # 0x30fa
movb $0x0, %al
callq 0x1030
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x139e
leaq 0x1ced(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
movl $0x0, -0x84(%rbp)
cmpl $0x34, -0x84(%rbp)
jge 0x1411
movl -0x84(%rbp), %eax
movb %al, %cl
movslq -0x84(%rbp), %rax
movb %cl, -0x80(%rbp,%rax)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x13e4
movl $0x34, -0x88(%rbp)
cmpl $0x1, -0x88(%rbp)
jle 0x1486
movl -0x88(%rbp), %edi
callq 0x22d0
movl %eax, -0x8c(%rbp)
movslq -0x8c(%rbp), %rax
movb -0x80(%rbp,%rax), %al
movb %al, -0x8d(%rbp)
movl -0x88(%rbp), %eax
subl $0x1, %eax
cltq
movb -0x80(%rbp,%rax), %cl
movslq -0x8c(%rbp), %rax
movb %cl, -0x80(%rbp,%rax)
movb -0x8d(%rbp), %cl
movl -0x88(%rbp), %eax
subl $0x1, %eax
cltq
movb %cl, -0x80(%rbp,%rax)
movl -0x88(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x141b
leaq 0x1c71(%rip), %rdi      # 0x30fe
movb $0x0, %al
callq 0x1030
movl $0x0, -0x94(%rbp)
cmpl $0x34, -0x94(%rbp)
jge 0x1537
movslq -0x94(%rbp), %rax
movsbl -0x80(%rbp,%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rcx
leaq 0x1c47(%rip), %rax      # 0x3110
movsbl (%rax,%rcx), %esi
movslq -0x94(%rbp), %rax
movsbl -0x80(%rbp,%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0x1c32(%rip), %rax      # 0x311d
movsbl (%rax,%rcx), %edx
leaq 0x1c11(%rip), %rdi      # 0x3107
movb $0x0, %al
callq 0x1030
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl $0x16, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1521
leaq 0x1bf3(%rip), %rdi      # 0x310d
movb $0x0, %al
callq 0x1030
jmp 0x1523
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x149e
leaq 0x1b82(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
leaq 0x1b74(%rip), %rdi      # 0x30c0
movb $0x0, %al
callq 0x1030
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x126c
xorl %eax, %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)