Function at 0x401aa6
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push esi
push ebx
and esp, 0xfffffff0
sub esp, 0x60
call dbg.__main
mov dword [esp + 0x54], 0
mov dword [esp + 0x50], 1
mov dword [esp], str._sverxs_makesms_converter_
call sym._puts
cmp dword [ebp + 8], 2
jg 0x401d5f
mov dword [esp], 1
call sym._usage
jmp 0x401d5f
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 0x405386
mov dword [esp], eax
call sym._strcmp
test eax, eax
jne 0x401b1f
mov byte [0x406025], 1
jmp 0x401d5a
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 0x40538a
mov dword [esp], eax
call sym._strcmp
test eax, eax
jne 0x401b51
mov byte [0x406025], 2
jmp 0x401d5a
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], str._mbin
mov dword [esp], eax
call sym._strcmp
test eax, eax
jne 0x401be6
add dword [esp + 0x50], 1
mov eax, dword [esp + 0x50]
cmp eax, dword [ebp + 8]
jl 0x401bbf
mov dword [esp], 2
mov eax, dword [dbg.__acrt_iob_func]
call eax
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x18
mov dword [esp + 4], 1
mov dword [esp], str.Missing_value_for__mbin_n
call sym._fwrite
mov dword [esp], 1
call sym._usage
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 1
mov dword [esp], eax
call sym._addMerge
jmp 0x401d5a
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], str._mbank
mov dword [esp], eax
call sym._strcmp
test eax, eax
jne 0x401c7b
add dword [esp + 0x50], 1
mov eax, dword [esp + 0x50]
cmp eax, dword [ebp + 8]
jl 0x401c54
mov dword [esp], 2
mov eax, dword [dbg.__acrt_iob_func]
call eax
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x19
mov dword [esp + 4], 1
mov dword [esp], str.Missing_value_for__mbank_n
call sym._fwrite
mov dword [esp], 1
call sym._usage
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 0x4000
mov dword [esp], eax
call sym._addMerge
jmp 0x401d5a
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], str._emptyfill
mov dword [esp], eax
call sym._strcmp
test eax, eax
jne 0x401d1a
add dword [esp + 0x50], 1
mov eax, dword [esp + 0x50]
cmp eax, dword [ebp + 8]
jl 0x401ce9
mov dword [esp], 2
mov eax, dword [dbg.__acrt_iob_func]
call eax
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1d
mov dword [esp + 4], 1
mov dword [esp], str.Missing_value_for__emptyfill_n
call sym._fwrite
mov dword [esp], 1
call sym._usage
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], eax
call sym._strtol
mov byte [0x406026], al
jmp 0x401d5a
mov eax, dword [esp + 0x50]
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov ebx, dword [eax]
mov dword [esp], 2
mov eax, dword [dbg.__acrt_iob_func]
call eax
mov dword [esp + 8], ebx
mov dword [esp + 4], str.Fatal:_cant_understand_argument__s_n
mov dword [esp], eax
call sym._fprintf
mov dword [esp], 1
call sym._usage
add dword [esp + 0x50], 1
mov eax, dword [ebp + 8]
sub eax, 2
cmp dword [esp + 0x50], eax
jl 0x401aed
mov eax, dword [ebp + 8]
add eax, 0x3ffffffe
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 0x4052ca
mov dword [esp], eax
call sym._fopen
mov dword [0x806604], eax
mov eax, dword [0x806604]
test eax, eax
jne 0x401db9
mov dword [esp], str.Fatal:_cant_open_input_IHX_file
call sym._puts
mov eax, 1
jmp 0x40274b
mov word [0x806400], 0x200
movzx eax, byte [0x406026]
movzx eax, al
mov dword [esp + 8], 0x400000
mov dword [esp + 4], eax
mov dword [esp], 0x406400
call sym._memset
jmp 0x401fe2
mov eax, dword [0x806604]
mov dword [esp + 0x14], 0x806620
mov dword [esp + 0x10], 0x4063e0
mov dword [esp + 0xc], 0x806600
mov dword [esp + 8], 0x806720
mov dword [esp + 4], str.:_2x_4x_2x_s_n
mov dword [esp], eax
call sym._fscanf
mov eax, dword [0x4063e0]
cmp eax, 4
je 0x401fa2
cmp eax, 4
ja 0x401fe1
test eax, eax
je 0x401e47
cmp eax, 1
je 0x401fe2
jmp 0x401fe1
mov eax, dword [0x806600]
cmp eax, 0x3fff
jbe 0x401e7f
movzx eax, byte [0x406024]
test al, al
je 0x401e7f
movzx eax, byte [0x406024]
movzx eax, al
shl eax, 0xe
mov edx, eax
mov eax, dword [0x806600]
and eax, 0x3fff
add eax, edx
mov dword [esp + 0x58], eax
jmp 0x401e88
mov eax, dword [0x806600]
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], 0
jmp 0x401f73
mov eax, dword [esp + 0x5c]
add eax, eax
add eax, 0x806620
mov dword [esp + 8], 2
mov dword [esp + 4], eax
lea eax, [esp + 0x45]
mov dword [esp], eax
call sym._strncpy
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
lea eax, [esp + 0x45]
mov dword [esp], eax
call sym._strtol
mov ecx, eax
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
add eax, edx
mov edx, ecx
mov byte [eax + 0x406400], dl
mov eax, dword [0x806600]
cmp eax, 0x1ff
jbe 0x401f49
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
add eax, edx
shr eax, 0xe
movzx edx, word [eax + eax + 0x806400]
add edx, 1
mov word [eax + eax + 0x806400], dx
movzx eax, word [eax + eax + 0x806400]
cmp ax, 0x4000
jbe 0x401f49
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
add eax, edx
shr eax, 0xe
mov dword [esp + 4], eax
mov dword [esp], str.Fatal:_Bank__d_overflow._n
call sym._printf
mov eax, 1
jmp 0x40274b
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
add edx, eax
mov eax, dword [0x406020]
cmp edx, eax
jb 0x401f6e
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
add eax, edx
add eax, 1
mov dword [0x406020], eax
add dword [esp + 0x5c], 1
mov eax, dword [0x806720]
cmp dword [esp + 0x5c], eax
jb 0x401e95
mov eax, dword [0x806600]
cmp eax, 0x1ff
jbe 0x401fe2
mov edx, dword [0x404004]
mov eax, dword [0x806720]
add eax, edx
mov dword [0x404004], eax
jmp 0x401fe2
mov dword [esp + 8], 2
mov dword [esp + 4], 0x806622
lea eax, [esp + 0x45]
mov dword [esp], eax
call sym._strncpy
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
lea eax, [esp + 0x45]
mov dword [esp], eax
call sym._strtol
mov byte [0x406024], al
jmp 0x401fe2
nop
mov eax, dword [0x806604]
mov dword [esp], eax
call sym._feof
test eax, eax
je 0x401de9
mov eax, dword [0x806604]
mov dword [esp], eax
call sym._fclose
call sym._processMerges
test eax, eax
je 0x402017
mov eax, 1
jmp 0x40274b
mov eax, dword [0x406020]
and eax, 0x3fff
test eax, eax
je 0x402038
mov eax, dword [0x406020]
shr eax, 0xe
add eax, 1
shl eax, 0xe
mov dword [0x406020], eax
mov eax, dword [0x406020]
shr eax, 0xa
mov ecx, eax
mov eax, dword [0x404004]
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], 0
fild qword [esp + 0x28]
mov eax, dword [0x406020]
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], 0
fild qword [esp + 0x28]
fdivp st(1)
fld dword [0x4055dc]
fmulp st(1)
mov edx, dword [0x406020]
mov eax, dword [0x404004]
mov dword [esp + 0x14], ecx
fstp qword [esp + 0xc]
mov dword [esp + 8], edx
mov dword [esp + 4], eax
mov dword [esp], str.Info:__d_bytes_used__d_total___0.2f______size_of_output_ROM_is__d_KB_n
call sym._printf
mov eax, dword [0x406020]
cmp eax, 0x4000
jbe 0x40210e
mov dword [esp], str.Info:
call sym._printf
mov dword [esp + 0x5c], 0
jmp 0x4020f4
mov eax, dword [esp + 0x5c]
movzx eax, word [eax + eax + 0x806400]
movzx eax, ax
mov edx, 0x4000
sub edx, eax
mov eax, edx
mov dword [esp + 8], eax
mov eax, dword [esp + 0x5c]
mov dword [esp + 4], eax
mov dword [esp], str._bank_d__d_
call sym._printf
add dword [esp + 0x5c], 1
mov eax, dword [0x406020]
shr eax, 0xe
cmp dword [esp + 0x5c], eax
jb 0x4020bf
mov dword [esp], str.bytes_free
call sym._puts
mov dword [esp + 8], 4
mov dword [esp + 4], 0x40e3e0
mov dword [esp], str.SDSC
call sym._strncmp
test eax, eax
jne 0x402336
mov dword [esp + 8], 4
mov dword [esp + 4], 0x40e3e6
mov dword [esp], 0x4054d6
call sym._memcmp
test eax, eax
jne 0x402559
mov dword [esp], 0
call sym._time
mov dword [esp + 0x40], eax
lea eax, [esp + 0x40]
mov dword [esp], eax
call sym._localtime
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x48]
mov ecx, dword [eax + 0xc]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x48]
mov ecx, dword [eax + 0xc]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40e3e6], al
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x10]
lea ecx, [eax + 1]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x10]
lea ecx, [eax + 1]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40e3e7], al
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x14]
lea ebx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ebx
imul edx
sar edx, 5
mov eax, ebx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
imul eax, ecx, 0x64
sub ebx, eax
mov ecx, ebx
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov esi, eax
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x14]
lea ebx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ebx
imul edx
sar edx, 5
mov eax, ebx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
imul eax, ecx, 0x64
sub ebx, eax
mov ecx, ebx
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, esi
mov byte [0x40e3e8], al
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x14]
lea ecx, [eax + 0x76c]
mov edx, 0x10624dd3
mov eax, ecx
imul edx
sar edx, 6
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x48]
mov eax, dword [eax + 0x14]
lea ecx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ecx
imul edx
sar edx, 5
mov eax, ecx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40e3e9], al
mov dword [esp], str.Info:_release_date_in_SDSC_header_updated
call sym._puts
jmp 0x402559
mov dword [esp + 8], 4
mov dword [esp + 4], 0x40a3e0
mov dword [esp], str.SDSC
call sym._strncmp
test eax, eax
jne 0x402559
mov dword [esp + 8], 4
mov dword [esp + 4], 0x40a3e6
mov dword [esp], 0x4054d6
call sym._memcmp
test eax, eax
jne 0x402559
mov dword [esp], 0
call sym._time
mov dword [esp + 0x3c], eax
lea eax, [esp + 0x3c]
mov dword [esp], eax
call sym._localtime
mov dword [esp + 0x4c], eax
mov eax, dword [esp + 0x4c]
mov ecx, dword [eax + 0xc]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x4c]
mov ecx, dword [eax + 0xc]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40a3e6], al
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x10]
lea ecx, [eax + 1]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x10]
lea ecx, [eax + 1]
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40a3e7], al
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x14]
lea ebx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ebx
imul edx
sar edx, 5
mov eax, ebx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
imul eax, ecx, 0x64
sub ebx, eax
mov ecx, ebx
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov esi, eax
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x14]
lea ebx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ebx
imul edx
sar edx, 5
mov eax, ebx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
imul eax, ecx, 0x64
sub ebx, eax
mov ecx, ebx
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, esi
mov byte [0x40a3e8], al
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x14]
lea ecx, [eax + 0x76c]
mov edx, 0x10624dd3
mov eax, ecx
imul edx
sar edx, 6
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 4
mov ebx, eax
mov eax, dword [esp + 0x4c]
mov eax, dword [eax + 0x14]
lea ecx, [eax + 0x76c]
mov edx, 0x51eb851f
mov eax, ecx
imul edx
sar edx, 5
mov eax, ecx
sar eax, 0x1f
mov ecx, edx
sub ecx, eax
mov edx, 0x66666667
mov eax, ecx
imul edx
sar edx, 2
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
mov eax, edx
add eax, ebx
mov byte [0x40a3e9], al
mov dword [esp], str.Info:_release_date_in_SDSC_header_updated
call sym._puts
mov dword [esp + 8], 8
mov dword [esp + 4], 0x40e3f0
mov dword [esp], str.TMR_SEGA
call sym._strncmp
test eax, eax
jne 0x4025c8
mov dword [esp + 0x5c], 0
jmp 0x40259b
mov eax, dword [esp + 0x5c]
add eax, 0x406400
movzx eax, byte [eax]
movzx eax, al
add dword [esp + 0x54], eax
add dword [esp + 0x5c], 1
cmp dword [esp + 0x5c], 0x7fef
jbe 0x402583
mov eax, dword [esp + 0x54]
mov byte [0x40e3fa], al
mov eax, dword [esp + 0x54]
shr eax, 8
mov byte [0x40e3fb], al
mov dword [esp], str.Info:_SEGA_header_found__checksum_updated
call sym._puts
jmp 0x402643
mov dword [esp + 8], 8
mov dword [esp + 4], 0x40a3f0
mov dword [esp], str.TMR_SEGA
call sym._strncmp
test eax, eax
jne 0x402637
mov dword [esp + 0x5c], 0
jmp 0x40260a
mov eax, dword [esp + 0x5c]
add eax, 0x406400
movzx eax, byte [eax]
movzx eax, al
add dword [esp + 0x54], eax
add dword [esp + 0x5c], 1
cmp dword [esp + 0x5c], 0x3fef
jbe 0x4025f2
mov eax, dword [esp + 0x54]
mov byte [0x40a3fa], al
mov eax, dword [esp + 0x54]
shr eax, 8
mov byte [0x40a3fb], al
mov dword [esp], str.Info:_SEGA_header_found__checksum_updated
call sym._puts
jmp 0x402643
mov dword [esp], str.Warning:_SEGA_header_NOT_found__ROM_wont_be_bootable_on_european_american_Master_System
call sym._puts
mov eax, dword [ebp + 8]
add eax, 0x3fffffff
lea edx, [eax*4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov eax, dword [eax]
mov dword [esp + 4], 0x405595
mov dword [esp], eax
call sym._fopen
mov dword [0x4063e4], eax
mov eax, dword [0x4063e4]
test eax, eax
jne 0x402692
mov dword [esp], str.Fatal:_cant_open_output_SMS_file
call sym._puts
call sym._freeMerges
mov eax, 1
jmp 0x40274b
movzx eax, byte [0x406025]
test al, al
je 0x40270d
movzx eax, byte [0x406025]
cmp al, 1
jne 0x4026c7
jmp 0x4026b9
mov eax, dword [0x406020]
add eax, 0x4000
mov dword [0x406020], eax
mov eax, dword [0x406020]
movzx eax, ax
test eax, eax
jne 0x4026aa
jmp 0x4026f5
movzx eax, byte [0x406025]
cmp al, 2
jne 0x4026f5
jmp 0x4026e3
mov eax, dword [0x406020]
add eax, 0x4000
mov dword [0x406020], eax
mov eax, dword [0x406020]
mov dword [esp], eax
call sym._count_set_bits
cmp eax, 1
jne 0x4026d4
mov eax, dword [0x406020]
shr eax, 0xa
mov dword [esp + 4], eax
mov dword [esp], str.Info:_ROM_size_padded_to__d_KB_n
call sym._printf
mov edx, dword [0x4063e4]
mov eax, dword [0x406020]
mov dword [esp + 0xc], edx
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov dword [esp], 0x406400
call sym._fwrite
mov eax, dword [0x4063e4]
mov dword [esp], eax
call sym._fclose
call sym._freeMerges
mov eax, 0
lea esp, [ebp - 8]
pop ebx
pop esi
pop ebp
ret