// File: /workspace/github_c_makefile_star2_O2/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_version_info
int parse_version_info(FILE *in, long offset, int size)
{
  struct fixed_file_info_t fixed_file_info;
  long marker;
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len;

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

  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

#if 0
fseek(in, offset, SEEK_SET);
//char buffer[2192];
char buffer[wLength];
fread(buffer, 1, sizeof(buffer), in);
fclose(in);

FILE *fp = fopen("vs_versionfinfo.bin", "wb");
fwrite(buffer, 1, sizeof(buffer), fp);
fclose(fp);
exit(0);
#endif

  len += read_padding(in, len);
  len += read_fixed_file_info(in, &fixed_file_info);
  print_fixed_file_info(&fixed_file_info);
  len += read_padding(in, len);

  while (len < wLength)
  {
    len += parse_x_file_info(in);
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, %r14
movq %rdi, %rbx
callq 0x30f0
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3110
leaq 0x24(%rsp), %r14
leaq 0x22(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x1f0(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6198
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
callq 0x62ae
movl %eax, %r12d
leaq 0x3c(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x62d4
movl %ebp, %r15d
addl %r12d, %r15d
addl %r12d, %ebp
addl $0x34, %ebp
movq %r13, %rdi
callq 0x6374
movq %rbx, %rdi
movl %ebp, %esi
callq 0x62ae
leal (%rax,%r15), %ebp
addl $0x34, %ebp
movzwl (%r14), %eax
movl %eax, 0x14(%rsp)
leaq 0x70(%rsp), %r14
cmpl 0x14(%rsp), %ebp
jge 0x6175
leaq 0x4360(%rip), %rdi      # 0xa342
callq 0x3060
movq %rbx, %rdi
leaq 0xe(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x26(%rsp), %rcx
movq %r14, %r8
callq 0x6198
movl %eax, 0x8(%rsp)
movq %r14, %rdi
leaq 0x42e1(%rip), %rsi      # 0xa2f0
pushq $0xf
popq %rdx
callq 0x3100
testl %eax, %eax
movl %ebp, 0x18(%rsp)
je 0x6046
movq %r14, %rdi
leaq 0x42d6(%rip), %rsi      # 0xa2ff
pushq $0xc
popq %rdx
callq 0x3100
testl %eax, %eax
je 0x6119
movzwl 0xe(%rsp), %ebp
addl $-0x4, %ebp
jmp 0x6164
leaq 0x430d(%rip), %rdi      # 0xa35a
callq 0x3060
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x2c(%rsp), %rdx
leaq 0x2a(%rsp), %rcx
leaq 0xf0(%rsp), %r8
callq 0x6198
movl %eax, %ebp
movzwl 0x10(%rsp), %eax
movl %eax, 0x1c(%rsp)
cmpl 0x1c(%rsp), %ebp
jge 0x6164
leaq 0x42f1(%rip), %rdi      # 0xa37e
callq 0x3060
movq %rbx, %rdi
leaq 0x12(%rsp), %rsi
leaq 0x6(%rsp), %rdx
leaq 0x2e(%rsp), %rcx
leaq 0x170(%rsp), %r8
callq 0x6198
movl %eax, %r12d
leaq 0x4250(%rip), %rdi      # 0xa30b
xorl %eax, %eax
callq 0x3090
movzwl 0x6(%rsp), %r13d
movl %r13d, %r14d
subl $0x1, %r14d
jb 0x60f4
movq %rbx, %rdi
callq 0x3160
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3160
shll $0x8, %eax
orl %eax, %r15d
movl %r15d, %edi
callq 0x3030
jmp 0x60cb
leal (%r12,%r13,2), %r15d
leaq 0x201b(%rip), %rdi      # 0x811a
callq 0x3060
movq %rbx, %rdi
movl %r15d, %esi
callq 0x62ae
addl %r15d, %ebp
addl %eax, %ebp
jmp 0x607c
leaq 0x4250(%rip), %rdi      # 0xa370
callq 0x3060
movq %rbx, %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x12(%rsp), %rdx
leaq 0x6(%rsp), %rcx
leaq 0x170(%rsp), %r8
callq 0x6198
movl %eax, %ebp
movq %rbx, %rdi
callq 0x5126
leaq 0x41bd(%rip), %rdi      # 0xa315
movl %eax, %esi
xorl %eax, %eax
callq 0x3090
addl $0x4, %ebp
movl 0x8(%rsp), %eax
addl 0x18(%rsp), %eax
addl %ebp, %eax
movl %eax, %ebp
jmp 0x5fcc
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
callq 0x3110
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq