Function at 0x10047230
Capabilities:
Get thread local storage value
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
push esi
push edi
push dword [0x100c7608]
mov edi, ecx
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ebx, eax
test ebx, ebx
jne 0x10047254
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebx + 0x1fc40]
xor esi, esi
mov ecx, dword [ebx + 0x1fc44]
mov edx, dword [ebx + 0x18380]
mov dword [ebp - 8], 0
push esi
test edi, edi
je 0x100473af
add eax, dword [ebx + 0x8202]
adc ecx, dword [ebx + 0x8206]
mov dword [ebp - 0xc], ecx
lea ecx, [ebp - 0xc]
push ecx
push eax
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [ebp - 0x10], eax
cmp eax, 0xffffffff
jne 0x100472a5
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x100472c8
mov eax, dword [ebp - 0xc]
xor ecx, ecx
mov edi, dword [ebx + 0x1fc44]
cdq
mov edx, dword [ebx + 0x1fc40]
sub ecx, edx
sbb eax, edi
add ecx, dword [ebp - 0x10]
adc eax, 0
and ecx, eax
cmp ecx, 0xffffffff
jne 0x100472cf
mov esi, 1
jmp 0x1004734e
test edi, edi
jne 0x100472d7
test edx, edx
je 0x1004734e
push 0
lea eax, [ebp - 0x10]
mov dword [ebp - 0xc], esi
push eax
push 4
lea eax, [ebp - 0xc]
push eax
push dword [ebx + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x1004731a
cmp dword [ebp - 0x10], 4
jne 0x1004731a
cmp dword [ebp - 0xc], 0x2014b50
jne 0x1004731a
push 0xffffffffffffffff
push 0xfffffffffffffffc
mov edx, 1
mov ecx, ebx
call fcn.100506d0
add esp, 8
jmp 0x1004734e
mov ecx, dword [ebx + 0x8202]
mov esi, 1
sub ecx, dword [ebx + 0x1fc40]
mov eax, dword [ebx + 0x8206]
sbb eax, dword [ebx + 0x1fc44]
xor edx, edx
push eax
push ecx
mov ecx, ebx
call fcn.100506d0
and eax, edx
add esp, 8
cmp eax, 0xffffffff
je 0x1004734e
xor esi, esi
mov ecx, ebx
call fcn.100471a0
test eax, eax
je 0x1004739b
mov ecx, ebx
call fcn.100471a0
xor eax, eax
mov dword [ebx + 0x8224], 0
push 0x38
push eax
mov word [ebx + 0x19384], ax
lea eax, [ebx + 0x1a3c0]
push eax
call fcn.1007cff0
add esp, 0xc
mov dword [ebx + 0x60e8], 0
mov dword [ebx + 0x60ec], 0
jmp 0x100473a0
mov esi, 1
test esi, esi
je 0x100473ed
xor esi, esi
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0xc], ecx
lea ecx, [ebp - 0xc]
push ecx
push eax
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, eax
cmp esi, 0xffffffff
jne 0x100473cf
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x100473a4
mov eax, dword [ebp - 0xc]
xor ecx, ecx
sub ecx, dword [ebx + 0x1fc40]
cdq
sbb eax, dword [ebx + 0x1fc44]
add ecx, esi
adc eax, 0
and ecx, eax
cmp ecx, 0xffffffff
je 0x100473a4
lea edi, [ebx + 0x8228]
push 0
lea eax, [ebp - 4]
push eax
push 0x2e
push edi
push dword [ebx + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x10047607
cmp dword [ebp - 4], 0x2e
jne 0x10047607
mov eax, dword [edi]
cmp eax, 0x2014b50
jne 0x100475d8
cmp dword [ebx + 0x8294], 0
jne 0x1004744b
push 0
push 0
push 1
call dword [sym.imp.KERNEL32.dll_HeapCreate]
mov dword [ebx + 0x8294], eax
test eax, eax
je 0x100475c6
mov eax, dword [ebx + 0x82a0]
cmp dword [ebx + 0x829c], eax
jne 0x100474bc
lea esi, [eax + eax]
test eax, eax
jne 0x10047465
mov esi, 0x80
lea eax, [esi*4]
push eax
call fcn.1008680d
mov edi, eax
add esp, 4
test edi, edi
je 0x100475c6
mov ecx, dword [ebx + 0x82a0]
test ecx, ecx
je 0x100474aa
shl ecx, 2
push ecx
push dword [ebx + 0x8298]
push edi
call fcn.1007d410
add esp, 0xc
push dword [ebx + 0x8298]
call fcn.10086818
add esp, 4
mov dword [ebx + 0x8298], edi
lea edi, [ebx + 0x8228]
mov dword [ebx + 0x82a0], esi
movzx eax, word [edi + 0x1e]
movzx ecx, word [edi + 0x20]
add ecx, eax
movzx eax, word [edi + 0x1c]
add ecx, eax
mov dword [ebp - 0x10], ecx
lea eax, [ecx + 0x2e]
push eax
push 8
push dword [ebx + 0x8294]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, eax
test edx, edx
je 0x100475c6
mov esi, edi
mov ecx, 0xb
mov edi, edx
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov ecx, dword [ebx + 0x829c]
mov eax, dword [ebx + 0x8298]
mov dword [eax + ecx*4], edx
inc dword [ebx + 0x829c]
add edx, 0x2e
je 0x100475c6
mov esi, dword [ebp - 0x10]
lea eax, [ebp - 4]
push 0
push eax
push esi
push edx
push dword [ebx + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x100475cc
cmp dword [ebp - 4], esi
jne 0x100475cc
mov ecx, dword [ebx + 0x60e8]
lea edi, [ebx + 0x8228]
inc dword [ebp - 8]
add ecx, 1
mov eax, dword [ebx + 0x60ec]
mov esi, dword [ebx + 0x71b4]
adc eax, 0
mov dword [ebx + 0x60e8], ecx
mov dword [ebx + 0x60ec], eax
test esi, esi
je 0x100473f3
push 0
push 0x3e8
push eax
push ecx
call fcn.1009d9c0
or eax, edx
lea edi, [ebx + 0x8228]
jne 0x100473f3
cmp dword [ebx + 0x10], 0
mov eax, dword [ebx + 0x71b8]
push eax
push 0
push 0x100ab578
je 0x100475bf
call esi
lea edi, [ebx + 0x8228]
test eax, eax
je 0x100473f3
mov dword [ebx + 4], 1
jmp 0x100473ed
call esi
jmp 0x100473ed
call dword [sym.imp.KERNEL32.dll_GetLastError]
or esi, 0xffffffff
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp eax, 0x4034b50
jne 0x10047607
cmp dword [ebx + 0x81f6], 1
jl 0x10047607
jg 0x100475f3
cmp dword [ebx + 0x81f2], 0
jb 0x10047607
mov dword [ebx + 0x81f2], 0
mov dword [ebx + 0x81f6], 0
mov esi, dword [ebp - 8]
cmp esi, 1
jle 0x100473a6
mov edx, esi
mov ecx, ebx
call fcn.100463f0
pop edi
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret