// File: /workspace/github_c_makefile_star2_O1/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 0x3567(%rip), %r14      # 0x8241
movq %r14, %rdi
callq 0x3060
leaq 0x49bb(%rip), %rdi      # 0x96a4
callq 0x3060
movq %r14, %rdi
callq 0x3060
movzwl (%rbx), %eax
movl %eax, %esi
cmpl $0x1c1, %eax            # imm = 0x1C1
jle 0x4d41
cmpl $0x465, %eax            # imm = 0x465
jg 0x4d7d
cmpl $0x1ef, %eax            # imm = 0x1EF
jle 0x4ded
cmpl $0x265, %eax            # imm = 0x265
jg 0x4e96
cmpl $0x1f0, %eax            # imm = 0x1F0
je 0x4f1e
cmpl $0x1f1, %eax            # imm = 0x1F1
jne 0x4f78
leaq 0x46ed(%rip), %rdx      # 0x9429
jmp 0x4f7f
cmpl $0x183, %eax            # imm = 0x183
jg 0x4db5
cmpl $0x15f, %eax            # imm = 0x15F
jle 0x4e47
addl $0xfffffea0, %eax       # imm = 0xFFFFFEA0
cmpl $0x9, %eax
ja 0x4f78
leaq 0x458c(%rip), %rcx      # 0x92f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x45b3(%rip), %rdx      # 0x932b
jmp 0x4f7f
cmpl $0x5063, %eax           # imm = 0x5063
jle 0x4e1a
cmpl $0x8663, %eax           # imm = 0x8663
jg 0x4eb8
cmpl $0x5064, %eax           # imm = 0x5064
je 0x4f27
cmpl $0x5128, %eax           # imm = 0x5128
jne 0x4f78
leaq 0x46cf(%rip), %rdx      # 0x947f
jmp 0x4f7f
cmpl $0x1a2, %eax            # imm = 0x1A2
jle 0x4e74
cmpl $0x1a3, %eax            # imm = 0x1A3
je 0x4f0c
cmpl $0x1a8, %eax            # imm = 0x1A8
je 0x4f03
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x4f78
leaq 0x45ed(%rip), %rdx      # 0x93d5
jmp 0x4f7f
cmpl $0x1c2, %eax            # imm = 0x1C2
je 0x4f5d
cmpl $0x1c4, %eax            # imm = 0x1C4
je 0x4f42
cmpl $0x1d3, %eax            # imm = 0x1D3
jne 0x4f78
leaq 0x45f2(%rip), %rdx      # 0x9407
jmp 0x4f7f
cmpl $0x466, %eax            # imm = 0x466
je 0x4f66
cmpl $0xebc, %eax            # imm = 0xEBC
je 0x4f4b
cmpl $0x5032, %eax           # imm = 0x5032
jne 0x4f78
leaq 0x4621(%rip), %rdx      # 0x9463
jmp 0x4f7f
cmpl $0x14c, %eax            # imm = 0x14C
je 0x4f6f
cmpl $0x14d, %eax            # imm = 0x14D
je 0x4f54
cmpl $0x14e, %eax            # imm = 0x14E
jne 0x4f78
leaq 0x44b7(%rip), %rdx      # 0x9326
jmp 0x4f7f
cmpl $0x184, %eax            # imm = 0x184
je 0x4f15
cmpl $0x1a2, %eax            # imm = 0x1A2
jne 0x4f78
leaq 0x451c(%rip), %rdx      # 0x93ad
jmp 0x4f7f
cmpl $0x266, %eax            # imm = 0x266
je 0x4f30
cmpl $0x366, %eax            # imm = 0x366
jne 0x4f78
leaq 0x4588(%rip), %rdx      # 0x943b
jmp 0x4f7f
cmpl $0x8664, %eax           # imm = 0x8664
je 0x4f39
cmpl $0xaa64, %eax           # imm = 0xAA64
jne 0x4f78
leaq 0x45c1(%rip), %rdx      # 0x9492
jmp 0x4f7f
leaq 0x4496(%rip), %rdx      # 0x9373
jmp 0x4f7f
leaq 0x4458(%rip), %rdx      # 0x9341
jmp 0x4f7f
leaq 0x4498(%rip), %rdx      # 0x938d
jmp 0x4f7f
leaq 0x4459(%rip), %rdx      # 0x935a
jmp 0x4f7f
leaq 0x44bf(%rip), %rdx      # 0x93c9
jmp 0x4f7f
leaq 0x44a6(%rip), %rdx      # 0x93b9
jmp 0x4f7f
leaq 0x448b(%rip), %rdx      # 0x93a7
jmp 0x4f7f
leaq 0x44f2(%rip), %rdx      # 0x9417
jmp 0x4f7f
leaq 0x4543(%rip), %rdx      # 0x9471
jmp 0x4f7f
leaq 0x44fd(%rip), %rdx      # 0x9434
jmp 0x4f7f
leaq 0x454e(%rip), %rdx      # 0x948e
jmp 0x4f7f
leaq 0x44a4(%rip), %rdx      # 0x93ed
jmp 0x4f7f
leaq 0x4503(%rip), %rdx      # 0x9455
jmp 0x4f7f
leaq 0x43c6(%rip), %rdx      # 0x9321
jmp 0x4f7f
leaq 0x4483(%rip), %rdx      # 0x93e7
jmp 0x4f7f
leaq 0x44da(%rip), %rdx      # 0x9447
jmp 0x4f7f
leaq 0x43a6(%rip), %rdx      # 0x931c
jmp 0x4f7f
leaq 0x3d21(%rip), %rdx      # 0x8ca0
leaq 0x4520(%rip), %rdi      # 0x94a6
xorl %eax, %eax
callq 0x3090
movzwl 0x2(%rbx), %esi
leaq 0x452f(%rip), %rdi      # 0x94c7
xorl %eax, %eax
callq 0x3090
leaq 0x4(%rbx), %rdi
callq 0x3080
leaq 0x3d8b(%rip), %rdi      # 0x8d3a
movq %rax, %rsi
xorl %eax, %eax
callq 0x3090
movl 0x8(%rbx), %esi
leaq 0x451c(%rip), %rdi      # 0x94df
xorl %eax, %eax
callq 0x3090
movl 0xc(%rbx), %esi
leaq 0x4523(%rip), %rdi      # 0x94f7
xorl %eax, %eax
callq 0x3090
movzwl 0x10(%rbx), %esi
leaq 0x4529(%rip), %rdi      # 0x950f
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %esi
leaq 0x452f(%rip), %rdi      # 0x9527
xorl %eax, %eax
callq 0x3090
testb $0x1, 0x12(%rbx)
je 0x5013
leaq 0x4536(%rip), %rdi      # 0x9542
xorl %eax, %eax
callq 0x3090
testb $0x2, 0x12(%rbx)
je 0x5027
leaq 0x453a(%rip), %rdi      # 0x955a
xorl %eax, %eax
callq 0x3090
testb $0x4, 0x12(%rbx)
je 0x503b
leaq 0x453a(%rip), %rdi      # 0x956e
xorl %eax, %eax
callq 0x3090
testb $0x8, 0x12(%rbx)
je 0x504f
leaq 0x453f(%rip), %rdi      # 0x9587
xorl %eax, %eax
callq 0x3090
testb $0x10, 0x12(%rbx)
je 0x5063
leaq 0x454a(%rip), %rdi      # 0x95a6
xorl %eax, %eax
callq 0x3090
testb $0x20, 0x12(%rbx)
je 0x5077
leaq 0x4556(%rip), %rdi      # 0x95c6
xorl %eax, %eax
callq 0x3090
testb $-0x80, 0x12(%rbx)
je 0x508b
leaq 0x4559(%rip), %rdi      # 0x95dd
xorl %eax, %eax
callq 0x3090
testb $0x1, 0x13(%rbx)
je 0x509f
leaq 0x455c(%rip), %rdi      # 0x95f4
xorl %eax, %eax
callq 0x3090
testb $0x4, 0x13(%rbx)
je 0x50b3
leaq 0x455a(%rip), %rdi      # 0x9606
xorl %eax, %eax
callq 0x3090
testb $0x8, 0x13(%rbx)
je 0x50c7
leaq 0x4567(%rip), %rdi      # 0x9627
xorl %eax, %eax
callq 0x3090
testb $0x10, 0x13(%rbx)
je 0x50db
leaq 0x4574(%rip), %rdi      # 0x9648
xorl %eax, %eax
callq 0x3090
testb $0x20, 0x13(%rbx)
je 0x50ef
leaq 0x4575(%rip), %rdi      # 0x965d
xorl %eax, %eax
callq 0x3090
testb $0x40, 0x13(%rbx)
je 0x5103
leaq 0x4579(%rip), %rdi      # 0x9675
xorl %eax, %eax
callq 0x3090
cmpw $0x0, 0x12(%rbx)
jns 0x5118
leaq 0x4579(%rip), %rdi      # 0x968a
xorl %eax, %eax
callq 0x3090
leaq 0x2ffb(%rip), %rdi      # 0x811a
callq 0x3060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop