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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
push ebx
push esi
mov esi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
push edi
push dword [0x100c7608]
mov dword [ebp - 0x2c], ecx
call esi
mov dword [ebp - 0xc], eax
test eax, eax
je 0x10045331
cmp dword [eax + 0x82a8], 0
mov edx, dword [eax + 0x1b418]
mov ebx, dword [eax + 0x1b41c]
je 0x1004534c
mov dword [eax + 0x28], 0
test ebx, ebx
jg 0x100450ec
jl 0x100450e3
cmp edx, 0x1002b
jae 0x100450ec
mov esi, edx
mov dword [ebp - 0x10], ebx
mov edi, ebx
jmp 0x100450f6
xor edi, edi
mov esi, 0x1002b
mov dword [ebp - 0x10], edi
mov ecx, dword [eax + 0x1fc40]
mov eax, dword [eax + 0x1fc44]
sub ecx, esi
push 0
sbb eax, edi
mov dword [ebp - 0x28], esi
mov edi, dword [ebp - 0xc]
add ecx, edx
adc eax, ebx
mov dword [ebp - 0x24], eax
lea eax, [ebp - 0x24]
push eax
push ecx
push dword [edi + 0x18380]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x10045131
call dword [sym.imp.KERNEL32.dll_GetLastError]
push esi
call fcn.1008680d
mov ebx, eax
add esp, 4
mov dword [ebp - 8], ebx
test ebx, ebx
je 0x1004533d
push 0
lea eax, [ebp - 0x30]
push eax
push esi
push ebx
push dword [edi + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x10045328
cmp dword [ebp - 0x30], esi
jne 0x10045328
mov ecx, dword [ebp - 0xc]
xor edi, edi
mov eax, 0x12
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x1c], eax
cmp dword [ecx + 0x1b418], 0x16
jne 0x10045198
cmp dword [ecx + 0x1b41c], edi
jne 0x10045198
mov eax, 0x16
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x1c], eax
mov edx, dword [ebp - 0x10]
mov ecx, esi
sub ecx, eax
mov dword [ebp - 0x20], ecx
sbb edx, edi
mov edi, 3
mov dword [ebp - 0x24], edx
js 0x100452fe
jg 0x100451c0
test ecx, ecx
jb 0x100452fe
lea esp, [esp]
mov ebx, dword [ebp - 0x10]
cmp dword [ebp - 0x14], ebx
mov ebx, dword [ebp - 8]
jg 0x100452fe
jl 0x100451d9
cmp eax, esi
ja 0x100452fe
mov al, byte [ecx + ebx]
mov esi, ecx
mov ch, byte [esi + ebx + 1]
add esi, 1
adc edx, 0
add esi, 1
adc edx, 0
mov dword [ebp - 0x18], edx
mov edx, 0x12
mov cl, byte [esi + ebx]
sub edx, edi
mov edi, dword [ebp - 0x18]
mov edi, edi
add esi, 1
mov bl, cl
adc edi, 0
mov dword [ebp - 0x18], edi
mov edi, dword [ebp - 8]
mov cl, byte [esi + edi]
mov edi, dword [ebp - 0x18]
cmp al, 0x50
jne 0x1004526f
cmp ch, 0x4b
jne 0x1004526f
movsx eax, bl
sub eax, 1
je 0x10045265
sub eax, 2
je 0x10045265
sub eax, 2
jne 0x1004526f
cmp cl, 6
jne 0x1004526f
push dword [ebp - 8]
call fcn.10086818
mov ecx, dword [ebp - 0xc]
add esp, 4
mov eax, dword [ecx + 0x1b418]
sub eax, dword [ebp - 0x28]
mov edx, dword [ecx + 0x1b41c]
sbb edx, dword [ebp - 0x10]
add eax, esi
adc edx, edi
sub eax, 3
sbb edx, 0
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp cl, 2
je 0x100452d5
cmp cl, 4
je 0x100452d5
dec edx
mov al, ch
mov ch, bl
test edx, edx
jg 0x10045200
cmp dword [ebp - 0x24], 0
jl 0x10045325
jg 0x1004528e
cmp dword [ebp - 0x20], 0
jbe 0x10045325
mov eax, dword [ebp - 0x1c]
mov ebx, dword [ebp - 0x14]
add eax, 0x12
mov esi, dword [ebp - 0x28]
mov ecx, esi
mov edx, dword [ebp - 0x10]
adc ebx, 0
sub ecx, eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x14], ebx
sbb edx, ebx
mov dword [ebp - 0x20], ecx
xor edi, edi
mov dword [ebp - 0x24], edx
test edx, edx
jg 0x100451c0
jl 0x100452c6
test ecx, ecx
jae 0x100451c0
xor ecx, ecx
xor edx, edx
mov dword [ebp - 0x20], ecx
mov dword [ebp - 0x24], edx
jmp 0x100451c0
push dword [ebp - 8]
call fcn.10086818
add esp, 4
cmp dword [ebp - 0x2c], 0
jne 0x100452ef
call fcn.10044f30
test eax, eax
jne 0x10045316
mov eax, 0xfffffffe
or edx, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push ebx
call fcn.10086818
add esp, 4
cmp dword [ebp - 0x2c], 0
jne 0x100452ef
call fcn.10044f30
test eax, eax
je 0x100452ef
mov eax, 0xfffffffd
or edx, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp - 8]
push ebx
call fcn.10086818
add esp, 4
or eax, 0xffffffff
or edx, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, 0xfffffffc
or edx, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, 0x12
mov dword [ebp - 0x20], 0
sub edx, ecx
mov dword [ebp - 0x2c], ecx
mov dword [ebp - 0x28], edx
sbb ebx, 0
mov dword [ebp - 0x24], ebx
lea edi, [ecx - 0xf]
js 0x10045331
jg 0x10045371
test edx, edx
jb 0x10045331
xor eax, eax
test eax, eax
jg 0x10045331
jl 0x10045381
cmp ecx, 0x1002b
ja 0x10045331
mov ecx, edx
mov edx, dword [ebp - 0xc]
push 0
add ecx, dword [edx + 0x1fc40]
mov eax, dword [edx + 0x1fc44]
adc eax, ebx
mov dword [ebp - 0x1c], eax
lea eax, [ebp - 0x1c]
push eax
push ecx
push dword [edx + 0x18380]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x100453b5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push dword [0x100c7608]
call esi
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x100453f4
push 0
lea ecx, [ebp - 0x18]
push ecx
push 1
lea ecx, [ebp - 1]
push ecx
push dword [eax + 0x18380]
call ebx
test eax, eax
je 0x100453f4
cmp dword [ebp - 0x18], 0
je 0x100453f4
movzx ebx, byte [ebp - 1]
mov dword [ebp - 0x14], ebx
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x100453fb
mov dword [ebp - 0x14], 0xffffffff
push dword [0x100c7608]
call esi
test eax, eax
je 0x1004542e
push 0
lea ecx, [ebp - 8]
push ecx
push 1
lea ecx, [ebp - 2]
push ecx
push dword [eax + 0x18380]
call ebx
test eax, eax
je 0x1004542e
cmp dword [ebp - 8], 0
je 0x1004542e
movzx ebx, byte [ebp - 2]
mov dword [ebp - 0x10], ebx
jmp 0x10045435
mov dword [ebp - 0x10], 0xffffffff
push dword [0x100c7608]
call esi
test eax, eax
je 0x10045469
push 0
lea ecx, [ebp - 0x34]
push ecx
push 1
lea ecx, [ebp - 3]
push ecx
push dword [eax + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x10045469
cmp dword [ebp - 0x34], 0
je 0x10045469
movzx ebx, byte [ebp - 3]
jmp 0x1004546c
or ebx, 0xffffffff
mov esi, 0x12
sub esi, edi
mov edi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
lea esp, [esp]
push dword [0x100c7608]
call edi
test eax, eax
je 0x100454b4
push 0
lea ecx, [ebp - 0x38]
push ecx
push 1
lea ecx, [ebp - 4]
push ecx
push dword [eax + 0x18380]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x100454b4
cmp dword [ebp - 0x38], 0
je 0x100454b4
movzx eax, byte [ebp - 4]
jmp 0x100454b7
or eax, 0xffffffff
cmp byte [ebp - 0x14], 0x50
mov ecx, dword [ebp - 0x10]
jne 0x100454ce
cmp cl, 0x4b
jne 0x100454ce
cmp bl, 5
jne 0x100454ce
cmp al, 6
je 0x1004554b
dec esi
mov byte [ebp - 0x10], bl
mov byte [ebp - 0x14], cl
mov bl, al
test esi, esi
jg 0x10045480
cmp dword [ebp - 0x24], 0
jl 0x10045331
jg 0x100454f1
cmp dword [ebp - 0x28], 0
jbe 0x10045331
mov ebx, dword [ebp - 0xc]
mov ecx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x20]
add ecx, 0x12
mov esi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edx, dword [ebx + 0x1b418]
adc eax, 0
mov ebx, dword [ebx + 0x1b41c]
sub edx, ecx
mov dword [ebp - 0x2c], ecx
sbb ebx, eax
mov dword [ebp - 0x20], eax
xor edi, edi
mov dword [ebp - 0x28], edx
mov dword [ebp - 0x24], ebx
test ebx, ebx
jg 0x10045373
jl 0x10045536
test edx, edx
jae 0x10045373
mov esi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
xor edx, edx
xor ebx, ebx
mov dword [ebp - 0x28], edx
mov dword [ebp - 0x24], ebx
jmp 0x10045373
push 1
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x2c], 0
push eax
mov eax, dword [ebp - 0xc]
or esi, 0xffffffff
push 0
or edi, esi
push dword [eax + 0x18380]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebx, eax
cmp ebx, esi
jne 0x1004557e
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x1004559a
mov eax, dword [ebp - 0x2c]
xor esi, esi
cdq
add esi, ebx
mov edi, eax
mov eax, dword [ebp - 0xc]
adc edi, 0
sub esi, dword [eax + 0x1fc40]
sbb edi, dword [eax + 0x1fc44]
sub esi, 4
mov eax, esi
sbb edi, 0
mov edx, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret