// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/cil.c
// Function: read_clr_header
int read_clr_header(FILE *in, struct _clr_header *clr_header, int address, int size, struct section_header_t *section_header)
{
  long marker;
  uint32_t virtual_address, raw_ptr;

  virtual_address = section_header->VirtualAddress;
  raw_ptr = section_header->PointerToRawData;

  address = (address - virtual_address) + raw_ptr;

  marker = ftell(in);
  fseek(in, address, SEEK_SET);

  clr_header->header_size = read_uint32(in);
  clr_header->major_runtime_version = read_uint16(in);
  clr_header->minor_runtime_version = read_uint16(in);
  clr_header->meta_data_directory_address = read_uint32(in);
  clr_header->meta_data_directory_size = read_uint32(in);
  clr_header->flags = read_uint32(in);
  clr_header->entry_point_token = read_uint32(in);
  clr_header->resources_directory_address = read_uint32(in);
  clr_header->resources_directory_size = read_uint32(in);
  clr_header->strong_name_signature_address = read_uint32(in);
  clr_header->strong_name_signature_size = read_uint32(in);
  clr_header->v_table_fixups_address = read_uint32(in);
  clr_header->v_table_fixups_size = read_uint32(in);
  clr_header->export_address_table_jump_address = read_uint32(in);
  clr_header->export_address_table_jump_size = read_uint32(in);
  clr_header->managed_native_header_address = read_uint32(in);
  clr_header->managed_native_header_size = read_uint32(in);

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x14(%rbp), %eax
subl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x14(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)