func fixLabels(line string) (string, string) {
	label := ""
	if match := regexpLabel.FindStringSubmatch(line); len(match) > 0 {
		label = strings.Replace(match[1], ".", "", 1)
		line = label
		label = strings.Replace(label, ":", "", 1)
	}
	return line, label
}
Remove leading `.` from labels
package main
import (
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"unicode"
)
const originalStackPointer = 8
var registers = [...]string{"DI", "SI", "DX", "CX", "R8", "R9"}
var registersAdditional = [...]string{"R10", "R11", "R12", "R13", "R14", "R15", "AX", "BX"}
var regexpCall = regexp.MustCompile(`^\s*call\s*`)
var regexpPushInstr = regexp.MustCompile(`^\s*push\s*`)
var regexpPopInstr = regexp.MustCompile(`^\s*pop\s*`)
var regexpLabel = regexp.MustCompile(`^(\.?LBB.*?:)`)
var regexpJumpTableRef = regexp.MustCompile(`\[rip \+ (\.?LJTI[_0-9]*)\]\s*$`)
var regexpJumpWithLabel = regexp.MustCompile(`^(\s*j\w*)\s*(\.?LBB.*)`)
var regexpRbpLoadHigher = regexp.MustCompile(`\[rbp \+ ([0-9]+)\]`)
var regexpRbpLoadLower = regexp.MustCompile(`\[rbp - ([0-9]+)\]`)
var regexpStripComments = regexp.MustCompile(`\s*#?#\s.*$`)
func writeGoasmPrologue(sub Subroutine, stack Stack, arguments, returnValues []string) []string {
	var result []string
	result = append(result, fmt.Sprintf("TEXT ·_%s(SB), $%d-%d", sub.name, stack.GolangLocalStackFrameSize(),
		getTotalSizeOfArgumentsAndReturnValues(0, len(arguments)-1, returnValues)), "")
	for iarg, arg := range arguments {
		if iarg < len(registers) {
			result = append(result, fmt.Sprintf("    MOVQ %s+%d(FP), %s", arg, iarg*8, registers[iarg]))
		} else if iarg-len(registers) < len(registersAdditional) {
			result = append(result, fmt.Sprintf("    MOVQ %s+%d(FP), %s", arg, iarg*8, registersAdditional[iarg-len(registers)]))
		} else {
			panic("Trying to pass in too many arguments")
		}
	}
	if sub.epilogue.AlignedStack {
		result = append(result, fmt.Sprintf("    MOVQ SP, BP"))
		result = append(result, fmt.Sprintf("    ADDQ $%d, SP", stack.StackPointerOffsetForC()  ))
		result = append(result, fmt.Sprintf("    ANDQ $-%d, SP", sub.epilogue.AlignValue))
		result = append(result, fmt.Sprintf("    MOVQ BP, %d(SP)", stack.OffsetForSavedSP()))  
	} else if stack.StackPointerOffsetForC() != 0 {  
		result = append(result, fmt.Sprintf("    ADDQ $%d, SP", stack.StackPointerOffsetForC()  ))
	}
	for iarg := len(arguments) - 1; iarg-len(registers) >= 0; iarg-- {
		result = append(result, fmt.Sprintf("    MOVQ %s, %d(SP)", registersAdditional[iarg-len(registers)], stack.OffsetForGoArg(iarg)))
	}
	if sub.table.isPresent() {
		result = append(result, fmt.Sprintf("    LEAQ %s<>(SB), BP", sub.table.Name))
	}
	return append(result, ``)
}
func writeGoasmBody(sub Subroutine, stack Stack, stackArgs StackArgs, arguments, returnValues []string) ([]string, error) {
	var result []string
	for iline, line := range sub.body {
		if iline >= sub.epilogue.Start && iline < sub.epilogue.End {
			if iline == sub.epilogue.End-1 {
				result = append(result, writeGoasmEpilogue(sub, stack, arguments, returnValues)...)
			}
			continue
		}
		var skipLine bool
		line, skipLine = stripComments(line)
		if skipLine {
			continue
		}
		if strings.Contains(line, ".align") || strings.Contains(line, ".p2align") {
			continue
		}
		line, _ = fixLabels(line)
		line, _, _ = upperCaseJumps(line)
		line, _ = upperCaseCalls(line)
		fields := strings.Fields(line)
		if len(fields) > 0 && !strings.Contains(fields[0], ":") && isLower(fields[0]) {
			line = "                                 // " + strings.TrimSpace(line)
		}
		line = removeUndefined(line, "ptr")
		line = removeUndefined(line, "# NOREX")
		line = replaceUndefined(line, "xmmword", "oword")
		line = replaceUndefined(line, "ymmword", "yword")
		line = fixShiftInstructions(line)
		line = fixMovabsInstructions(line)
		if sub.table.isPresent() {
			line = fixPicLabels(line, sub.table)
		}
		line = fixRbpPlusLoad(line, stackArgs, stack)
		detectRbpMinusMemoryAccess(line)
		detectJumpTable(line)
		detectPushInstruction(line)
		detectPopInstruction(line)
		result = append(result, line)
	}
	return result, nil
}
func writeGoasmEpilogue(sub Subroutine, stack Stack, arguments, returnValues []string) []string {
	var result []string
	if sub.epilogue.AlignedStack {
		result = append(result, fmt.Sprintf("    MOVQ %d(SP), SP", stack.OffsetForSavedSP()))
	} else if stack.StackPointerOffsetForC() != 0 {
		result = append(result, fmt.Sprintf("    SUBQ $%d, SP", stack.StackPointerOffsetForC()))
	}
	if sub.epilogue.VZeroUpper {
		result = append(result, "    VZEROUPPER")
	}
	if len(returnValues) == 1 {
		result = append(result, fmt.Sprintf("    MOVQ AX, %s+%d(FP)", returnValues[0],
			getTotalSizeOfArgumentsAndReturnValues(0, len(arguments)-1, returnValues)-8))
	} else if len(returnValues) > 1 {
		panic(fmt.Sprintf("Fix multiple return values: %s", returnValues))
	}
	result = append(result, "    RET")
	return result
}
func scanBodyForCalls(sub Subroutine) uint {
	stackSize := uint(0)
	for _, line := range sub.body {
		_, size := upperCaseCalls(line)
		if stackSize < size {
			stackSize = size
		}
	}
	return stackSize
}
func stripComments(line string) (result string, skipLine bool) {
	if match := regexpStripComments.FindStringSubmatch(line); len(match) > 0 {
		line = line[:len(line)-len(match[0])]
		if line == "" {
			return "", true
		}
	}
	return line, false
}