// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeChangeEncoding
SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
#ifndef SQLITE_OMIT_UTF16
  int rc;
#endif
  assert( (pMem->flags&MEM_RowSet)==0 );
  assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
           || desiredEnc==SQLITE_UTF16BE );
  if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
    return SQLITE_OK;
  }
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
#ifdef SQLITE_OMIT_UTF16
  return SQLITE_ERROR;
#else

  /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,
  ** then the encoding of the value may not have changed.
  */
  rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);
  assert(rc==SQLITE_OK    || rc==SQLITE_NOMEM);
  assert(rc==SQLITE_OK    || pMem->enc!=desiredEnc);
  assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
  return rc;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r15d, %r15d
testb $0x2, 0x24(%rdi)
je 0x24e9f
movl %esi, %r14d
movq %rdi, %rbx
movzbl 0x27(%rdi), %eax
cmpl %esi, %eax
je 0x24e9f
cmpb $0x1, %al
sete %al
cmpl $0x1, %r14d
sete %cl
orb %al, %cl
jne 0x249af
movq %rbx, %rdi
callq 0x24eb1
movl $0x7, %r15d
testl %eax, %eax
jne 0x24e9f
movslq 0x20(%rbx), %rax
andq $-0x2, %rax
testl %eax, %eax
jle 0x249a3
movq 0x8(%rbx), %rcx
addq %rcx, %rax
rolw $0x8, (%rcx)
addq $0x2, %rcx
cmpq %rax, %rcx
jb 0x24996
movb %r14b, 0x27(%rbx)
xorl %r15d, %r15d
jmp 0x24e9f
movl 0x20(%rbx), %r12d
cmpl $0x1, %r14d
jne 0x249cb
andl $-0x2, %r12d
movl %r12d, 0x20(%rbx)
leal 0x1(,%r12,2), %esi
jmp 0x249d3
leal 0x2(,%r12,2), %esi
movq (%rbx), %rdi
movq 0x8(%rbx), %r13
callq 0x11721
testq %rax, %rax
je 0x24b28
movslq %r12d, %r11
addq %r13, %r11
movzbl 0x27(%rbx), %ecx
cmpl $0x1, %ecx
je 0x24b33
cmpl $0x2, %ecx
jne 0x24c39
movq %rax, %rcx
testl %r12d, %r12d
jle 0x24d58
movq %rax, %rcx
movb (%r13), %dil
movzbl %dil, %r8d
leaq 0x2(%r13), %rdx
movzbl 0x1(%r13), %r9d
movl %r9d, %esi
shll $0x8, %esi
orl %r8d, %esi
movl %r9d, %r10d
andb $-0x8, %r10b
cmpb $-0x28, %r10b
jne 0x24abe
cmpq %r11, %rdx
jae 0x24abe
movzbl 0x2(%r13), %edx
movzbl 0x3(%r13), %edi
addq $0x4, %r13
andl $0x3, %edi
shll $0x8, %edi
shll $0xa, %r8d
orl %edx, %edi
orl %r8d, %edi
andl $0xf000, %r8d           # imm = 0xF000
shll $0xa, %esi
andl $0xf0000, %esi          # imm = 0xF0000
movl %esi, %r9d
addl $0x10000, %r9d          # imm = 0x10000
addl %r8d, %esi
addl $0x10000, %esi          # imm = 0x10000
shrl $0x12, %r9d
orb $-0x10, %r9b
movb %r9b, (%rcx)
shrl $0xc, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
shrl $0x6, %edi
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rcx)
addq $0x4, %rcx
movq %r13, %rdx
jmp 0x24b17
cmpl $0x7f, %esi
ja 0x24acb
movb %dil, (%rcx)
incq %rcx
jmp 0x24b17
cmpb $0x7, %r9b
ja 0x24aed
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rcx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rcx)
addq $0x2, %rcx
jmp 0x24b17
shrb $0x4, %r9b
orb $-0x20, %r9b
movb %r9b, (%rcx)
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rcx)
addq $0x3, %rcx
movq %rdx, %r13
cmpq %r11, %rdx
jb 0x24a13
jmp 0x24d58
movl $0x7, %r15d
jmp 0x24e9f
movq %rax, %rcx
cmpl $0x2, %r14d
jne 0x24d64
testl %r12d, %r12d
jle 0x24e67
leaq 0x51890(%rip), %rdx     # 0x763e0
movq %rax, %rcx
movzbl (%r13), %edi
incq %r13
cmpl $0xc0, %edi
jb 0x24bd8
addl $0xffffff40, %edi       # imm = 0xFFFFFF40
movzbl (%rdi,%rdx), %esi
cmpq %r11, %r13
je 0x24b9b
movzbl (%r13), %edi
movl %edi, %r8d
andl $-0x40, %r8d
cmpl $0x80, %r8d
jne 0x24b9e
movl %esi, %r8d
shll $0x6, %r8d
incq %r13
andl $0x3f, %edi
movl %edi, %esi
orl %r8d, %esi
jmp 0x24b6d
movq %r11, %r13
movl %esi, %r8d
andl $-0x2, %r8d
movl $0xfffd, %edi           # imm = 0xFFFD
cmpl $0xfffe, %r8d           # imm = 0xFFFE
je 0x24bd8
cmpl $0x80, %esi
jb 0x24bd8
movl %esi, %r8d
andl $0xfffff800, %r8d       # imm = 0xFFFFF800
cmpl $0xd800, %r8d           # imm = 0xD800
je 0x24bd8
cmpl $0xffff, %esi           # imm = 0xFFFF
ja 0x24bed
movl %esi, %edi
movw %di, (%rcx)
addq $0x2, %rcx
cmpq %r11, %r13
jb 0x24b53
jmp 0x24e67
movl %esi, %edi
shrl $0xa, %edi
andl $0x3f, %edi
leal -0x10000(%rsi), %r8d
movl %r8d, %r9d
shrl $0xa, %r9d
andl $0xc0, %r9d
orl %edi, %r9d
movb %r9b, (%rcx)
shrl $0x12, %r8d
andb $0x3, %r8b
orb $-0x28, %r8b
movb %r8b, 0x1(%rcx)
movb %sil, 0x2(%rcx)
shrl $0x8, %esi
andb $0x3, %sil
orb $-0x24, %sil
movb %sil, 0x3(%rcx)
addq $0x4, %rcx
jmp 0x24bdf
movq %rax, %rcx
testl %r12d, %r12d
jle 0x24d58
movq %rax, %rcx
movzbl (%r13), %r9d
movl %r9d, %esi
shll $0x8, %esi
leaq 0x2(%r13), %rdx
movb 0x1(%r13), %dil
movzbl %dil, %r8d
orl %r8d, %esi
movl %r9d, %r10d
andb $-0x8, %r10b
cmpb $-0x28, %r10b
jne 0x24cf3
cmpq %r11, %rdx
jae 0x24cf3
movzbl 0x2(%r13), %edi
movzbl 0x3(%r13), %edx
addq $0x4, %r13
andl $0x3, %edi
shll $0x8, %edi
shll $0xa, %r8d
orl %edx, %edi
orl %r8d, %edi
andl $0xf000, %r8d           # imm = 0xF000
shll $0xa, %esi
andl $0xf0000, %esi          # imm = 0xF0000
movl %esi, %r9d
addl $0x10000, %r9d          # imm = 0x10000
addl %r8d, %esi
addl $0x10000, %esi          # imm = 0x10000
shrl $0x12, %r9d
orb $-0x10, %r9b
movb %r9b, (%rcx)
shrl $0xc, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
shrl $0x6, %edi
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rcx)
addq $0x4, %rcx
movq %r13, %rdx
jmp 0x24d4c
cmpl $0x7f, %esi
ja 0x24d00
movb %dil, (%rcx)
incq %rcx
jmp 0x24d4c
cmpb $0x7, %r9b
ja 0x24d22
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rcx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rcx)
addq $0x2, %rcx
jmp 0x24d4c
shrb $0x4, %r9b
orb $-0x20, %r9b
movb %r9b, (%rcx)
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rcx)
addq $0x3, %rcx
movq %rdx, %r13
cmpq %r11, %rdx
jb 0x24c48
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x20(%rbx)
jmp 0x24e74
testl %r12d, %r12d
jle 0x24e67
leaq 0x5166c(%rip), %rdi     # 0x763e0
movq %rax, %rcx
movzbl (%r13), %edx
incq %r13
cmpl $0xc0, %edx
jb 0x24dfc
addl $0xffffff40, %edx       # imm = 0xFFFFFF40
movzbl (%rdx,%rdi), %esi
cmpq %r11, %r13
je 0x24dbf
movzbl (%r13), %edx
movl %edx, %r8d
andl $-0x40, %r8d
cmpl $0x80, %r8d
jne 0x24dc2
movl %esi, %r8d
shll $0x6, %r8d
incq %r13
andl $0x3f, %edx
movl %edx, %esi
orl %r8d, %esi
jmp 0x24d91
movq %r11, %r13
movl %esi, %r8d
andl $-0x2, %r8d
movl $0xfffd, %edx           # imm = 0xFFFD
cmpl $0xfffe, %r8d           # imm = 0xFFFE
je 0x24dfc
cmpl $0x80, %esi
jb 0x24dfc
movl %esi, %r8d
andl $0xfffff800, %r8d       # imm = 0xFFFFF800
cmpl $0xd800, %r8d           # imm = 0xD800
je 0x24dfc
cmpl $0xffff, %esi           # imm = 0xFFFF
ja 0x24e1b
movl %esi, %edx
leaq 0x1(%rcx), %r8
movb %dh, (%rcx)
movl $0x2, %r9d
movl %edx, %esi
addq %r9, %rcx
movb %sil, (%r8)
cmpq %r11, %r13
jb 0x24d77
jmp 0x24e67
leal -0x10000(%rsi), %edx
movl %edx, %r8d
shrl $0x12, %r8d
andb $0x3, %r8b
orb $-0x28, %r8b
movb %r8b, (%rcx)
movl %esi, %r8d
shrl $0xa, %r8d
andl $0x3f, %r8d
shrl $0xa, %edx
andl $0xc0, %edx
orl %r8d, %edx
movb %dl, 0x1(%rcx)
movl %esi, %edx
shrl $0x8, %edx
andb $0x3, %dl
orb $-0x24, %dl
leaq 0x3(%rcx), %r8
movb %dl, 0x2(%rcx)
movl $0x4, %r9d
jmp 0x24e0a
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x20(%rbx)
movb $0x0, (%rcx)
incq %rcx
movq %rax, %r12
movb $0x0, (%rcx)
movq %rbx, %rdi
callq 0xecfd
movl $0xffffe1ff, %eax       # imm = 0xFFFFE1FF
andl 0x24(%rbx), %eax
movb %r14b, 0x27(%rbx)
orl $0x600, %eax            # imm = 0x600
movw %ax, 0x24(%rbx)
movq %r12, 0x8(%rbx)
movq %r12, 0x30(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq