# -*- coding: utf-8 -*-
"""
Created on Sun Feb 15 15:07:23 2026

@author: Roelof van Silfhout
"""

import sys

def interleave_zero_bytes(in_path, out_path, chunk_size=1024 * 1024):
    with open(in_path, "rb") as fin, open(out_path, "wb") as fout:
        while True:
            data = fin.read(chunk_size)
            if not data:
                break

            out = bytearray(len(data) * 2)
            out[0::2] = data          # original bytes in low byte
            out[1::2] = b'\x00' * len(data)

            fout.write(out)

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(f"Usage: {sys.argv[0]} input.bin output.bin")
        sys.exit(1)

    interleave_zero_bytes(sys.argv[1], sys.argv[2])
