// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walChecksumBytes
static void walChecksumBytes(
  int nativeCksum, /* True for native byte-order, false for non-native */
  u8 *a,           /* Content to be checksummed */
  int nByte,       /* Bytes of content in a[].  Must be a multiple of 8. */
  const u32 *aIn,  /* Initial checksum value input */
  u32 *aOut        /* OUT: Final checksum value output */
){
  u32 s1, s2;
  u32 *aData = (u32 *)a;
  u32 *aEnd = (u32 *)&a[nByte];

  if( aIn ){
    s1 = aIn[0];
    s2 = aIn[1];
  }else{
    s1 = s2 = 0;
  }

  assert( nByte>=8 );
  assert( (nByte&0x00000007)==0 );

  if( nativeCksum ){
    do {
      s1 += *aData++ + s2;
      s2 += *aData++ + s1;
    }while( aData<aEnd );
  }else{
    do {
      s1 += BYTESWAP32(aData[0]) + s2;
      s2 += BYTESWAP32(aData[1]) + s1;
      aData += 2;
    }while( aData<aEnd );
  }

  aOut[0] = s1;
  aOut[1] = s2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x22bb9
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0x22bc7
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x22c12
jmp 0x22bcf
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %eax
addl -0x30(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %eax
addl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x22bcf
jmp 0x22cc8
jmp 0x22c14
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
shll $0x18, %eax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
shll $0x8, %ecx
addl %ecx, %eax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
shrl $0x8, %ecx
addl %ecx, %eax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
andl $0xff000000, %ecx       # imm = 0xFF000000
shrl $0x18, %ecx
addl %ecx, %eax
addl -0x30(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xff, %eax
shll $0x18, %eax
movq -0x38(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
shll $0x8, %ecx
addl %ecx, %eax
movq -0x38(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
shrl $0x8, %ecx
addl %ecx, %eax
movq -0x38(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0xff000000, %ecx       # imm = 0xFF000000
shrl $0x18, %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x22c14
jmp 0x22cc8
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
popq %rbp
retq
nopl (%rax)