Function at 0x1012d008
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x574
push ebx
push ebp
push esi
mov esi, ecx
push edi
mov dword [esp + 0x18], esi
mov edi, 0x2000
movzx edx, word [esi + 0x16]
movzx eax, word [esi + 0x14]
imul edx, eax
cmp word [esi + 0x5483e], 0
movd xmm0, edx
cvtdq2ps xmm0, xmm0
mulss xmm0, dword [esi + 0xedc]
cvttss2si ebx, xmm0
je 0x1012d046
mov eax, ebx
cdq
sub eax, edx
mov ebx, eax
sar ebx, 1
test dword [esi + 0xe8c], 0xfffffffd
jne 0x1012d0a3
cmp dword [esi + 0xee4], 0
jne 0x1012d0a3
mov eax, dword [esi + 0x190]
xor edi, edi
test eax, eax
jle 0x1012d0a3
mov ebp, dword [esi + 0x54840]
mov esi, eax
add ebp, 0x7ffc
xor edx, edx
mov eax, 0x1fff
mov ecx, ebp
nop
add edx, dword [ecx]
cmp edx, ebx
jg 0x1012d08f
dec eax
sub ecx, 4
cmp eax, 0x20
jg 0x1012d080
cmp edi, eax
cmovl edi, eax
add ebp, 0x8000
sub esi, 1
jne 0x1012d075
mov esi, dword [esp + 0x18]
lea eax, [edi*8]
mov ecx, esi
movd xmm0, eax
cvtdq2ps xmm0, xmm0
divss xmm0, dword [esi + 0xe7c]
cvttss2si eax, xmm0
movups xmm0, xmmword [esi + 0xe38]
push eax
push 2
sub esp, 0x10
movups xmmword [esp], xmm0
call fcn.10135310
test byte [esi + 0x30], 4
mov ax, word [esi + 0x14]
mov word [esi + 0x1c], ax
movzx eax, word [esi + 0x16]
mov word [esi + 0x1e], ax
je 0x1012d0ff
add word [esi + 0x14], ax
mov ax, word [esi + 0x14]
sub ax, word [esi + 0x16]
sub word [esi + 0x14], ax
mov word [esi + 0x16], ax
mov eax, dword [esi + 0xeb0]
mov ecx, esi
imul eax, dword [esi + 0x190]
cdq
and edx, 7
add eax, edx
sar eax, 3
push eax
movzx eax, word [esi + 0x16]
push eax
call fcn.10168cb0
mov ebp, eax
mov ecx, esi
push str.write_ppm_tiff__
push ebp
call fcn.10168d40
cmp dword [esi + 0xeb4], 0
je 0x1012d191
push 1
lea eax, [esp + 0x28]
mov ecx, esi
push eax
call fcn.1015e880
push dword [esi + 0x54804]
lea eax, [esp + 0x28]
push 1
push 0x560
push eax
call fcn.10276c65
mov eax, dword [esi + 0x54844]
add esp, 0x10
test eax, eax
je 0x1012d203
push dword [esi + 0x54804]
push 1
push dword [eax]
call dword [sym.imp.WS2_32.dll_ntohl]
push eax
push dword [esi + 0x54844]
call fcn.10276c65
add esp, 0x10
jmp 0x1012d203
mov edi, dword [esi + 0x190]
mov ecx, dword [esi + 0xeb0]
cmp edi, 3
jle 0x1012d1d2
lea eax, [esi + 0x1e0]
push eax
mov eax, 1
shl eax, cl
dec eax
push eax
movzx eax, word [esi + 0x14]
push edi
push eax
movzx eax, word [esi + 0x16]
push eax
push str.P7_nWIDTH__d_nHEIGHT__d_nDEPTH__d_nMAXVAL__d_nTUPLTYPE__s_nENDHDR_n
push dword [esi + 0x54804]
call fcn.1007a780
add esp, 0x1c
jmp 0x1012d203
mov edx, 1
mov eax, edi
shl edx, cl
movzx ecx, word [esi + 0x14]
dec edx
push edx
cdq
push ecx
movzx ecx, word [esi + 0x16]
sub eax, edx
push ecx
sar eax, 1
add eax, 5
push eax
push str.P_d_n_d__d_n_d_n
push dword [esi + 0x54804]
call fcn.1007a780
add esp, 0x18
mov edx, dword [esi + 0x30]
mov eax, 0
mov edi, edx
and edi, 2
je 0x1012d217
movzx eax, word [esi + 0x1c]
dec eax
mov ecx, edx
and ecx, 1
mov dword [esp + 0x18], ecx
mov ecx, 0
je 0x1012d22c
movzx ecx, word [esi + 0x1e]
dec ecx
movzx ebx, word [esi + 0x1e]
mov dword [esp + 0x1c], ebx
imul ebx, eax
mov dword [esp + 0x10], 1
mov dword [esp + 0x14], 0
add ebx, ecx
and edx, 4
je 0x1012d25e
mov dword [esp + 0x10], 0
mov dword [esp + 0x14], 1
test edi, edi
je 0x1012d26f
movzx eax, word [esi + 0x1c]
sub eax, dword [esp + 0x14]
dec eax
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x18]
test ecx, ecx
je 0x1012d282
movzx eax, word [esi + 0x1e]
sub eax, dword [esp + 0x10]
dec eax
jmp 0x1012d286
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x1c]
imul ecx, dword [esp + 0x14]
mov dword [esp + 0x10], 0
mov dword [esp + 0x14], 1
sub ecx, ebx
add ecx, eax
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x18]
test edx, edx
je 0x1012d2bf
mov dword [esp + 0x10], 1
mov dword [esp + 0x14], 0
test edi, edi
je 0x1012d2d0
movzx eax, word [esi + 0x1c]
sub eax, dword [esp + 0x14]
dec eax
mov dword [esp + 0x14], eax
test ecx, ecx
je 0x1012d2e1
movzx eax, word [esi + 0x1e]
sub eax, dword [esp + 0x10]
dec eax
mov dword [esp + 0x10], eax
movzx eax, word [esi + 0x16]
mov dword [esp + 0x1c], eax
xor eax, eax
mov dword [esp + 0x18], eax
test edx, edx
je 0x1012d2ff
movzx eax, word [esi + 0x16]
xor edx, edx
mov dword [esp + 0x18], eax
jmp 0x1012d303
mov edx, dword [esp + 0x1c]
test edi, edi
je 0x1012d314
movzx eax, word [esi + 0x1c]
sub eax, dword [esp + 0x18]
dec eax
mov dword [esp + 0x18], eax
test ecx, ecx
je 0x1012d325
movzx eax, word [esi + 0x1e]
sub eax, edx
lea edx, [eax - 1]
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
sub ecx, eax
movzx eax, word [esi + 0x1e]
imul ecx, eax
xor eax, eax
sub ecx, edx
add ecx, dword [esp + 0x10]
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], 0
cmp ax, word [esi + 0x14]
jae 0x1012d474
xor eax, eax
xor edi, edi
cmp ax, word [esi + 0x16]
jae 0x1012d3f1
nop
xor edx, edx
cmp dword [esi + 0xeb0], 8
jne 0x1012d3a2
cmp dword [esi + 0x190], edx
jle 0x1012d3e0
cmp edx, 4
jge 0x1012d3e0
mov eax, dword [esi + 8]
lea ecx, [edx + ebx*4]
movzx eax, word [eax + ecx*2]
mov ecx, dword [esi + 0x190]
imul ecx, edi
mov al, byte [esi + eax*2 + 0xf39]
add ecx, ebp
mov byte [ecx + edx], al
inc edx
cmp edx, dword [esi + 0x190]
jl 0x1012d373
jmp 0x1012d3e0
cmp dword [esi + 0x190], edx
jle 0x1012d3e0
nop word [eax + eax]
cmp edx, 4
jge 0x1012d3e0
mov eax, dword [esi + 8]
lea ecx, [edx + ebx*4]
movzx eax, word [eax + ecx*2]
mov ecx, dword [esi + 0x190]
imul ecx, edi
mov ax, word [esi + eax*2 + 0xf38]
add ecx, edx
inc edx
mov word [ebp + ecx*2], ax
cmp edx, dword [esi + 0x190]
jl 0x1012d3b0
movzx eax, word [esi + 0x16]
inc edi
add ebx, dword [esp + 0x20]
cmp edi, eax
jl 0x1012d360
cmp dword [esi + 0xeb0], 0x10
jne 0x1012d430
cmp dword [esi + 0xeb4], 0
jne 0x1012d430
push 0x55aa
call dword [sym.imp.WS2_32.dll_htons]
mov ecx, 0x55aa
cmp ax, cx
je 0x1012d430
movzx eax, word [esi + 0x16]
imul eax, dword [esi + 0x190]
add eax, eax
push eax
push ebp
push ebp
call fcn.10285439
add esp, 0xc
push dword [esi + 0x54804]
movzx eax, word [esi + 0x16]
push eax
mov eax, dword [esi + 0xeb0]
imul eax, dword [esi + 0x190]
cdq
and edx, 7
add eax, edx
sar eax, 3
push eax
push ebp
call fcn.10276c65
mov ecx, dword [esp + 0x20]
add esp, 0x10
movzx eax, word [esi + 0x14]
inc ecx
add ebx, dword [esp + 0x14]
mov dword [esp + 0x10], ecx
cmp ecx, eax
jl 0x1012d350
push ebp
mov ecx, esi
call fcn.10168d30
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x574
ret