void bios_linker_loader_add_checksum(BIOSLinker *linker, const char *file_name,

                                     void *start, unsigned size,

                                     uint8_t *checksum)

{

    BiosLinkerLoaderEntry entry;

    const BiosLinkerFileEntry *file = bios_linker_find_file(linker, file_name);

    ptrdiff_t checksum_offset = (gchar *)checksum - file->blob->data;

    ptrdiff_t start_offset = (gchar *)start - file->blob->data;



    assert(checksum_offset >= 0);

    assert(start_offset >= 0);

    assert(checksum_offset + 1 <= file->blob->len);

    assert(start_offset + size <= file->blob->len);

    assert(*checksum == 0x0);



    memset(&entry, 0, sizeof entry);

    strncpy(entry.cksum.file, file_name, sizeof entry.cksum.file - 1);

    entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM);

    entry.cksum.offset = cpu_to_le32(checksum_offset);

    entry.cksum.start = cpu_to_le32(start_offset);

    entry.cksum.length = cpu_to_le32(size);



    g_array_append_vals(linker->cmd_blob, &entry, sizeof entry);

}

void bios_linker_loader_add_checksum(BIOSLinker *linker, const char *file_name,

                                     void *start, unsigned size,

                                     uint8_t *checksum)

{

    BiosLinkerLoaderEntry entry;

    const BiosLinkerFileEntry *file = bios_linker_find_file(linker, file_name);

    ptrdiff_t checksum_offset = (gchar *)checksum - file->blob->data;

    ptrdiff_t start_offset = (gchar *)start - file->blob->data;



    assert(checksum_offset >= 0);

    assert(start_offset >= 0);

    assert(checksum_offset + 1 <= file->blob->len);

    assert(start_offset + size <= file->blob->len);

    assert(*checksum == 0x0);



    memset(&entry, 0, sizeof entry);

    strncpy(entry.cksum.file, file_name, sizeof entry.cksum.file - 1);

    entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM);

    entry.cksum.offset = cpu_to_le32(checksum_offset);

    entry.cksum.start = cpu_to_le32(start_offset);

    entry.cksum.length = cpu_to_le32(size);



    g_array_append_vals(linker->cmd_blob, &entry, sizeof entry);

}

void FUNC_0(BIOSLinker *VAR_0, const char *VAR_1,

                                     void *VAR_2, unsigned VAR_3,

                                     uint8_t *VAR_4)

{

    BiosLinkerLoaderEntry entry;

    const BiosLinkerFileEntry *VAR_5 = bios_linker_find_file(VAR_0, VAR_1);

    ptrdiff_t checksum_offset = (gchar *)VAR_4 - VAR_5->blob->data;

    ptrdiff_t start_offset = (gchar *)VAR_2 - VAR_5->blob->data;



    assert(checksum_offset >= 0);

    assert(start_offset >= 0);

    assert(checksum_offset + 1 <= VAR_5->blob->len);

    assert(start_offset + VAR_3 <= VAR_5->blob->len);

    assert(*VAR_4 == 0x0);



    memset(&entry, 0, sizeof entry);

    strncpy(entry.cksum.VAR_5, VAR_1, sizeof entry.cksum.VAR_5 - 1);

    entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM);

    entry.cksum.offset = cpu_to_le32(checksum_offset);

    entry.cksum.VAR_2 = cpu_to_le32(start_offset);

    entry.cksum.length = cpu_to_le32(VAR_3);



    g_array_append_vals(VAR_0->cmd_blob, &entry, sizeof entry);

}

void FUNC_0(BIOSLinker *VAR_0, const char *VAR_1,
void *VAR_2, unsigned VAR_3,
uint8_t *VAR_4)
{ BiosLinkerLoaderEntry entry; const BiosLinkerFileEntry *VAR_5 = bios_linker_find_file(VAR_0, VAR_1); ptrdiff_t checksum_offset = (gchar *)VAR_4 - VAR_5->blob->data; ptrdiff_t start_offset = (gchar *)VAR_2 - VAR_5->blob->data; assert(checksum_offset >= 0); assert(start_offset >= 0); assert(checksum_offset + 1 <= VAR_5->blob->len); assert(start_offset + VAR_3 <= VAR_5->blob->len); assert(*VAR_4 == 0x0); memset(&entry, 0, sizeof entry); strncpy(entry.cksum.VAR_5, VAR_1, sizeof entry.cksum.VAR_5 - 1); entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM); entry.cksum.offset = cpu_to_le32(checksum_offset); entry.cksum.VAR_2 = cpu_to_le32(start_offset); entry.cksum.length = cpu_to_le32(VAR_3); g_array_append_vals(VAR_0->cmd_blob, &entry, sizeof entry); }