Function at 0x409740
Capabilities:
Allocate thread local storage
Encode data using xor
Get file size
Hash data using fnv

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0x88
mov eax, dword [0x4d044c]
xor eax, esp
mov dword [esp + 0x84], eax
mov eax, dword [ebp + 0xc]
push esi
push edi
xor edi, edi
mov dword [esp + 0x10], edx
mov esi, ecx
mov dword [esp + 0x14], eax
mov dword [esp + 0x1c], esi
cmp dword [edx + 4], edi
je 0x4097a5
mov eax, dword [esi + 0xc]
shr eax, 0xe
and eax, 1
mov edx, dword [eax*4 + 0x4beaa0]
mov eax, dword [esp + 0x10]
mov ecx, dword [eax]
mov eax, dword [eax + 8]
lea ecx, [eax + ecx*2]
movzx eax, word [edx]
lea edx, [edx + 2]
mov word [ecx], ax
lea ecx, [ecx + 2]
test ax, ax
jne 0x409790
mov edx, dword [esp + 0x10]
push 0
push 0x80
push 4
push 0
push 3
push 0xc0000000
push dword [edx + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
jne 0x4097d5
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov eax, dword [esp + 0x10]
mov dword [esi + 4], eax
test edi, edi
je 0x409808
cmp edi, 0x13
jne 0x409919
test dword [esi + 0xc], 0x20000
je 0x409919
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
test dword [esi + 0xc], 0x200000
jne 0x409870
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [esi + 0x64], eax
cmp eax, 0xffffffff
jne 0x40982f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
test edi, edi
jne 0x409919
or dword [esi + 0xc], 0x10000000
mov ecx, dword [0x4d4b24]
cmp ecx, 0x40
jl 0x40985c
mov edi, 0xffff87bb
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
mov eax, dword [esi + 0x64]
mov dword [ecx*4 + 0x4d4b40], eax
inc ecx
mov eax, dword [esi + 4]
mov dword [0x4d4b24], ecx
push 0
push 1
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_LockFile]
test eax, eax
je 0x40988f
mov eax, dword [esp + 0x14]
mov dword [eax], 1
jmp 0x4098d1
lea eax, [esp + 0x20]
mov dword [esp + 0x30], 0
push eax
push 0
push 1
push 0
push 0
push dword [esi + 4]
xorps xmm0, xmm0
movaps xmmword [esp + 0x38], xmm0
call dword [sym.imp.KERNEL32.dll_LockFileEx]
test eax, eax
je 0x4098c5
mov eax, dword [esp + 0x14]
mov dword [eax], 0
jmp 0x4098d1
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
test edi, edi
jne 0x409919
push 0
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, dword [esi + 0x18]
mov ecx, eax
inc edi
shl edi, 6
cmp ecx, edi
jge 0x40992f
mov eax, dword [esp + 0x14]
cmp dword [eax], 0
jle 0x40992f
push 0
push 0
push edi
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, edi
jne 0x409911
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
jne 0x40993b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
lea eax, [ecx - 0x80]
mov edi, ecx
shr eax, 6
inc eax
mov dword [esi + 0x18], eax
push 0
push 0
push 0
push 4
push 0
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingA]
mov dword [esp + 0x10], eax
test eax, eax
je 0x409911
push 0
push edi
push 0
push 0
push 2
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFileEx]
push dword [esp + 0x10]
mov dword [esi + 0x34], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esi + 0x34]
test eax, eax
je 0x409911
mov ecx, dword [esp + 0x14]
cmp dword [ecx], 0
jle 0x409b10
cmp dword [0x4d4c4c], 0
jne 0x4099d6
push 1
push 0x4d4b2c
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
push 0
push 0
push 1
push 0x4d4b2c
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
mov dword [0x4d4c40], 0xc
mov dword [0x4d4c48], 0
mov dword [0x4d4c44], 0x4d4b2c
mov dword [0x4d4c4c], 1
lea eax, [esp + 0x58]
push eax
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
je 0x409911
mov eax, dword [esp + 0x74]
lea edi, [esp + 0x4c]
mov dword [esp + 0x4c], eax
mov ecx, 0x84222325
mov eax, dword [esp + 0x84]
mov edx, 0xcbf29ce4
mov dword [esp + 0x50], eax
mov eax, dword [esp + 0x88]
mov dword [esp + 0x54], eax
mov eax, edi
mov dword [esp + 0x18], eax
lea eax, [esp + 0x58]
cmp eax, edi
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], edx
sbb eax, eax
and eax, 0xfffffff4
add eax, 0xc
mov dword [esp + 0x18], eax
je 0x409a73
xor esi, esi
nop dword [eax]
movzx eax, byte [edi]
push 0x100
cdq
xor edx, dword [esp + 0x14]
xor eax, ecx
push 0x1b3
push edx
push eax
call fcn.004b0d20
inc esi
mov dword [esp + 0x10], edx
lea edi, [edi + 1]
mov ecx, eax
cmp esi, dword [esp + 0x18]
jb 0x409a40
mov esi, dword [esp + 0x1c]
mov dword [esp + 0x14], eax
mov ecx, dword [esi + 0x34]
mov eax, dword [esp + 0x14]
mov dword [ecx + 0x10], eax
mov dword [ecx + 0x14], edx
mov ecx, esi
call fcn.004096d0
lea edi, [esi + 0x98]
mov byte [esi + 0xa2], 0x72
push edi
push 0
push 0x4d4c40
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov dword [esi + 0x90], eax
test eax, eax
je 0x409911
push edi
push 0
push 0x4d4c40
mov byte [esi + 0xa2], 0x77
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov dword [esi + 0x94], eax
test eax, eax
je 0x409911
mov eax, dword [esi + 0x34]
mov dword [eax], 0xbeefc0de
mov eax, dword [esi + 0x34]
mov dword [eax + 4], 0x126002
mov eax, dword [esi + 0x34]
mov dword [eax + 8], 0
mov eax, dword [esi + 0x34]
mov dword [eax + 0xc], 0
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
cmp dword [eax], 0xbeefc0de
je 0x409b33
mov edi, 0xffff87b7
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
cmp dword [eax + 4], 0x126002
je 0x409b57
mov edi, 0xffff87b6
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x84]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
test edi, edi
je 0x409b71
cmp edi, 0xd
je 0x409b71
cmp edi, 0xb
jne 0x409919
mov ecx, esi
call fcn.004096d0
lea edi, [esi + 0x98]
mov byte [esi + 0xa2], 0x72
push edi
push 0
push 0x100000
call dword [sym.imp.KERNEL32.dll_OpenMutexA]
mov dword [esi + 0x90], eax
test eax, eax
je 0x409911
push edi
push 0
push 0x100000
mov byte [esi + 0xa2], 0x77
call dword [sym.imp.KERNEL32.dll_OpenMutexA]
mov dword [esi + 0x94], eax
test eax, eax
je 0x409911
mov ecx, dword [esp + 0x8c]
xor eax, eax
pop edi
pop esi
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret