// File: /workspace/github_c_makefile_star2_O2/mikeakohn[P]print_pe/build/../src/file_header.c
// Function: file_header_print
int file_header_print(struct file_header_t *file_header)
{
  printf("---------------------------------------------\n");
  printf("Image File Header\n");
  printf("---------------------------------------------\n");

  const char *machine;

  switch (file_header->Machine)
  {
    case 0x14c: machine = "i386"; break;
    case 0x14d: machine = "i486"; break;
    case 0x14e: machine = "i586"; break;
    case 0x160: machine = "MIPS R3000 Big Endian"; break;
    case 0x162: machine = "MIPS R3000 Little Endian"; break;
    case 0x166: machine = "MIPS R4000 Little Endian"; break;
    case 0x168: machine = "MIPS R10000 Little Endian"; break;
    case 0x169: machine = "MIPS Little Endian WCE v2"; break;
    case 0x184: machine = "Alpha"; break;
    case 0x1a2: machine = "Hitachi SH3"; break;
    case 0x1a3: machine = "Hitachi SH3 DSP"; break;
    case 0x1a8: machine = "Hitachi SH5"; break;
    case 0x1c0: machine = "ARM Little Endian"; break;
    case 0x1c2: machine = "Thumb"; break;
    case 0x1c4: machine = "ARM Thumb-2 Little Endian"; break;
    case 0x1d3: machine = "Matsushita AM33"; break;
    case 0x1f0: machine = "PPC Little Endian"; break;
    case 0x1f1: machine = "PPC w/ FPU"; break;
    case 0x266: machine = "MIPS16"; break;
    case 0x366: machine = "MIPS w/ FPU"; break;
    case 0x466: machine = "MIPS16 w/ FPU"; break;
    case 0xebc: machine = "EFI Byte Code"; break;
    case 0x5032: machine = "RISC-V 32 bit"; break;
    case 0x5064: machine = "RISC-V 64 bit"; break;
    case 0x5128: machine = "RISC-V 128 bit"; break;
    case 0x8664: machine = "x64"; break;
    case 0xaa64: machine = "ARM64 Little Endian"; break;
    default: machine = "Unknown"; break;
  }

  printf("           Machine: 0x%04x (%s)\n", file_header->Machine, machine);
  printf("  NumberOfSections: %d\n", file_header->NumberOfSections);
  printf("     TimeDateStamp: %s", ctime((time_t *)&file_header->TimeDateStamp));
  printf("PointerToSymbolTbl: %d\n", file_header->PointerToSymbolTable);
  printf("   NumberOfSymbols: %d\n", file_header->NumberOfSymbols);
  printf(" SizeOfOptionalHdr: %d\n", file_header->SizeOfOptionalHeader);
  printf("   Characteristics: 0x%04x", file_header->Characteristics);
  if ((file_header->Characteristics & 0x0001) != 0)
  {
    printf(" (Relocations Stripped)");
  }

  if ((file_header->Characteristics & 0x0002) != 0)
  {
    printf(" (Executable Image)");
  }

  if ((file_header->Characteristics & 0x0004) != 0)
  {
    printf(" (Line Numbers Stripped)");
  }

  if ((file_header->Characteristics & 0x0008) != 0)
  {
    printf(" (File Local Symbols Stripped)");
  }

  if ((file_header->Characteristics & 0x0010) != 0)
  {
    printf(" (Agressively Trim Working Set)");
  }

  if ((file_header->Characteristics & 0x0020) != 0)
  {
    printf(" (Large Address Aware)");
  }

  if ((file_header->Characteristics & 0x0080) != 0)
  {
    printf(" (File Bytes Reversed)");
  }

  if ((file_header->Characteristics & 0x0100) != 0)
  {
    printf(" (32 Bit Machine)");
  }

  if ((file_header->Characteristics & 0x0400) != 0)
  {
    printf(" (File Removable, Run From Swap)");
  }

  if ((file_header->Characteristics & 0x0800) != 0)
  {
    printf(" (File Networked, Run From Swap)");
  }

  if ((file_header->Characteristics & 0x1000) != 0)
  {
    printf(" (File System Image)");
  }

  if ((file_header->Characteristics & 0x2000) != 0)
  {
    printf(" (Dynamic Link Library)");
  }

  if ((file_header->Characteristics & 0x4000) != 0)
  {
    printf(" (Uniprocessor Only)");
  }

  if ((file_header->Characteristics & 0x8000) != 0)
  {
    printf(" (File Bytes Reversed Hi)");
  }

  printf("\n\n");

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x35ef(%rip), %r14      # 0x8241
movq %r14, %rdi
callq 0x3060
leaq 0x4a43(%rip), %rdi      # 0x96a4
callq 0x3060
movq %r14, %rdi
callq 0x3060
movzwl (%rbx), %esi
leal -0x160(%rsi), %eax
cmpl $0x9, %eax
jbe 0x4d90
cmpl $0x14c, %esi            # imm = 0x14C
je 0x4e18
cmpl $0xaa64, %esi           # imm = 0xAA64
je 0x4df4
cmpl $0x14e, %esi            # imm = 0x14E
je 0x4e0c
cmpl $0x184, %esi            # imm = 0x184
je 0x4ea5
cmpl $0x1a2, %esi            # imm = 0x1A2
je 0x4e81
cmpl $0x1a3, %esi            # imm = 0x1A3
je 0x4e93
cmpl $0x1a8, %esi            # imm = 0x1A8
je 0x4de8
cmpl $0x1c0, %esi            # imm = 0x1C0
je 0x4eae
cmpl $0x1c2, %esi            # imm = 0x1C2
je 0x4e66
cmpl $0x1c4, %esi            # imm = 0x1C4
je 0x4e24
cmpl $0x1d3, %esi            # imm = 0x1D3
je 0x4e30
cmpl $0x1f0, %esi            # imm = 0x1F0
je 0x4e5d
cmpl $0x1f1, %esi            # imm = 0x1F1
je 0x4e4b
cmpl $0x266, %esi            # imm = 0x266
je 0x4e8a
cmpl $0x366, %esi            # imm = 0x366
je 0x4e9c
cmpl $0x466, %esi            # imm = 0x466
je 0x4e78
cmpl $0xebc, %esi            # imm = 0xEBC
je 0x4e6f
cmpl $0x5032, %esi           # imm = 0x5032
je 0x4e00
cmpl $0x5064, %esi           # imm = 0x5064
je 0x4e54
cmpl $0x5128, %esi           # imm = 0x5128
je 0x4e39
cmpl $0x8664, %esi           # imm = 0x8664
je 0x4e42
cmpl $0x14d, %esi            # imm = 0x14D
jne 0x4dac
leaq 0x4596(%rip), %rdx      # 0x9321
jmp 0x4eb5
leaq 0x455d(%rip), %rcx      # 0x92f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4584(%rip), %rdx      # 0x932b
jmp 0x4eb5
leaq 0x3eed(%rip), %rdx      # 0x8ca0
jmp 0x4eb5
leaq 0x45ce(%rip), %rdx      # 0x938d
jmp 0x4eb5
leaq 0x458f(%rip), %rdx      # 0x935a
jmp 0x4eb5
leaq 0x456a(%rip), %rdx      # 0x9341
jmp 0x4eb5
leaq 0x4590(%rip), %rdx      # 0x9373
jmp 0x4eb5
leaq 0x45da(%rip), %rdx      # 0x93c9
jmp 0x4eb5
leaq 0x4697(%rip), %rdx      # 0x9492
jmp 0x4eb5
leaq 0x465c(%rip), %rdx      # 0x9463
jmp 0x4eb5
leaq 0x4513(%rip), %rdx      # 0x9326
jmp 0x4eb5
leaq 0x44fd(%rip), %rdx      # 0x931c
jmp 0x4eb5
leaq 0x45c2(%rip), %rdx      # 0x93ed
jmp 0x4eb5
leaq 0x45d0(%rip), %rdx      # 0x9407
jmp 0x4eb5
leaq 0x463f(%rip), %rdx      # 0x947f
jmp 0x4eb5
leaq 0x4645(%rip), %rdx      # 0x948e
jmp 0x4eb5
leaq 0x45d7(%rip), %rdx      # 0x9429
jmp 0x4eb5
leaq 0x4616(%rip), %rdx      # 0x9471
jmp 0x4eb5
leaq 0x45b3(%rip), %rdx      # 0x9417
jmp 0x4eb5
leaq 0x457a(%rip), %rdx      # 0x93e7
jmp 0x4eb5
leaq 0x45df(%rip), %rdx      # 0x9455
jmp 0x4eb5
leaq 0x45c8(%rip), %rdx      # 0x9447
jmp 0x4eb5
leaq 0x4525(%rip), %rdx      # 0x93ad
jmp 0x4eb5
leaq 0x45a3(%rip), %rdx      # 0x9434
jmp 0x4eb5
leaq 0x451f(%rip), %rdx      # 0x93b9
jmp 0x4eb5
leaq 0x4598(%rip), %rdx      # 0x943b
jmp 0x4eb5
leaq 0x44fb(%rip), %rdx      # 0x93a7
jmp 0x4eb5
leaq 0x4520(%rip), %rdx      # 0x93d5
leaq 0x45ea(%rip), %rdi      # 0x94a6
xorl %eax, %eax
callq 0x3090
movzwl 0x2(%rbx), %esi
leaq 0x45f9(%rip), %rdi      # 0x94c7
xorl %eax, %eax
callq 0x3090
leaq 0x4(%rbx), %rdi
callq 0x3080
leaq 0x3e55(%rip), %rdi      # 0x8d3a
movq %rax, %rsi
xorl %eax, %eax
callq 0x3090
movl 0x8(%rbx), %esi
leaq 0x45e6(%rip), %rdi      # 0x94df
xorl %eax, %eax
callq 0x3090
movl 0xc(%rbx), %esi
leaq 0x45ed(%rip), %rdi      # 0x94f7
xorl %eax, %eax
callq 0x3090
movzwl 0x10(%rbx), %esi
leaq 0x45f3(%rip), %rdi      # 0x950f
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %esi
leaq 0x45f9(%rip), %rdi      # 0x9527
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x1, %al
je 0x4f4f
leaq 0x45fe(%rip), %rdi      # 0x9542
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x2, %al
je 0x4f65
leaq 0x4600(%rip), %rdi      # 0x955a
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x4, %al
je 0x4f7b
leaq 0x45fe(%rip), %rdi      # 0x956e
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x8, %al
je 0x4f91
leaq 0x4601(%rip), %rdi      # 0x9587
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x10, %al
je 0x4fa7
leaq 0x460a(%rip), %rdi      # 0x95a6
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x20, %al
je 0x4fbd
leaq 0x4614(%rip), %rdi      # 0x95c6
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb %al, %al
jns 0x4fd3
leaq 0x4615(%rip), %rdi      # 0x95dd
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0x8, %eax
jae 0x4feb
leaq 0x4614(%rip), %rdi      # 0x95f4
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xa, %eax
jae 0x5003
leaq 0x460e(%rip), %rdi      # 0x9606
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xb, %eax
jae 0x501b
leaq 0x4617(%rip), %rdi      # 0x9627
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xc, %eax
jae 0x5033
leaq 0x4620(%rip), %rdi      # 0x9648
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xd, %eax
jae 0x504b
leaq 0x461d(%rip), %rdi      # 0x965d
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xe, %eax
jae 0x5063
leaq 0x461d(%rip), %rdi      # 0x9675
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testw %ax, %ax
jns 0x5076
leaq 0x461b(%rip), %rdi      # 0x968a
xorl %eax, %eax
callq 0x3090
leaq 0x309d(%rip), %rdi      # 0x811a
callq 0x3060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq