def guess_argnum(result, buffer_size, start_index=1):
    pattern_size = buffer_size // 8 
    pat = msfpattern(pattern_size * 4)
    if result[:len(pat)] != pat:
        return None
    result = result[len(pat):].replace("(nil)", "0x00000000").rstrip("X")

    parts = result.split("0x")[1:]
    for i, p in enumerate(parts):
        p = p.rjust(8, "0").decode("hex")[::-1]
        if p in pat:
            block_index = pat.find(p)
            padding = block_index % 4

            argnum = start_index + i * (1 - pattern_size)
            argnum -= block_index // 4
            return argnum, padding
    return None
dataset/ETHPy150Open Gallopsled/pwntools-write-ups/wargames/overthewire-vortex/level4/libformatstr/guess.py/guess_argnum/swapped operands of `-`