// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3_randomness
SQLITE_API void sqlite3_randomness(int N, void *pBuf){
  unsigned char t;
  unsigned char *zBuf = pBuf;

  /* The "wsdPrng" macro will resolve to the pseudo-random number generator
  ** state vector.  If writable static data is unsupported on the target,
  ** we have to locate the state vector at run-time.  In the more common
  ** case where writable static data is supported, wsdPrng can refer directly
  ** to the "sqlite3Prng" state vector declared above.
  */
#ifdef SQLITE_OMIT_WSD
  struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng);
# define wsdPrng p[0]
#else
# define wsdPrng sqlite3Prng
#endif

#if SQLITE_THREADSAFE
  sqlite3_mutex *mutex;
#endif

#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return;
#endif

#if SQLITE_THREADSAFE
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
#endif

  sqlite3_mutex_enter(mutex);
  if( N<=0 || pBuf==0 ){
    wsdPrng.isInit = 0;
    sqlite3_mutex_leave(mutex);
    return;
  }

  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...
  **
  ** Nothing in this file or anywhere else in SQLite does any kind of
  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random
  ** number generator) not as an encryption device.
  */
  if( !wsdPrng.isInit ){
    int i;
    char k[256];
    wsdPrng.j = 0;
    wsdPrng.i = 0;
    sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k);
    for(i=0; i<256; i++){
      wsdPrng.s[i] = (u8)i;
    }
    for(i=0; i<256; i++){
      wsdPrng.j += wsdPrng.s[i] + k[i];
      t = wsdPrng.s[wsdPrng.j];
      wsdPrng.s[wsdPrng.j] = wsdPrng.s[i];
      wsdPrng.s[i] = t;
    }
    wsdPrng.isInit = 1;
  }

  assert( N>0 );
  do{
    wsdPrng.i++;
    t = wsdPrng.s[wsdPrng.i];
    wsdPrng.j += t;
    wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j];
    wsdPrng.s[wsdPrng.j] = t;
    t += wsdPrng.s[wsdPrng.i];
    *(zBuf++) = wsdPrng.s[t];
  }while( --N );
  sqlite3_mutex_leave(mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x3c01b0
cmpl $0x0, %eax
je 0x3c3b89
jmp 0x3c3d76
cmpl $0x0, -0x4(%rbp)
jle 0x3c3b96
cmpq $0x0, -0x10(%rbp)
jne 0x3c3ba2
movb $0x0, 0x27f683(%rip)    # 0x643220
jmp 0x3c3d76
cmpb $0x0, 0x27f677(%rip)    # 0x643220
jne 0x3c3cab
movb $0x0, 0x27f66c(%rip)    # 0x643222
movb $0x0, 0x27f664(%rip)    # 0x643221
xorl %eax, %eax
movl %eax, %edi
callq 0x3c0120
movq %rax, %rdi
leaq -0x130(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x3c3d80
movl $0x0, -0x24(%rbp)
cmpl $0x100, -0x24(%rbp)     # imm = 0x100
jge 0x3c3c09
movl -0x24(%rbp), %eax
movb %al, %dl
movslq -0x24(%rbp), %rcx
leaq 0x27f626(%rip), %rax    # 0x643220
movb %dl, 0x3(%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3c3be1
movl $0x0, -0x24(%rbp)
cmpl $0x100, -0x24(%rbp)     # imm = 0x100
jge 0x3c3ca4
movslq -0x24(%rbp), %rcx
leaq 0x27f5f8(%rip), %rax    # 0x643220
movzbl 0x3(%rax,%rcx), %ecx
movslq -0x24(%rbp), %rax
movsbl -0x130(%rbp,%rax), %eax
addl %eax, %ecx
movzbl 0x27f5e0(%rip), %eax    # 0x643222
addl %ecx, %eax
movb %al, 0x27f5d8(%rip)     # 0x643222
movzbl 0x27f5d1(%rip), %eax    # 0x643222
movl %eax, %ecx
leaq 0x27f5c6(%rip), %rax    # 0x643220
movb 0x3(%rax,%rcx), %al
movb %al, -0x11(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x27f5b4(%rip), %rax    # 0x643220
movb 0x3(%rax,%rcx), %dl
movzbl 0x27f5ab(%rip), %eax    # 0x643222
movl %eax, %ecx
leaq 0x27f5a0(%rip), %rax    # 0x643220
movb %dl, 0x3(%rax,%rcx)
movb -0x11(%rbp), %dl
movslq -0x24(%rbp), %rcx
leaq 0x27f58e(%rip), %rax    # 0x643220
movb %dl, 0x3(%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3c3c10
movb $0x1, 0x27f575(%rip)    # 0x643220
jmp 0x3c3cad
movb 0x27f56e(%rip), %al     # 0x643221
addb $0x1, %al
movb %al, 0x27f566(%rip)     # 0x643221
movzbl 0x27f55f(%rip), %eax    # 0x643221
movl %eax, %ecx
leaq 0x27f555(%rip), %rax    # 0x643220
movb 0x3(%rax,%rcx), %al
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %ecx
movzbl 0x27f545(%rip), %eax    # 0x643222
addl %ecx, %eax
movb %al, 0x27f53d(%rip)     # 0x643222
movzbl 0x27f536(%rip), %eax    # 0x643222
movl %eax, %ecx
leaq 0x27f52b(%rip), %rax    # 0x643220
movb 0x3(%rax,%rcx), %dl
movzbl 0x27f521(%rip), %eax    # 0x643221
movl %eax, %ecx
leaq 0x27f517(%rip), %rax    # 0x643220
movb %dl, 0x3(%rax,%rcx)
movb -0x11(%rbp), %dl
movzbl 0x27f50b(%rip), %eax    # 0x643222
movl %eax, %ecx
leaq 0x27f500(%rip), %rax    # 0x643220
movb %dl, 0x3(%rax,%rcx)
movzbl 0x27f4f6(%rip), %eax    # 0x643221
movl %eax, %ecx
leaq 0x27f4ec(%rip), %rax    # 0x643220
movzbl 0x3(%rax,%rcx), %ecx
movzbl -0x11(%rbp), %eax
addl %ecx, %eax
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
movl %eax, %ecx
leaq 0x27f4d1(%rip), %rax    # 0x643220
movb 0x3(%rax,%rcx), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl -0x4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, %eax
jne 0x3c3cad
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nop