// File: /workspace/github_c_makefile_star2_O3/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 0x35ab(%rip), %r14      # 0x8241
movq %r14, %rdi
callq 0x3060
leaq 0x49ff(%rip), %rdi      # 0x96a4
callq 0x3060
movq %r14, %rdi
callq 0x3060
movzwl (%rbx), %eax
movl %eax, %esi
cmpl $0x1c1, %eax            # imm = 0x1C1
jle 0x4cfd
cmpl $0x465, %eax            # imm = 0x465
jg 0x4d39
cmpl $0x1ef, %eax            # imm = 0x1EF
jle 0x4da9
cmpl $0x265, %eax            # imm = 0x265
jg 0x4e52
cmpl $0x1f0, %eax            # imm = 0x1F0
je 0x4eda
cmpl $0x1f1, %eax            # imm = 0x1F1
jne 0x4f34
leaq 0x4731(%rip), %rdx      # 0x9429
jmp 0x4f3b
cmpl $0x183, %eax            # imm = 0x183
jg 0x4d71
cmpl $0x15f, %eax            # imm = 0x15F
jle 0x4e03
addl $0xfffffea0, %eax       # imm = 0xFFFFFEA0
cmpl $0x9, %eax
ja 0x4f34
leaq 0x45d0(%rip), %rcx      # 0x92f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x45f7(%rip), %rdx      # 0x932b
jmp 0x4f3b
cmpl $0x5063, %eax           # imm = 0x5063
jle 0x4dd6
cmpl $0x8663, %eax           # imm = 0x8663
jg 0x4e74
cmpl $0x5064, %eax           # imm = 0x5064
je 0x4ee3
cmpl $0x5128, %eax           # imm = 0x5128
jne 0x4f34
leaq 0x4713(%rip), %rdx      # 0x947f
jmp 0x4f3b
cmpl $0x1a2, %eax            # imm = 0x1A2
jle 0x4e30
cmpl $0x1a3, %eax            # imm = 0x1A3
je 0x4ec8
cmpl $0x1a8, %eax            # imm = 0x1A8
je 0x4ebf
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x4f34
leaq 0x4631(%rip), %rdx      # 0x93d5
jmp 0x4f3b
cmpl $0x1c2, %eax            # imm = 0x1C2
je 0x4f19
cmpl $0x1c4, %eax            # imm = 0x1C4
je 0x4efe
cmpl $0x1d3, %eax            # imm = 0x1D3
jne 0x4f34
leaq 0x4636(%rip), %rdx      # 0x9407
jmp 0x4f3b
cmpl $0x466, %eax            # imm = 0x466
je 0x4f22
cmpl $0xebc, %eax            # imm = 0xEBC
je 0x4f07
cmpl $0x5032, %eax           # imm = 0x5032
jne 0x4f34
leaq 0x4665(%rip), %rdx      # 0x9463
jmp 0x4f3b
cmpl $0x14c, %eax            # imm = 0x14C
je 0x4f2b
cmpl $0x14d, %eax            # imm = 0x14D
je 0x4f10
cmpl $0x14e, %eax            # imm = 0x14E
jne 0x4f34
leaq 0x44fb(%rip), %rdx      # 0x9326
jmp 0x4f3b
cmpl $0x184, %eax            # imm = 0x184
je 0x4ed1
cmpl $0x1a2, %eax            # imm = 0x1A2
jne 0x4f34
leaq 0x4560(%rip), %rdx      # 0x93ad
jmp 0x4f3b
cmpl $0x266, %eax            # imm = 0x266
je 0x4eec
cmpl $0x366, %eax            # imm = 0x366
jne 0x4f34
leaq 0x45cc(%rip), %rdx      # 0x943b
jmp 0x4f3b
cmpl $0x8664, %eax           # imm = 0x8664
je 0x4ef5
cmpl $0xaa64, %eax           # imm = 0xAA64
jne 0x4f34
leaq 0x4605(%rip), %rdx      # 0x9492
jmp 0x4f3b
leaq 0x44da(%rip), %rdx      # 0x9373
jmp 0x4f3b
leaq 0x449c(%rip), %rdx      # 0x9341
jmp 0x4f3b
leaq 0x44dc(%rip), %rdx      # 0x938d
jmp 0x4f3b
leaq 0x449d(%rip), %rdx      # 0x935a
jmp 0x4f3b
leaq 0x4503(%rip), %rdx      # 0x93c9
jmp 0x4f3b
leaq 0x44ea(%rip), %rdx      # 0x93b9
jmp 0x4f3b
leaq 0x44cf(%rip), %rdx      # 0x93a7
jmp 0x4f3b
leaq 0x4536(%rip), %rdx      # 0x9417
jmp 0x4f3b
leaq 0x4587(%rip), %rdx      # 0x9471
jmp 0x4f3b
leaq 0x4541(%rip), %rdx      # 0x9434
jmp 0x4f3b
leaq 0x4592(%rip), %rdx      # 0x948e
jmp 0x4f3b
leaq 0x44e8(%rip), %rdx      # 0x93ed
jmp 0x4f3b
leaq 0x4547(%rip), %rdx      # 0x9455
jmp 0x4f3b
leaq 0x440a(%rip), %rdx      # 0x9321
jmp 0x4f3b
leaq 0x44c7(%rip), %rdx      # 0x93e7
jmp 0x4f3b
leaq 0x451e(%rip), %rdx      # 0x9447
jmp 0x4f3b
leaq 0x43ea(%rip), %rdx      # 0x931c
jmp 0x4f3b
leaq 0x3d65(%rip), %rdx      # 0x8ca0
leaq 0x4564(%rip), %rdi      # 0x94a6
xorl %eax, %eax
callq 0x3090
movzwl 0x2(%rbx), %esi
leaq 0x4573(%rip), %rdi      # 0x94c7
xorl %eax, %eax
callq 0x3090
leaq 0x4(%rbx), %rdi
callq 0x3080
leaq 0x3dcf(%rip), %rdi      # 0x8d3a
movq %rax, %rsi
xorl %eax, %eax
callq 0x3090
movl 0x8(%rbx), %esi
leaq 0x4560(%rip), %rdi      # 0x94df
xorl %eax, %eax
callq 0x3090
movl 0xc(%rbx), %esi
leaq 0x4567(%rip), %rdi      # 0x94f7
xorl %eax, %eax
callq 0x3090
movzwl 0x10(%rbx), %esi
leaq 0x456d(%rip), %rdi      # 0x950f
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %esi
leaq 0x4573(%rip), %rdi      # 0x9527
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x1, %al
je 0x4fd5
leaq 0x4578(%rip), %rdi      # 0x9542
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x2, %al
je 0x4feb
leaq 0x457a(%rip), %rdi      # 0x955a
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x4, %al
je 0x5001
leaq 0x4578(%rip), %rdi      # 0x956e
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x8, %al
je 0x5017
leaq 0x457b(%rip), %rdi      # 0x9587
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x10, %al
je 0x502d
leaq 0x4584(%rip), %rdi      # 0x95a6
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb $0x20, %al
je 0x5043
leaq 0x458e(%rip), %rdi      # 0x95c6
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testb %al, %al
jns 0x5059
leaq 0x458f(%rip), %rdi      # 0x95dd
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0x8, %eax
jae 0x5071
leaq 0x458e(%rip), %rdi      # 0x95f4
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xa, %eax
jae 0x5089
leaq 0x4588(%rip), %rdi      # 0x9606
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xb, %eax
jae 0x50a1
leaq 0x4591(%rip), %rdi      # 0x9627
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xc, %eax
jae 0x50b9
leaq 0x459a(%rip), %rdi      # 0x9648
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xd, %eax
jae 0x50d1
leaq 0x4597(%rip), %rdi      # 0x965d
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
btl $0xe, %eax
jae 0x50e9
leaq 0x4597(%rip), %rdi      # 0x9675
xorl %eax, %eax
callq 0x3090
movzwl 0x12(%rbx), %eax
testw %ax, %ax
jns 0x50fc
leaq 0x4595(%rip), %rdi      # 0x968a
xorl %eax, %eax
callq 0x3090
leaq 0x3017(%rip), %rdi      # 0x811a
callq 0x3060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop