Function at 0x40b2d8
Capabilities:
Reference sql statements

Disassembly:
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x40
mov rsi, rcx
mov rbx, rdx
mov rdi, r8
mov qword [rsp + 0x38], 0
test rsi, rsi
mov rcx, qword [rdx]
je 0x40b3cd
test rcx, rcx
jne 0x40b35d
lea rcx, [0x004d4d0f]
call sym.sqlite3_open
test eax, eax
jne 0x40b3c6
mov rcx, qword [rbx]
lea rdx, str.CREATE_TABLE_ColNames__cpos_INTEGER_PRIMARY_KEY__name_TEXT__nlen_INT__chop_INT__reps_INT__suff_TEXT__CREATE_VIEW_RepeatedNames_AS_SELECT_DISTINCT_t.name_FROM_ColNames_t_WHERE_t.name_COLLATE_NOCASE_IN___SELECT_o.name_FROM_ColNames_o_WHERE_o.cpos__t.cpos__
xor r9d, r9d
xor r8d, r8d
mov qword [rsp + 0x20], 0
call sym.sqlite3_exec
mov ecx, eax
call sym.rc_err_oom_die
cmp qword [rbx], 0
jne 0x40b35d
lea rdx, str.src_shell.c
mov r8d, 0x5a97
lea rcx, str.pDb_0
call sym._assert
mov rcx, qword [rbx]
lea r9, [rsp + 0x38]
or r8d, 0xffffffff
mov qword [rsp + 0x20], 0
lea rdx, str.INSERT_INTO_ColNames_name_nlen_chop_reps_suff__VALUES_iif_length__1__0__1____max_length__1__1__0_0__
call sym.sqlite3_prepare_v2
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rsp + 0x38]
or r9d, 0xffffffff
mov r8, rsi
mov qword [rsp + 0x20], 0
mov edx, 1
call sym.sqlite3_bind_text
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_step
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_finalize
xor esi, esi
jmp 0x40b583
test rcx, rcx
je 0x40b3c6
lea rdx, str.SELECT_count_DISTINCT__substring_name_1_nlen_chop_suff__COLLATE_NOCASE___count_name__FROM_ColNames
call sym.db_int
lea rbp, [rsp + 0x38]
test eax, eax
mov r12d, eax
je 0x40b47c
mov rcx, qword [rbx]
lea rdx, str.SELECT_CAST_ceil_log_count__0.5___AS_INT__FROM_ColNames
call sym.db_int
mov rcx, qword [rbx]
xor r9d, r9d
xor r8d, r8d
lea rdx, str.UPDATE_ColNames_AS_t_SET_reps_SELECT_count___FROM_ColNames_d__WHERE_substring_t.name_1_t.nlen_t.chop_substring_d.name_1_d.nlen_d.chop__COLLATE_NOCASE_
mov esi, eax
mov qword [rsp + 0x20], 0
call sym.sqlite3_exec
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rbx]
mov r9, rbp
or r8d, 0xffffffff
mov qword [rsp + 0x20], 0
lea rdx, str.WITH_Lzn_nlz__AS____SELECT_0_AS_nlz__UNION__SELECT_nlz1_AS_nlz_FROM_Lzn__WHERE_EXISTS____SELECT_1___FROM_ColNames_t__ColNames_o___WHERE____iif_t.name_IN__SELECT__FROM_RepeatedNames_______printf__s__s_______t.name__substring_printf__.c_0.d_nlz1_0__1_t.cpos__2________t.name_____________iif_o.name_IN__SELECT__FROM_RepeatedNames_______printf__s__s_______o.name__substring_printf__.c_0.d_nlz1_0__1_o.cpos__2________o.name_________COLLATE_NOCASE____AND_o.cpos__t.cpos___GROUP_BY_t.cpos_____UPDATE_Colnames_AS_t_SET_chop__0__suff__iif_name_IN__SELECT__FROM_RepeatedNames____printf___s__substring____printf__.c_0.d__SELECT_max_nlz__FROM_Lzn_1_0_1_t.cpos__2_______
call sym.sqlite3_prepare_v2
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rsp + 0x38]
mov r8d, esi
mov edx, 1
call sym.sqlite3_bind_int
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_step
mov rcx, qword [rsp + 0x38]
mov esi, eax
call sym.sqlite3_finalize
cmp esi, 0x65
je 0x40b47c
call sym.shell_out_of_memory
mov rcx, qword [rbx]
lea rdx, str.SELECT_count_DISTINCT__substring_name_1_nlen_chop_suff__COLLATE_NOCASE___count_name__FROM_ColNames
call sym.db_int
test eax, eax
je 0x40b4a8
lea rdx, str.src_shell.c
mov r8d, 0x5ab5
lea rcx, str.db_int_pDb__zHasDupes_0
call sym._assert
mov rcx, qword [rbx]
or r8d, 0xffffffff
mov r9, rbp
xor esi, esi
mov qword [rsp + 0x20], 0
lea rdx, str.SELECT__x0a__group_concat___cname_TEXT____iif__cpos_1__4_0_____x0a______AS_ColsSpec_FROM___SELECT_cpos__printf___w__printf___.s_s__nlen_chop_name_suff___AS_cname__FROM_ColNames_ORDER_BY_cpos_
call sym.sqlite3_prepare_v2
mov ecx, eax
call sym.rc_err_oom_die
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_step
cmp eax, 0x64
jne 0x40b4fd
mov rcx, qword [rsp + 0x38]
xor edx, edx
call sym.sqlite3_column_text
lea rcx, [0x004d40ca]
mov rdx, rax
call sym.sqlite3_mprintf
mov rsi, rax
test rdi, rdi
je 0x40b56a
test r12d, r12d
jne 0x40b510
mov qword [rdi], 0
jmp 0x40b56a
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_finalize
mov rcx, qword [rbx]
or r8d, 0xffffffff
mov r9, rbp
mov qword [rsp + 0x20], 0
lea rdx, str.SELECT_group_concat__printf___w__to___w__name_printf___.s_s__nlen_chop__name__suff_____x0a_FROM_ColNames_WHERE_suff___OR_chop_0
call sym.sqlite3_prepare_v2
test eax, eax
jne 0x40b507
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_step
cmp eax, 0x64
jne 0x40b507
mov rcx, qword [rsp + 0x38]
xor edx, edx
call sym.sqlite3_column_text
lea rcx, [0x004d40ca]
mov rdx, rax
call sym.sqlite3_mprintf
mov qword [rdi], rax
mov rcx, qword [rsp + 0x38]
call sym.sqlite3_finalize
mov rcx, qword [rbx]
call sym.sqlite3_close
mov qword [rbx], 0
mov rax, rsi
add rsp, 0x40
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
ret