<commit_before>package main

import (
	"./core"
	"fmt"
	"io"
	"os"
)

func main() {
	if len(os.Args) != 2 {
		fmt.Printf("ARMv7-M Emulator\n")
		fmt.Printf("usage: %s binary\n", os.Args[0])
		os.Exit(1)
	}

	binary := os.Args[1]
	file, err := os.Open(binary)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}

	//regs := new(core.Registers)
	b := make([]byte, 2, 2)
	var upper *core.FetchedInstr16 = nil

	for {
		n, err := file.Read(b)
		if err == io.EOF {
			break
		} else if err != nil {
			fmt.Printf("%s\n", err)
			os.Exit(1)
		} else if n != len(b) {
			fmt.Printf("not enough bytes read\n")
			os.Exit(1)
		}

		var fetched core.FetchedInstr

		fetched16 := core.FetchedInstr16((uint16(b[1]) << 8) | uint16(b[0]))

		if upper != nil {
			fetched = upper.Extend(fetched16)
			upper = nil
		} else {
			fetched = fetched16
		}

		instr, err := fetched.Decode()
		if err == core.IncompleteInstruction {
			upper = &fetched16
			continue
		} else if err != nil {
			fmt.Printf("%s (instr = %v)\n", err, fetched)
			continue
		}

		fmt.Printf("%#v\n", instr)
	}

	file.Close()
}<commit_msg>Print in objdump style<commit_after>package main

import (
	"./core"
	"fmt"
	"io"
	"os"
)

func main() {
	if len(os.Args) != 2 {
		fmt.Printf("ARMv7-M Emulator\n")
		fmt.Printf("usage: %s binary\n", os.Args[0])
		os.Exit(1)
	}

	binary := os.Args[1]
	file, err := os.Open(binary)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}

	//regs := new(core.Registers)
	b := make([]byte, 2, 2)
	addr := 0
	var upper *core.FetchedInstr16 = nil

	for {
		n, err := file.Read(b)
		if err == io.EOF {
			break
		} else if err != nil {
			fmt.Printf("%s\n", err)
			os.Exit(1)
		} else if n != len(b) {
			fmt.Printf("not enough bytes read\n")
			os.Exit(1)
		}

		var fetched core.FetchedInstr

		fetched16 := core.FetchedInstr16((uint16(b[1]) << 8) | uint16(b[0]))

		if upper != nil {
			fmt.Printf(" %v", fetched16)
			fetched = upper.Extend(fetched16)
			upper = nil
		} else {
			fetched = fetched16
			fmt.Printf("%x:\t%v", addr, fetched)
		}

		addr += len(b)

		instr, err := fetched.Decode()
		if err == core.IncompleteInstruction {
			upper = &fetched16
			continue
		} else if err != nil {
			fmt.Printf("\t%s\n", err)
			continue
		}

		fmt.Printf("\t%#v\n", instr)
	}

	file.Close()
}
{'fraction_non_alphanumeric': 0.19016536118363794, 'fraction_numerical': 0.026544821583986074, 'mean_word_length': 2.8, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2412349', 'n_tokens_mistral': 1122, 'n_tokens_neox': 984, 'n_words': 216}