import java.io.*;

import org.ibex.nestedvm.util.ELF;

public class ELF2Arch {
    public static void main(String[] args) throws IOException {
        ELF elf = new ELF(args[0]);
        for(int i=0;i<elf.pheaders.length;i++) {
           ELF.PHeader ph = elf.pheaders[i];
           if(ph.type != ELF.PT_LOAD) continue;
           if(ph.filesz == 0) continue;
           DataInputStream dis = new DataInputStream(ph.getInputStream());
           for(int j=0;j<ph.filesz;j+=4) {
               int x = dis.readInt();
               if(x != 0)
                   System.out.println(
                       Integer.toHexString(ph.vaddr + j) + " 4 " +
                       Integer.toHexString((x>>>24)&0xff) + " " +
                       Integer.toHexString((x>>>16)&0xff) + " " +
                       Integer.toHexString((x>>> 8)&0xff) + " " +
                       Integer.toHexString((x>>> 0)&0xff)
                   );
           }
           dis.close();
        }
        System.out.println(Integer.toHexString(elf.header.entry));
    }
}

