// File: /workspace/github_c_makefile_star2_O0/pyk[P]simple-nn/deps/pcg/sample/pcg32-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 a local rng, rather than the
    // global one.

    pcg32_random_t rng;

    // 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_r(&rng, seeds[0], seeds[1]);
    } else {
        // Seed with a fixed constant

        pcg32_srandom_r(&rng, 42u, 54u);
    }

    printf("pcg32_random_r:\n"
           "      -  result:      32-bit unsigned int (uint32_t)\n"
           "      -  period:      2^64   (* 2^63 streams)\n"
           "      -  state type:  pcg32_random_t (%zu bytes)\n"
           "      -  output func: XSH-RR\n"
           "\n",
           sizeof(pcg32_random_t));

    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_r(&rng));
        printf("\n");

        printf("  Again:");
        pcg32_advance_r(&rng, -6);
        for (int i = 0; i < 6; ++i)
            printf(" 0x%08x", pcg32_random_r(&rng));
        printf("\n");

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

        /* Roll some dice */
        printf("  Rolls:");
        for (int i = 0; i < 33; ++i)
            printf(" %d", (int)pcg32_boundedrand_r(&rng, 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_r(&rng, 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 $0xb0, %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 0x124c
leaq -0x40(%rbp), %rdi
movl $0x10, %esi
callq 0x15b0
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x1990
jmp 0x125f
leaq -0x28(%rbp), %rdi
movl $0x2a, %esi
movl $0x36, %edx
callq 0x1990
leaq 0x1da1(%rip), %rdi      # 0x3007
movl $0x10, %esi
movb $0x0, %al
callq 0x1030
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x1597
movl -0x44(%rbp), %esi
leaq 0x1e3b(%rip), %rdi      # 0x30ca
movb $0x0, %al
callq 0x1030
leaq 0x1e38(%rip), %rdi      # 0x30d5
movb $0x0, %al
callq 0x1030
movl $0x0, -0x48(%rbp)
cmpl $0x6, -0x48(%rbp)
jge 0x12d5
leaq -0x28(%rbp), %rdi
callq 0x1cf0
movl %eax, %esi
leaq 0x1e1b(%rip), %rdi      # 0x30de
movb $0x0, %al
callq 0x1030
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x12ab
leaq 0x1dec(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
leaq 0x1dfc(%rip), %rdi      # 0x30e6
movb $0x0, %al
callq 0x1030
leaq -0x28(%rbp), %rdi
movq $-0x6, %rsi
callq 0x1880
movl $0x0, -0x4c(%rbp)
cmpl $0x6, -0x4c(%rbp)
jge 0x1332
leaq -0x28(%rbp), %rdi
callq 0x1cf0
movl %eax, %esi
leaq 0x1dbe(%rip), %rdi      # 0x30de
movb $0x0, %al
callq 0x1030
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1308
leaq 0x1d8f(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
leaq 0x1da8(%rip), %rdi      # 0x30ef
movb $0x0, %al
callq 0x1030
movl $0x0, -0x50(%rbp)
cmpl $0x41, -0x50(%rbp)
jge 0x1394
leaq -0x28(%rbp), %rdi
movl $0x2, %esi
callq 0x1d20
movl %eax, %ecx
movl $0x54, %esi
movl $0x48, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
leaq 0x1d90(%rip), %rdi      # 0x3112
movb $0x0, %al
callq 0x1030
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x1355
leaq 0x1d2d(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
leaq 0x1d50(%rip), %rdi      # 0x30f9
movb $0x0, %al
callq 0x1030
movl $0x0, -0x54(%rbp)
cmpl $0x21, -0x54(%rbp)
jge 0x13e9
leaq -0x28(%rbp), %rdi
movl $0x6, %esi
callq 0x1d20
movl %eax, %esi
addl $0x1, %esi
leaq 0x1d2b(%rip), %rdi      # 0x3102
movb $0x0, %al
callq 0x1030
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x13b7
leaq 0x1cd8(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
movl $0x0, -0x94(%rbp)
cmpl $0x34, -0x94(%rbp)
jge 0x1431
movl -0x94(%rbp), %eax
movb %al, %cl
movslq -0x94(%rbp), %rax
movb %cl, -0x90(%rbp,%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x1401
movl $0x34, -0x98(%rbp)
cmpl $0x1, -0x98(%rbp)
jle 0x14b6
movl -0x98(%rbp), %esi
leaq -0x28(%rbp), %rdi
callq 0x1d20
movl %eax, -0x9c(%rbp)
movslq -0x9c(%rbp), %rax
movb -0x90(%rbp,%rax), %al
movb %al, -0x9d(%rbp)
movl -0x98(%rbp), %eax
subl $0x1, %eax
cltq
movb -0x90(%rbp,%rax), %cl
movslq -0x9c(%rbp), %rax
movb %cl, -0x90(%rbp,%rax)
movb -0x9d(%rbp), %cl
movl -0x98(%rbp), %eax
subl $0x1, %eax
cltq
movb %cl, -0x90(%rbp,%rax)
movl -0x98(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x143b
leaq 0x1c49(%rip), %rdi      # 0x3106
movb $0x0, %al
callq 0x1030
movl $0x0, -0xa4(%rbp)
cmpl $0x34, -0xa4(%rbp)
jge 0x156d
movslq -0xa4(%rbp), %rax
movsbl -0x90(%rbp,%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rcx
leaq 0x1c1c(%rip), %rax      # 0x3118
movsbl (%rax,%rcx), %esi
movslq -0xa4(%rbp), %rax
movsbl -0x90(%rbp,%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0x1c04(%rip), %rax      # 0x3125
movsbl (%rax,%rcx), %edx
leaq 0x1be3(%rip), %rdi      # 0x310f
movb $0x0, %al
callq 0x1030
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl $0x16, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1557
leaq 0x1bc5(%rip), %rdi      # 0x3115
movb $0x0, %al
callq 0x1030
jmp 0x1559
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x14ce
leaq 0x1b54(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
leaq 0x1b46(%rip), %rdi      # 0x30c8
movb $0x0, %al
callq 0x1030
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1279
xorl %eax, %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)