Function at 0x4047e5
Capabilities:
Encode data using base64

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x28
mov rsi, rcx
mov rcx, qword [r8]
mov edi, edx
mov rbp, r8
call sym.sqlite3_value_bytes
mov rcx, rsi
mov ebx, eax
call sym.sqlite3_context_db_handle
or r8d, 0xffffffff
xor edx, edx
mov rcx, rax
call sym.sqlite3_limit
dec edi
mov r12d, eax
je 0x40483d
lea rdx, str.src_shell.c
mov r8d, 0xd95
lea rcx, str.na1
call sym._assert
mov rcx, qword [rbp]
call sym.sqlite3_value_type
cmp eax, 3
je 0x4049f2
cmp eax, 4
jne 0x404bab
lea ecx, [rbx*4]
mov r8d, 0x48
lea eax, [rcx + 0x47]
cdq
idiv r8d
or r8d, 0xffffffff
lea rdx, str.blob_expanded_to_base64_too_big
lea r13d, [rcx + rax + 1]
cmp r12d, r13d
jl 0x404bc3
mov rcx, qword [rbp]
call sym.sqlite3_value_blob
test rax, rax
mov rdi, rax
jne 0x4048c2
mov rcx, rsi
call sym.sqlite3_context_db_handle
mov rcx, rax
call sym.sqlite3_errcode
cmp eax, 7
je 0x404bb8
lea rdx, [0x004d4196]
xor r9d, r9d
or r8d, 0xffffffff
jmp 0x4049da
mov ecx, r13d
call sym.sqlite3_malloc
test rax, rax
je 0x404bb8
lea r10, str.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
mov r8, rax
xor r9d, r9d
cmp ebx, 2
jle 0x404969
mov dl, byte [rdi]
add r9d, 4
add rdi, 3
shr dl, 2
and edx, 0x3f
mov dl, byte [r10 + rdx]
mov byte [r8], dl
movzx edx, byte [rdi - 3]
shl edx, 4
mov ecx, edx
mov dl, byte [rdi - 2]
shr dl, 4
or edx, ecx
and edx, 0x3f
mov dl, byte [r10 + rdx]
mov byte [r8 + 1], dl
movzx ecx, byte [rdi - 2]
mov dl, byte [rdi - 1]
shl ecx, 2
shr dl, 6
and ecx, 0x3c
or ecx, edx
and ecx, 0x3f
mov dl, byte [r10 + rcx]
mov byte [r8 + 2], dl
mov dl, byte [rdi - 1]
and edx, 0x3f
sub ebx, 3
mov dl, byte [r10 + rdx]
mov byte [r8 + 3], dl
je 0x404958
cmp r9d, 0x47
jg 0x404958
add r8, 4
jmp 0x4048e0
mov byte [r8 + 4], 0xa
xor r9d, r9d
add r8, 5
jmp 0x4048e0
test ebx, ebx
jle 0x4049c9
movzx ecx, byte [rdi]
lea r10d, [rbx + 1]
shl ecx, 8
cmp ebx, 2
jne 0x404984
mov cx, word [rdi]
xchg cl, ch
movzx ecx, cx
shl ecx, 8
mov edx, 2
mov r9b, 0x3d
lea r11, str.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
movzx r10d, r10b
cmp rdx, 0xffffffffffffffff
mov byte [r8 + rdx + 1], r9b
je 0x4049c0
shr ecx, 6
cmp r10d, edx
mov r9b, 0x3d
jle 0x4049bb
mov r9d, ecx
and r9d, 0x3f
mov r9b, byte [r11 + r9]
dec rdx
jmp 0x40499a
mov byte [r8 + 4], 0xa
add r8, 5
mov byte [r8], 0
lea r9, [sym.sqlite3_free]
sub r8d, eax
mov rdx, rax
mov rcx, rsi
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.sqlite3_result_text
lea eax, [rbx + 3]
mov ecx, 4
or r8d, 0xffffffff
cdq
idiv ecx
lea rdx, str.blob_from_base64_may_be_too_big
lea edi, [rax + rax*2]
cmp r12d, edi
jl 0x404bc3
mov rcx, qword [rbp]
call sym.sqlite3_value_text
test rax, rax
mov rbp, rax
jne 0x404a58
mov rcx, rsi
call sym.sqlite3_context_db_handle
mov rcx, rax
call sym.sqlite3_errcode
cmp eax, 7
je 0x404bb8
xor edx, edx
mov rcx, rsi
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.sqlite3_result_zeroblob
test edi, edi
mov ecx, 1
cmovg ecx, edi
call sym.sqlite3_malloc
test rax, rax
mov r15, rax
je 0x404bb8
test ebx, ebx
mov r8, rax
jle 0x404b86
movsxd rax, ebx
cmp byte [rbp + rax - 1], 0xa
jne 0x404a8a
dec ebx
lea r11, [0x004e0460]
mov r8, r15
mov edi, 4
lea r12, [0x004dc896]
test ebx, ebx
jle 0x404b86
cmp byte [rbp], 0x3d
je 0x404b86
movsxd r9, ebx
mov rcx, rbp
add r9, rbp
cmp rcx, r9
je 0x404ad6
movsx rax, byte [rcx]
test al, al
je 0x404ad6
jns 0x404acf
inc rcx
jmp 0x404abb
cmp byte [r11 + rax], 0
js 0x404aca
mov rax, rcx
mov r13d, edi
sub rax, rbp
sub ebx, eax
cmp ebx, 4
cmovle r13d, ebx
movsxd rax, r13d
sub ebx, r13d
movsx r9d, byte [r12 + rax]
test r9d, r9d
je 0x404b86
xor eax, eax
xor ebp, ebp
cmp r13d, ebp
jle 0x404b17
movsx r10, byte [rcx]
lea r14, [rcx + 1]
mov rcx, r14
test r10b, r10b
jns 0x404b1d
jmp 0x404b40
mov r10d, 0x41
movzx r10d, byte [r11 + r10]
cmp r10b, 0x81
je 0x404b36
cmp r10b, 0x82
je 0x404b3b
cmp r10b, 0x80
jne 0x404b46
jmp 0x404b40
mov r13d, ebp
jmp 0x404b40
mov r13d, ebp
xor ebx, ebx
dec r9d
xor r10d, r10d
shl eax, 6
inc ebp
or eax, r10d
cmp ebp, 4
jne 0x404b00
cmp r9d, 2
je 0x404b6b
cmp r9d, 3
je 0x404b67
cmp r9d, 1
jne 0x404b78
jmp 0x404b72
mov byte [r8 + 2], al
movzx edx, ah
mov byte [r8 + 1], dl
shr eax, 0x10
mov byte [r8], al
movsxd r9, r9d
mov rbp, rcx
add r8, r9
jmp 0x404aa0
lea r9, [sym.sqlite3_free]
sub r8d, r15d
mov rdx, r15
mov rcx, rsi
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.sqlite3_result_blob
lea rdx, str.base64_accepts_only_blob_or_text
or r8d, 0xffffffff
jmp 0x404bc3
lea rdx, str.base64_OOM
or r8d, 0xffffffff
mov rcx, rsi
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.sqlite3_result_error