"""
Convert the bit position representation to 3 big integers (total of 192 available bits).

"""

import os
import sys
import csv

reader = csv.reader(open('stitch_maccs_bits.fpt'))

outfh = open('stitch_maccs_bigint.csv','w')
writer = csv.writer(outfh)

for aesea_id, bits in reader:
    
    binary = [0]*192
    for bit in bits.split(' '):
        binary[int(bit)] = 1
    
    bigint1 = int(''.join(map(str, binary[:64])),2)
    bigint2 = int(''.join(map(str, binary[64:128])),2)
    bigint3 = int(''.join(map(str, binary[128:])),2)
    
    writer.writerow([aesea_id, bits, bigint1, bigint2, bigint3])

outfh.close()