'Remove CGC attachments.
:return: True if CGC attachments are found and removed, False otherwise
:rtype: bool'

def remove_cgc_attachments(self):

    cgc_package_list = None
    cgc_extended_application = None
    for data in self.data:
        if (data.sort == 'cgc-package-list'):
            cgc_package_list = data
        elif (data.sort == 'cgc-extended-application'):
            cgc_extended_application = data
    if ((not cgc_package_list) or (not cgc_extended_application)):
        return False
    if (cgc_package_list.skip or cgc_extended_application.skip):
        return True
    cgcpl_memory_data = self.cfg.memory_data.get(cgc_package_list.addr, None)
    cgcea_memory_data = self.cfg.memory_data.get(cgc_extended_application.addr, None)
    if ((cgcpl_memory_data is None) or (cgcea_memory_data is None)):
        return False
    if (len(cgcpl_memory_data.refs) != 1):
        return False
    if (len(cgcea_memory_data.refs) != 1):
        return False
    if (next(iter(cgcpl_memory_data.refs))[0] != next(iter(cgcea_memory_data.refs))[0]):
        return False
    insn_addr = next(iter(cgcpl_memory_data.refs))[2]
    cfg_node = self.cfg.get_any_node(insn_addr, anyaddr=True)
    if (not cfg_node):
        return False
    func_addr = cfg_node.function_address
    sub_func_addr = None
    if (func_addr not in self.cfg.functions):
        return False
    function = self.cfg.functions[func_addr]
    calling_targets = []
    for (_, dst, data) in function.transition_graph.edges_iter(data=True):
        if (('type' in data) and (data['type'] == 'call')):
            calling_targets.append(dst.addr)
    if (len(calling_targets) != 1):
        return False
    sub_func_addr = calling_targets[0]
    proc = next((p for p in self.procedures if (p.addr == func_addr)), None)
    if (proc is None):
        return False
    subproc = next((p for p in self.procedures if (p.addr == sub_func_addr)), None)
    if (subproc is None):
        return False
    has_label = True
    lowest_address = min(cgc_package_list.addr, cgc_extended_application.addr)
    for obj in (cgc_package_list, cgc_extended_application):
        labels = obj.labels
        for (addr, label) in labels:
            if (addr != lowest_address):
                label.base_addr = lowest_address
    if has_label:
        data = next((d for d in self.data if ((d.addr is not None) and ((d.addr + d.size) == lowest_address))), None)
        if (data is None):
            pass
        else:
            lbl = self.symbol_manager.addr_to_label[lowest_address][0]
            if (lbl not in data.end_labels):
                data.end_labels.append(lbl)
    proc.asm_code = ' DCTB ret\n'
    subproc.asm_code = ' DCTB ret\n'
    cgc_package_list.skip = True
    cgc_extended_application.skip = True
    l.info('CGC    attachments    are    removed.')
    return True
