Function at 0x499960
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xb0
mov eax, dword [0x641a90]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
mov esi, dword [ebp + 0xc]
push edi
mov edi, dword [ebp + 8]
mov ecx, dword [esi + 0x4c]
test ecx, ecx
je 0x4999b1
mov edx, ecx
lea ebx, [edx + 1]
mov al, byte [edx]
inc edx
test al, al
jne 0x499988
sub edx, ebx
cmp edx, 0xff
jae 0x4999b1
lea edx, [ecx + 1]
lea esp, [esp]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x4999a0
push dword [edi]
sub ecx, edx
lea eax, [ecx + 1]
push eax
jmp 0x4999b5
push dword [edi]
push 0
call fcn.005958b3
add esp, 8
lea eax, [ebp - 0xa8]
push eax
call fcn.00458dd0
movzx eax, word [esi + 0x24]
add esp, 4
mov ebx, 8
cmp ax, 2
je 0x499a32
cmp ax, 1
je 0x499a32
push dword [edi]
push 1
call fcn.005958b3
add esp, 8
cmp word [esi + 0xac], 0
push dword [edi]
je 0x4999fd
push 9
jmp 0x4999ff
push 1
call fcn.005958b3
add esp, 8
push edi
push 0
call fcn.0045d560
push edi
push 0x100
call fcn.0045d560
push dword [edi]
push 0x18
call fcn.005958b3
add esp, 0x18
mov dword [ebp - 0x8c], 0x80200
jmp 0x499a86
push dword [edi]
push 0
call fcn.005958b3
add esp, 8
cmp word [esi + 0xac], 0
je 0x499a55
cmp word [esi + 0x24], 1
je 0x499a55
push dword [edi]
push 0xb
jmp 0x499a59
push dword [edi]
push 3
call fcn.005958b3
add esp, 8
push edi
push 0
call fcn.0045d560
push edi
push 0
call fcn.0045d560
push dword [edi]
push 0
call fcn.005958b3
add esp, 0x18
xor eax, eax
mov word [ebp - 0x8c], ax
push edi
push 0
call fcn.0045d560
push edi
push 0
call fcn.0045d560
movzx eax, word [esi + 0x2c]
push edi
push eax
call fcn.0045d560
movzx eax, word [esi + 0x30]
push edi
push eax
call fcn.0045d560
push dword [edi]
mov ecx, 1
mov eax, ebx
cmp word [esi + 0x24], cx
cmove eax, ecx
push eax
call fcn.005958b3
push dword [edi]
xor ecx, ecx
mov eax, 0x20
cmp byte [esi + 0xbf], cl
cmovne eax, ecx
push eax
call fcn.005958b3
mov edx, dword [esi + 0x4c]
add esp, 0x30
test edx, edx
je 0x499b2e
mov ecx, edx
lea eax, [ecx + 1]
mov dword [ebp - 0xac], eax
nop
mov al, byte [ecx]
inc ecx
test al, al
jne 0x499af0
sub ecx, dword [ebp - 0xac]
cmp ecx, 0xff
jae 0x499b2e
mov ecx, edx
lea eax, [ecx + 1]
mov dword [ebp - 0xac], eax
mov al, byte [ecx]
inc ecx
test al, al
jne 0x499b10
sub ecx, dword [ebp - 0xac]
push dword [edi]
push 1
lea eax, [ecx + 1]
push eax
push edx
call fcn.0059628c
add esp, 0x10
cmp word [esi + 0xac], 0
lea edx, [ebp - 0x84]
mov ecx, str.Targa_RLE
mov eax, str.Targa
cmove ecx, eax
sub edx, ecx
jmp 0x499b50
mov al, byte [ecx]
lea ecx, [ecx + 1]
mov byte [edx + ecx - 1], al
test al, al
jne 0x499b50
cmp word [esi + 0x24], 1
mov ecx, 1
cmove ebx, ecx
mov word [ebp - 0x9a], bx
cmp bx, 8
jne 0x499b7d
movzx eax, word [esi + 0x2c]
jmp 0x499b96
mov eax, dword [esi + 0x2c]
add eax, 7
cdq
and edx, 7
add eax, edx
sar eax, 3
imul eax, dword [ebp - 0x9a]
movzx eax, ax
mov dword [ebp - 0xac], eax
cwde
mov dword [ebp - 0x90], eax
xor eax, eax
cmp byte [esi + 0xbf], al
mov word [ebp - 0x9c], cx
mov ecx, 0x10
cmovne eax, ecx
mov word [ebp - 0xa4], ax
lea eax, [ebp - 0xa8]
push eax
push esi
call fcn.00457000
movzx eax, ax
add esp, 8
mov dword [ebp - 0xb0], eax
test ax, ax
jne 0x499c9f
cmp word [esi + 0x24], 4
jne 0x499c1f
push dword [edi]
push 3
push 0x100
push dword [ebp - 0x88]
call fcn.0059628c
add esp, 0x10
cmp eax, 3
je 0x499c1f
mov edi, 6
mov ax, di
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005920c1
mov esp, ebp
pop ebp
xor ebx, ebx
cmp dword [esi + 0x30], ebx
jle 0x499c8d
xor eax, eax
push 1
push eax
push esi
call fcn.00459620
add esp, 0xc
cmp word [esi + 0xac], 0
je 0x499c64
cmp word [esi + 0x24], 1
je 0x499c64
push 1
push dword [esi + 0x2c]
push dword [ebp - 0xa0]
push edi
call fcn.004997f0
movzx eax, ax
add esp, 0x10
mov dword [ebp - 0xb0], eax
jmp 0x499c84
push dword [edi]
mov ecx, dword [ebp - 0xac]
push 1
movsx eax, cx
push eax
push dword [ebp - 0xa0]
call fcn.0059628c
add esp, 0x10
test eax, eax
je 0x499cb0
inc ebx
movsx eax, bx
cmp eax, dword [esi + 0x30]
jl 0x499c28
mov edi, dword [ebp - 0xb0]
push esi
call fcn.00454fa0
add esp, 4
mov ax, di
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.005920c1
mov esp, ebp
pop ebp
ret
mov edi, 6
jmp 0x499c93