Function at 0x476be0
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
push ebx
push esi
mov esi, ecx
mov dword [ebp - 4], 0
mov dword [ebp - 0x2c], esi
mov eax, edx
mov dword [ebp - 0x14], eax
mov dword [ebp - 0xc], 0
push edi
test esi, esi
jne 0x476c5e
call fcn.00476ab0
mov edi, dword [0x56161c]
push edi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov esi, eax
test esi, esi
jne 0x476c41
push 0xc08
call fcn.004bb5d5
push 0xc08
mov esi, eax
push 0
push esi
call fcn.004c13c0
add esp, 0x10
push esi
push edi
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
push str.tsk_img_read:_a_img_info:_NULL
mov dword [esi], 0x2000009
call fcn.004768f0
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
test eax, eax
jne 0x476cbb
call fcn.00476ab0
mov edi, dword [0x56161c]
push edi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov esi, eax
test esi, esi
jne 0x476c9e
push 0xc08
call fcn.004bb5d5
push 0xc08
mov esi, eax
push 0
push esi
call fcn.004c13c0
add esp, 0x10
push esi
push edi
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
push str.tsk_img_read:_a_buf:_NULL
mov dword [esi], 0x2000009
call fcn.004768f0
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 0xc]
mov ebx, dword [ebp + 8]
test edi, edi
jg 0x476cf3
jl 0x476ccb
test ebx, ebx
jae 0x476cf3
call fcn.00476ab0
mov ecx, 0x2000009
call fcn.00476850
push edi
push ebx
push str.tsk_img_read:_a_off:__llu
call fcn.004768f0
add esp, 0xc
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea eax, [esi + 0x24]
push eax
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov edi, dword [ebp + 0x10]
push 0
push 0x200
push dword [ebp + 0xc]
mov dword [ebp - 0x28], 0
push ebx
call fcn.004c21a0
add eax, edi
mov ecx, 0
adc edx, ecx
mov dword [ebp - 0x34], edx
js 0x476e18
jg 0x476d39
cmp eax, 0x10000
jbe 0x476e18
mov ecx, dword [esi + 0x14]
xor edx, edx
mov eax, edi
div ecx
test edx, edx
je 0x476df0
lea eax, [edi - 1]
xor edx, edx
add eax, ecx
div ecx
imul eax, ecx
mov ecx, eax
mov dword [ebp - 0x28], eax
call fcn.00479b80
mov dword [ebp - 0x24], eax
test eax, eax
jne 0x476d7a
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x28]
push eax
push dword [ebp + 0xc]
mov eax, dword [esi + 0x40080]
push ebx
push esi
call eax
mov esi, eax
add esp, 0x14
test esi, esi
jle 0x476dc3
cmp esi, edi
jge 0x476dc3
mov ebx, dword [ebp - 0x24]
push esi
push ebx
push dword [ebp - 0x14]
call fcn.004c0d70
add esp, 0xc
push ebx
call fcn.004bae83
add esp, 4
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp - 0x24]
push edi
push ebx
push dword [ebp - 0x14]
call fcn.004c0d70
add esp, 0xc
mov esi, edi
push ebx
call fcn.004bae83
add esp, 4
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [esi + 0x40080]
push edi
push dword [ebp - 0x14]
push dword [ebp + 0xc]
push ebx
push esi
call eax
add esp, 0x14
mov esi, eax
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0xc]
mov ecx, dword [esi + 8]
cmp eax, dword [esi + 0xc]
jl 0x476e61
jg 0x476e2e
mov edx, dword [ebp + 8]
cmp edx, ecx
jb 0x476e64
mov ebx, edx
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
call fcn.00476ab0
mov ecx, 0x2000008
call fcn.00476850
push dword [ebp + 0xc]
push ebx
push str.tsk_img_read____llu
call fcn.004768f0
add esp, 0xc
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, dword [ebp + 8]
mov ebx, dword [esi + 0xc]
cmp dword [ebp - 0x28], ebx
jg 0x476e81
jl 0x476e72
cmp edi, ecx
ja 0x476e81
sub ecx, edi
sbb ebx, 0
cmp eax, ebx
jl 0x476e86
jg 0x476e81
cmp edx, ecx
jb 0x476e86
mov edi, dword [esi + 8]
sub edi, edx
mov eax, 0xfffbffa0
mov dword [ebp - 8], 0
lea ecx, [esi + 0x40040]
mov dword [ebp - 0x24], 0
sub eax, esi
mov dword [ebp - 0x20], 0
lea ebx, [esi + 0x40060]
mov dword [ebp - 0x10], ecx
mov dword [ebp - 0x28], eax
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x477072
cmp dword [ebp - 4], 0
jne 0x47703c
mov esi, dword [ecx]
mov dword [ebp - 0x1c], esi
mov esi, dword [ecx + 4]
cmp esi, dword [ebp + 0xc]
mov dword [ebp - 0x30], esi
mov esi, dword [ebp - 0x2c]
jg 0x47703c
jl 0x476eea
cmp dword [ecx], edx
ja 0x47703c
xor ecx, ecx
add eax, dword [ebp - 0x1c]
mov dword [ebp - 0x34], eax
adc ecx, dword [ebp - 0x30]
xor eax, eax
mov dword [ebp - 0x1c], edi
add dword [ebp - 0x1c], edx
adc eax, dword [ebp + 0xc]
cmp ecx, eax
jl 0x477039
jg 0x476f16
mov eax, dword [ebp - 0x1c]
cmp dword [ebp - 0x34], eax
jb 0x477039
mov ecx, dword [ebp - 0x10]
mov eax, dword [ebp - 0x24]
push edi
sub eax, dword [ecx]
add eax, 0x3c
add eax, edx
add eax, esi
push eax
push dword [ebp - 0x14]
call fcn.004c0d70
mov ecx, dword [ebp - 0x10]
add esp, 0xc
mov dword [ebp - 4], edi
mov dword [ebx], 0x3e8
mov eax, dword [ebp - 8]
mov edx, dword [ebp + 8]
inc eax
mov dword [ebp - 8], eax
add ecx, 8
mov eax, dword [ebp - 0x24]
add ebx, 4
add eax, 0x10000
mov dword [ebp - 0x10], ecx
mov dword [ebp - 0x24], eax
cmp eax, 0x40000
jl 0x476eb4
cmp dword [ebp - 4], 0
jne 0x4770f4
mov eax, dword [ebp - 0xc]
mov ebx, dword [ebp + 8]
add eax, 0x8008
push 0
push 0x200
push dword [ebp + 0xc]
lea edx, [esi + eax*8]
push ebx
mov dword [ebp - 0x24], edx
call fcn.004c1450
mov ecx, dword [ebp - 0x24]
shld edx, eax, 9
shl eax, 9
mov dword [ecx + 4], edx
mov edx, 0x10000
mov dword [ecx], eax
add eax, edx
mov dword [ebp - 0x34], eax
mov eax, dword [ecx + 4]
adc eax, 0
cmp eax, dword [esi + 0xc]
jl 0x476fc5
jg 0x476fc0
mov eax, dword [ebp - 0x34]
cmp eax, dword [esi + 8]
jbe 0x476fc5
mov edx, dword [esi + 8]
sub edx, dword [ecx]
mov eax, dword [ebp - 0xc]
shl eax, 0x10
mov dword [ebp - 0x2c], eax
add eax, 0x3c
push edx
add eax, esi
push eax
push dword [ecx + 4]
mov eax, dword [esi + 0x40080]
push dword [ecx]
push esi
call eax
mov edx, dword [ebp - 0x24]
add esp, 0x14
mov dword [ebp - 4], eax
test eax, eax
jle 0x4770ce
mov ecx, dword [ebp - 0xc]
mov dword [esi + ecx*4 + 0x40070], eax
mov dword [esi + ecx*4 + 0x40060], 0x3e8
sub ebx, dword [edx]
mov ecx, dword [ebp + 0xc]
sbb ecx, dword [edx + 4]
cdq
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x34], edx
cmp ecx, edx
jl 0x477085
jg 0x477022
cmp ebx, eax
jbe 0x477085
push dword [ebp - 0x18]
xor edi, edi
mov dword [ebp - 4], edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x10]
mov eax, dword [ebx]
mov edx, dword [ebp - 0x20]
dec eax
mov dword [ebx], eax
cmp dword [edx + esi + 0x40070], 0
jbe 0x476f3e
cmp eax, dword [edx + esi + 0x40060]
mov eax, dword [ebp - 8]
jge 0x476f41
mov edx, dword [ebp - 0x28]
add edx, ebx
mov dword [ebp - 0xc], eax
mov dword [ebp - 0x20], edx
jmp 0x476f41
mov edx, dword [ebp - 0x28]
mov eax, dword [ebp - 8]
add edx, ebx
mov dword [ebp - 0xc], eax
mov dword [ebp - 0x20], edx
jmp 0x476f41
xor eax, eax
mov edx, edi
add edx, ebx
adc eax, ecx
cmp eax, dword [ebp - 0x34]
jl 0x47709e
jg 0x477099
cmp edx, dword [ebp - 0x30]
jbe 0x47709e
mov edi, dword [ebp - 4]
sub edi, ebx
test edi, edi
je 0x4770b9
mov eax, dword [ebp - 0x2c]
add eax, 0x3c
add eax, ebx
push edi
add eax, esi
push eax
push dword [ebp - 0x14]
call fcn.004c0d70
add esp, 0xc
push dword [ebp - 0x18]
mov dword [ebp - 4], edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0xc]
mov dword [esi + eax*4 + 0x40070], 0
mov dword [esi + eax*4 + 0x40060], 0
mov dword [edx], 0
mov dword [edx + 4], 0
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret