void delete_command_by_type(FILE* file, uint32_t type)
{
macho_header file_header = get_macho_header(file);
uint64_t cmd_base_data;
uint32_t cmd_offset = get_command_offset_by_index(file, get_command_by_type(file, type, &cmd_base_data, 8)) - 32;
uint32_t shift_cmd_area_byte_count = file_header.size_of_load_cmds - cmd_offset - *(uint32_t*)((long long)&cmd_base_data + 4);
char shift_cmd_area[shift_cmd_area_byte_count];
if(fseek(file, cmd_offset + 32 + *(uint32_t*)((long long)&cmd_base_data + 4), SEEK_CUR)){printf("%s%d\n", "error in line: ", __LINE__); return;}
if(fread(shift_cmd_area, 1, shift_cmd_area_byte_count, file) != shift_cmd_area_byte_count){printf("%s%d\n", "error in line: ", __LINE__); return;}
if(fseek(file, cmd_offset + 32, SEEK_CUR)){printf("%s%d\n", "error in line: ", __LINE__); return;}
if(fwrite(shift_cmd_area, 1, shift_cmd_area_byte_count, file) != shift_cmd_area_byte_count){printf("%s%d\n", "error in line: ", __LINE__); return;}
file_header.number_of_load_cmds -= 1;
file_header.size_of_load_cmds -= *(uint32_t*)((long long)&cmd_base_data + 4);
set_macho_header(file, &file_header);
}
get_command_by_type(initial_file, 0x1d, &code_sign, 16);
if(code_sign.cmd_type == 0){printf("warning: file signature does not exist\n"); goto label2;}
ftruncate(fileno(resulting_file), link_edit.file_size + link_edit.file_off - code_sign.data_size);
delete_command_by_type(resulting_file, 0x1d);
link_edit.file_size -= code_sign.data_size;
link_edit.vmsize -= align(code_sign.data_size, 0x4000);
set_command_by_index(resulting_file, link_edit.NOT_REAL_FIELD_index, &link_edit, 72);