Function at 0x6040d830
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x38
mov edx, dword [ebp + 8]
mov eax, dword [edx + 8]
mov eax, dword [eax + 0x10]
shl eax, 2
push eax
call sym.exchndl.dll_bfd_malloc
add esp, 0x10
test eax, eax
mov dword [ebp - 0x10], eax
je 0x6040da22
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 8]
mov eax, edx
mov esi, dword [edx + 0x14]
mov edx, dword [ebp - 0x10]
mov dword [ebp - 0x14], edx
test esi, esi
je 0x6040d889
mov esi, esi
mov edi, dword [esi + 0x10]
test edi, edi
je 0x6040d882
mov ecx, dword [ebp - 0x14]
mov dword [ecx], esi
add ecx, 4
mov dword [ebp - 0x14], ecx
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x6040d870
mov edx, dword [ebp - 0x10]
mov ebx, dword [ebp - 0x14]
sub ebx, edx
mov dword [ebp - 0x14], ebx
mov ecx, dword [ebp - 0x14]
sar ecx, 2
mov dword [ebp - 0x14], ecx
mov ecx, dword [ebp - 0x14]
mov dword [eax + 0x10], ecx
push 0x6040d4c0
push 4
push ecx
push edx
call sub.msvcrt.dll_qsort
mov edx, dword [ebp + 8]
pop edi
pop eax
push sub.msvcrt.dll_free
push sub.msvcrt.dll_calloc
push 0
push 0x6040d510
push 0
mov eax, dword [edx + 8]
mov eax, dword [eax + 0x10]
shl eax, 2
push eax
call sym.exchndl.dll_htab_create_alloc
add esp, 0x18
mov ecx, dword [ebp + 8]
mov dword [ebp - 0x20], eax
push sub.msvcrt.dll_free
push sub.msvcrt.dll_calloc
push 0
push 0x6040d5c0
push 0
mov eax, dword [ecx + 8]
mov eax, dword [eax + 0x10]
shl eax, 2
push eax
call sym.exchndl.dll_htab_create_alloc
add esp, 0x20
test eax, eax
mov dword [ebp - 0x1c], eax
je 0x6040d9e0
mov esi, dword [ebp - 0x20]
test esi, esi
je 0x6040d9e0
mov ecx, dword [ebp + 8]
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x14], eax
mov edx, dword [ecx + 8]
mov ecx, dword [ebp - 0x14]
mov eax, dword [edx + 0x10]
lea eax, [ecx + eax*4]
mov dword [ebp - 0x18], eax
cmp ecx, eax
jae 0x6040d9e0
lea esi, [esi]
mov ecx, dword [ebp - 0x14]
mov edx, dword [edx + 0x1c]
mov esi, dword [ecx]
mov eax, dword [esi + 0xc]
mov dword [esi + 0x14], edx
cmp eax, edx
jbe 0x6040d9e0
lea ecx, [edx*4]
mov dword [ebp - 0x24], ecx
cmp eax, ecx
jbe 0x6040dad6
mov ebx, dword [esi + 4]
xor ecx, ecx
add ebx, eax
xor edi, edi
sub ebx, edx
cmp ecx, dword [ebp - 0x24]
jae 0x6040d99c
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x28], eax
mov esi, esi
dec ebx
xor edx, edx
inc edi
mov dl, byte [ebx]
mov eax, edx
shl eax, 0x11
lea eax, [eax + edx]
add ecx, eax
mov eax, ecx
shr eax, 2
xor ecx, eax
cmp edi, dword [ebp - 0x28]
jb 0x6040d980
mov ebx, dword [ebp - 0x20]
push 1
push ecx
push esi
push ebx
call sym.exchndl.dll_htab_find_slot_with_hash
add esp, 0x10
test eax, eax
je 0x6040d9e0
mov edx, dword [eax]
test edx, edx
je 0x6040dad1
mov dword [esi + 0x14], edx
mov dword [esi + 0x10], 0
mov edx, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x18]
add edx, 4
mov dword [ebp - 0x14], edx
cmp dword [ebp - 0x14], ecx
jae 0x6040d9e0
mov eax, dword [ebp + 8]
mov edx, dword [eax + 8]
jmp 0x6040d940
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x6040d9f6
sub esp, 0xc
mov eax, dword [ebp - 0x10]
push eax
call sub.msvcrt.dll_free
add esp, 0x10
mov eax, dword [ebp - 0x1c]
test eax, eax
je 0x6040da0c
sub esp, 0xc
mov eax, dword [ebp - 0x1c]
push eax
call sym.exchndl.dll_htab_delete
add esp, 0x10
mov eax, dword [ebp - 0x20]
test eax, eax
je 0x6040da22
sub esp, 0xc
mov eax, dword [ebp - 0x20]
push eax
call sym.exchndl.dll_htab_delete
add esp, 0x10
mov eax, dword [ebp + 8]
xor ebx, ebx
mov edx, dword [eax + 8]
mov eax, dword [edx + 0x14]
mov esi, eax
test eax, eax
mov ecx, dword [eax + 0x18]
je 0x6040da75
mov edx, dword [esi + 0x18]
cmp edx, ecx
je 0x6040da45
mov eax, dword [ecx + 4]
mov ecx, edx
mov dword [eax + 0x20], ebx
mov eax, dword [esi + 0x10]
test eax, eax
je 0x6040da68
mov edi, dword [edx + 0x10]
test edi, edi
jne 0x6040da58
mov dword [edx + 0x10], esi
xor ebx, ebx
lea ebx, [eax + ebx - 1]
neg eax
and ebx, eax
mov eax, dword [esi + 0xc]
mov dword [esi + 0x14], ebx
add ebx, eax
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x6040da36
mov eax, dword [ebp + 8]
mov edx, dword [eax + 8]
mov eax, dword [ecx + 4]
mov esi, dword [edx + 0x14]
lea ecx, [edx + 0x14]
test esi, esi
mov dword [eax + 0x20], ebx
mov dword [ebp - 0x14], ecx
je 0x6040da9c
mov eax, dword [esi + 0x10]
test eax, eax
je 0x6040daa4
lea eax, [esi + 0x1c]
mov dword [ebp - 0x14], eax
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x6040da88
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, dword [ebp - 0x14]
mov eax, dword [esi + 0x1c]
mov ecx, dword [esi + 0xc]
mov dword [edx], eax
test ecx, ecx
je 0x6040da95
mov edx, dword [esi + 0x14]
mov eax, dword [edx + 0x18]
mov edi, dword [edx + 0x14]
mov dword [esi + 0x18], eax
mov eax, dword [edx + 0x10]
mov dword [esi + 0x10], eax
mov eax, dword [edx + 0xc]
sub eax, ecx
add eax, edi
mov dword [esi + 0x14], eax
jmp 0x6040da95
mov dword [eax], esi
mov eax, dword [esi + 0xc]
mov ebx, dword [esi + 4]
mov edx, dword [esi + 0x14]
add ebx, eax
xor ecx, ecx
sub ebx, edx
xor edi, edi
mov dword [ebp - 0x2c], edx
cmp ecx, edx
jae 0x6040db0c
nop
lea esi, [esi]
dec ebx
xor edx, edx
inc edi
mov dl, byte [ebx]
mov eax, edx
shl eax, 0x11
lea eax, [eax + edx]
add ecx, eax
mov eax, ecx
shr eax, 2
xor ecx, eax
cmp edi, dword [ebp - 0x2c]
jb 0x6040daf0
push 1
push ecx
mov ecx, dword [ebp - 0x1c]
push esi
push ecx
call sym.exchndl.dll_htab_find_slot_with_hash
add esp, 0x10
test eax, eax
je 0x6040d9e0
mov edx, dword [eax]
test edx, edx
jne 0x6040d9ba
mov dword [eax], esi
jmp 0x6040d9c4