code: func (p *Profile) remapMappingIDs() {
  	if len(p.Mapping) == 0 {
  		return
  	}
  
  	// Some profile handlers will incorrectly set regions for the main
  	// executable if its section is remapped. Fix them through heuristics.
  
  	// Remove the initial mapping if named '/anon_hugepage' and has a
  	// consecutive adjacent mapping.
  	if m := p.Mapping[0]; strings.HasPrefix(m.File, "/anon_hugepage") {
  		if len(p.Mapping) > 1 && m.Limit == p.Mapping[1].Start {
  			p.Mapping = p.Mapping[1:]
  		}
  	}
  
  	// Subtract the offset from the start of the main mapping if it
  	// ends up at a recognizable start address.
  	const expectedStart = 0x400000
  	if m := p.Mapping[0]; m.Start-m.Offset == expectedStart {
  		m.Start = expectedStart
  		m.Offset = 0
  	}
  
  	for _, l := range p.Location {
  		if a := l.Address; a != 0 {
  			for _, m := range p.Mapping {
  				if m.Start <= a && a < m.Limit {
  					l.Mapping = m
  					break
  				}
  			}
  		}
  	}
  
  	// Reset all mapping IDs.
  	for i, m := range p.Mapping {
  		m.ID = uint64(i + 1)
  	}
  }
docs: // remapMappingIDs matches location addresses with existing mappings
  // and updates them appropriately. This is O(N*M), if this ever shows
  // up as a bottleneck, evaluate sorting the mappings and doing a
  // binary search, which would make it O(N*log(M)).