Function at 0x502220
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff8
sub esp, 0x80
mov ebx, ecx
mov edi, dword [ebp + 8]
mov eax, dword [edi]
mov edx, dword [eax + 0x28]
mov esi, dword [eax + 0x2c]
mov ecx, edx
or edx, esi
mov edx, esi
bswap edx
bswap ecx
mov dword [esp + 0x44], ecx
mov dword [esp + 0x40], edx
je 0x50233e
movzx esi, word [eax + 0x3a]
cmp esi, 0x4000
jne 0x50235f
mov dword [esp + 0xc], ebx
mov ebx, edx
add ebx, 0x40
mov esi, ecx
adc esi, 0
mov edi, 0xffffffbf
cmp edi, edx
mov edi, 0xffffffff
sbb edi, ecx
jb 0x5023ba
mov edi, dword [ebp + 8]
mov edi, dword [edi + 4]
mov dword [esp + 0x48], edi
cmp edi, ebx
mov ebx, 0
sbb ebx, esi
jb 0x5023ba
movzx esi, word [eax + 0x3c]
add eax, edx
mov ebx, esi
rol bx, 8
movzx ebx, bx
mov dword [esp + 0x38], ebx
mov dword [esp + 0x3c], 0
test si, si
mov edi, 0
jne 0x502411
mov edi, dword [eax + 0x20]
mov ebx, dword [eax + 0x24]
bswap ebx
bswap edi
mov dword [esp + 0x3c], edi
mov dword [esp + 0x38], ebx
test edi, 0xfc000000
je 0x502411
mov dword [esp + 0x24], str.invalid_number_of_sections_specified_in_the_NULL_sections_sh_size_field__
lea eax, [esp + 0x38]
mov dword [esp + 0x2c], eax
mov word [esp + 0x34], 0xc03
lea eax, [esp + 0x24]
mov dword [esp + 0x10], eax
mov dword [esp + 0x18], 0x5580d8
mov word [esp + 0x20], 0x302
mov dword [esp], 0x1c
call sub.libc.dll_operator_new_unsigned_int_
mov edi, eax
call fcn.00550996
mov dword [esp + 0x58], eax
mov dword [esp + 0x54], 3
movsd xmm0, qword [esp + 0x54]
jmp 0x5024a5
mov ecx, dword [edi + 8]
mov eax, dword [edi + 0xc]
cmp ecx, eax
je 0x5023fb
and byte [ebx + 8], 0xfe
sub eax, ecx
sar eax, 6
mov dword [ebx], ecx
mov dword [ebx + 4], eax
jmp 0x5024c6
rol si, 8
movzx eax, si
mov dword [esp + 0x10], str.invalid_e_shentsize_in_ELF_header:
mov dword [esp + 0x18], eax
mov word [esp + 0x20], 0x903
mov dword [esp], 0x1c
call sub.libc.dll_operator_new_unsigned_int_
mov edi, eax
call fcn.00550996
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], 3
movsd xmm0, qword [esp + 0x24]
movsd qword [esp + 4], xmm0
lea eax, [esp + 0x10]
mov dword [esp], eax
mov ecx, edi
call fcn.005507bc
sub esp, 0xc
jmp 0x5024c0
mov dword [esp + 0x10], str.section_header_table_goes_past_the_end_of_the_file:_e_shoff__0x
lea eax, [esp + 0x40]
mov dword [esp + 0x18], eax
mov word [esp + 0x20], 0xe03
mov dword [esp], 0x1c
call sub.libc.dll_operator_new_unsigned_int_
mov edi, eax
call fcn.00550996
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], 3
movsd xmm0, qword [esp + 0x24]
jmp 0x5024a5
and byte [ebx + 8], 0xfe
mov dword [ebx], 0
mov dword [ebx + 4], 0
jmp 0x5024c6
shld edi, ebx, 6
mov esi, ebx
shl esi, 6
add esi, edx
adc edi, ecx
jae 0x5024d2
mov dword [esp + 0x68], str.invalid_section_header_table_offset__e_shoff__0x
lea eax, [esp + 0x40]
mov dword [esp + 0x70], eax
mov word [esp + 0x78], 0xe03
lea eax, [esp + 0x68]
mov dword [esp + 0x54], eax
mov dword [esp + 0x5c], str.__or_invalid_number_of_sections_specified_in_the_first_section_headers_sh_size_field__0x
mov word [esp + 0x64], 0x302
lea eax, [esp + 0x54]
mov dword [esp + 0x24], eax
lea eax, [esp + 0x38]
mov dword [esp + 0x2c], eax
mov word [esp + 0x34], 0xe02
lea eax, [esp + 0x24]
mov dword [esp + 0x10], eax
mov dword [esp + 0x18], 0x5580d8
mov word [esp + 0x20], 0x302
mov dword [esp], 0x1c
call sub.libc.dll_operator_new_unsigned_int_
mov edi, eax
call fcn.00550996
mov dword [esp + 0x50], eax
mov dword [esp + 0x4c], 3
movsd xmm0, qword [esp + 0x4c]
movsd qword [esp + 4], xmm0
lea eax, [esp + 0x10]
mov dword [esp], eax
mov ecx, edi
call fcn.005507bc
sub esp, 0xc
mov ebx, dword [esp + 0xc]
or byte [ebx + 8], 1
mov dword [ebx], edi
mov eax, ebx
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret 4
xor ecx, ecx
cmp dword [esp + 0x48], esi
sbb ecx, edi
jae 0x5024f0
mov dword [esp + 0x10], str.section_table_goes_past_the_end_of_file
mov word [esp + 0x20], 0x103
jmp 0x5023d1
mov ecx, dword [esp + 0xc]
and byte [ecx + 8], 0xfe
mov dword [ecx], eax
mov dword [ecx + 4], ebx
mov ebx, ecx
jmp 0x5024c6