// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_thread_context_x86
static void print_minidump_thread_context_x86(FILE *in)
{
  int n;

  printf("    context_flags: 0x%x\n", read_uint32(in));
  printf("    dr0: 0x%08x  dr1: 0x%08x  dr2: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in));
  printf("    dr3: 0x%08x  dr6: 0x%08x  dr7: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in));

  // Fsave flags.
  printf("    fcw: 0x%04x  reserved_1: 0x%04x\n",
    read_uint16(in), read_uint16(in));
  printf("    fsw: 0x%04x  reserved_2: 0x%04x\n",
    read_uint16(in), read_uint16(in));
  printf("    ftw: 0x%04x  reserved_3: 0x%04x\n",
    read_uint16(in), read_uint16(in));
  printf(" fpu_ip: 0x%08x  fpu_cs: 0x%04x  fop: 0x%04x\n",
    read_uint32(in), read_uint16(in), read_uint16(in));
  printf(" fpu_dp: 0x%08x  fpu_ds: 0x%04x  reserved_4: 0x%04x\n",
    read_uint32(in), read_uint16(in), read_uint16(in));

  for (n = 0; n < 8; n++)
  {
    printf("  st%d: 0x%08" PRIx64 " 0x%02x 0x%02x", n,
      read_uint64(in), read_uint8(in), read_uint8(in));
    if ((n & 1) == 1) { printf("\n"); }
  }

  printf(" spare_0: 0x%08x\n", read_uint32(in));

#if 0
  printf("     gs: 0x%08x   fs: 0x%08x   es: 0x%08x   ds: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("    edi: 0x%08x  esi: 0x%08x  ebx: 0x%08x  edx: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("    ecx: 0x%08x  eax: 0x%08x  ebp: 0x%08x  eip: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("     cs: 0x%08x eflg: 0x%08x  esp: 0x%08x   ss: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
#endif

  // This section seems to be undocumented.  I got some information
  // from Chromium's Crashpad, but their information seems to be wrong.
  // I got these values by taking their information, writing a program
  // in VisualStudio 2015 that in an _asm section sets an x87 float
  // register, xmm1, and ecx and made it dereference a NULL pointer.
  // In VisualStudio I dumped all the registers and rearranged these
  // based on those values.  Unfortunately, ds, gs, es, and ss were
  // the same so I'm not sure if those are mixed up.  Actually, it
  // looks like from left to right it was a mirror image.
  printf("     ds: 0x%08x   es: 0x%08x   fs: 0x%08x   gs: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("    edx: 0x%08x  ebx: 0x%08x  esi: 0x%08x  edi: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("    eip: 0x%08x  ebp: 0x%08x  eax: 0x%08x  ecx: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  printf("     ss: 0x%08x  esp: 0x%08x eflg: 0x%08x   cs: 0x%08x\n",
    read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));

  printf("    fcw: 0x%04x  fsw: 0x%04x ftw: 0x%02x reserved_1: 0x%02x\n",
    read_uint16(in), read_uint16(in), read_uint8(in), read_uint8(in));
  printf("    fop: 0x%04x  fpu_ip: 0x%08x\n",
    read_uint16(in), read_uint32(in));
  printf(" fpu_cs: 0x%04x  reserved_2: 0x%08x\n",
    read_uint16(in), read_uint16(in));
  printf(" fpu_dp: 0x%08x  fpu_ds: 0x%04x  reserved_3: 0x%04d\n",
    read_uint32(in), read_uint16(in), read_uint16(in));
  printf("  mxcsr: 0x%08x  mxcsr_mask: 0x%08x\n",
    read_uint32(in), read_uint32(in));

  for (n = 0; n < 8; n++)
  {
    printf("  mm%d: 0x%016" PRIx64, n, read_uint64(in));

    read_uint64(in);

    if ((n % 2) == 1) { printf("\n"); }
  }

  for (n = 0; n < 8; n++)
  {
    printf(" xmm%d: 0x%08x 0x%08x 0x%08x 0x%08x\n", n,
      read_uint32(in), read_uint32(in), read_uint32(in), read_uint32(in));
  }

  printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, %esi
leaq 0x1c58(%rip), %rdi      # 0x4d59
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x38(%rbp), %esi
movl -0x34(%rbp), %edx
movl %eax, %ecx
leaq 0x1c3a(%rip), %rdi      # 0x4d72
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
movl %eax, %ecx
leaq 0x1c2e(%rip), %rdi      # 0x4d9d
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x28(%rbp), %esi
movl %eax, %edx
leaq 0x1c31(%rip), %rdi      # 0x4dc8
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x24(%rbp), %esi
movl %eax, %edx
leaq 0x1c2e(%rip), %rdi      # 0x4ded
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x20(%rbp), %esi
movl %eax, %edx
leaq 0x1c2b(%rip), %rdi      # 0x4e12
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x1c(%rbp), %esi
movl -0x18(%rbp), %edx
movl %eax, %ecx
leaq 0x1c19(%rip), %rdi      # 0x4e37
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x14(%rbp), %esi
movl -0x10(%rbp), %edx
movl %eax, %ecx
leaq 0x1c10(%rip), %rdi      # 0x4e65
movb $0x0, %al
callq 0x1050
movl $0x0, -0xc(%rbp)
cmpl $0x8, -0xc(%rbp)
jge 0x32d2
movl -0xc(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1930
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1aa0
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1aa0
movl -0x4c(%rbp), %esi
movq -0x48(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl %eax, %r8d
leaq 0x1bf5(%rip), %rdi      # 0x4e9a
movb $0x0, %al
callq 0x1050
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x32c5
leaq 0xe3d(%rip), %rdi       # 0x40fb
movb $0x0, %al
callq 0x1050
jmp 0x32c7
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3263
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, %esi
leaq 0x1bd4(%rip), %rdi      # 0x4eb8
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x9c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x94(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x9c(%rbp), %esi
movl -0x98(%rbp), %edx
movl -0x94(%rbp), %ecx
movl %eax, %r8d
leaq 0x1b8d(%rip), %rdi      # 0x4eca
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x8c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x90(%rbp), %esi
movl -0x8c(%rbp), %edx
movl -0x88(%rbp), %ecx
movl %eax, %r8d
leaq 0x1b6c(%rip), %rdi      # 0x4f02
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x7c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x84(%rbp), %esi
movl -0x80(%rbp), %edx
movl -0x7c(%rbp), %ecx
movl %eax, %r8d
leaq 0x1b57(%rip), %rdi      # 0x4f3a
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %edx
movl -0x70(%rbp), %ecx
movl %eax, %r8d
leaq 0x1b48(%rip), %rdi      # 0x4f72
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1aa0
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1aa0
movl -0x6c(%rbp), %esi
movl -0x68(%rbp), %edx
movl -0x64(%rbp), %ecx
movl %eax, %r8d
leaq 0x1b39(%rip), %rdi      # 0x4faa
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x60(%rbp), %esi
movl %eax, %edx
leaq 0x1b4e(%rip), %rdi      # 0x4fe7
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x5c(%rbp), %esi
movl %eax, %edx
leaq 0x1b47(%rip), %rdi      # 0x5008
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a60
movl -0x58(%rbp), %esi
movl -0x54(%rbp), %edx
movl %eax, %ecx
leaq 0x1b35(%rip), %rdi      # 0x502d
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0x50(%rbp), %esi
movl %eax, %edx
leaq 0x1b42(%rip), %rdi      # 0x5062
movb $0x0, %al
callq 0x1050
movl $0x0, -0xc(%rbp)
cmpl $0x8, -0xc(%rbp)
jge 0x3591
movl -0xc(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1930
movl -0xa0(%rbp), %esi
movq %rax, %rdx
leaq 0x1b31(%rip), %rdi      # 0x5087
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1930
movl -0xc(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x3584
leaq 0xb7e(%rip), %rdi       # 0x40fb
movb $0x0, %al
callq 0x1050
jmp 0x3586
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x352e
movl $0x0, -0xc(%rbp)
cmpl $0x8, -0xc(%rbp)
jge 0x3612
movl -0xc(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0xac(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl %eax, -0xa4(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a00
movl -0xb0(%rbp), %esi
movl -0xac(%rbp), %edx
movl -0xa8(%rbp), %ecx
movl -0xa4(%rbp), %r8d
movl %eax, %r9d
leaq 0x1a98(%rip), %rdi      # 0x5098
movb $0x0, %al
callq 0x1050
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3598
leaq 0xae2(%rip), %rdi       # 0x40fb
movb $0x0, %al
callq 0x1050
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)