#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *ifp;
  FILE *ofp;
  int i;
  int n;
  int count = 0;
  unsigned char buffer[1024];
  if (argc != 4) {
    fprintf(stderr, "Usage: %s <input> <output> <array>\n", argv[0]);
    return 1;
  }
  ifp = fopen(argv[1], "rb");
  if (!ifp) {
    fprintf(stderr, "Cannot open input file: \"%s\"\n", argv[1]);
    return 2;
  }
  ofp = fopen(argv[2], "w");
  if (!ofp) {
    fprintf(stderr, "Cannot open output file: \"%s\"\n", argv[2]);
    fclose(ifp);
    return 2;
  }
  fprintf(ofp, "/*============================================================="
               "============\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "  Program:   Visualization Toolkit\n");
  fprintf(ofp, "  Module:    vtkEncodeExecutable.c\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n");
  fprintf(ofp, "  All rights reserved.\n");
  fprintf(ofp, "  See Copyright.txt or http://www.kitware.com/Copyright.htm "
               "for details.\n");
  fprintf(ofp, "\n");
  fprintf(
      ofp,
      "     This software is distributed WITHOUT ANY WARRANTY; without even\n");
  fprintf(ofp, "     the implied warranty of MERCHANTABILITY or FITNESS FOR A "
               "PARTICULAR\n");
  fprintf(
      ofp,
      "     PURPOSE.  See the above copyright notice for more information.\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "==============================================================="
               "==========*/\n");
  fprintf(ofp, "/*\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "DO NOT EDIT\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "This file is generated by running CMake on\n");
  fprintf(ofp, "VTK/Utilities/OutputWindowProcess as a separate project using "
               "a Visual\n");
  fprintf(
      ofp,
      "Studio generator.  The program built in that project works only when\n");
  fprintf(
      ofp,
      "compiled by the Visual Studio compiler because it depends on being\n");
  fprintf(ofp, "able to manipulate the stack frame of another process.  See\n");
  fprintf(
      ofp,
      "VTK/Utilities/OutputWindowProcess/README.txt for more information.\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "This file contains an encoded executable that can be written "
               "to disk using\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "  int vtkEncodedArrayWin32OutputWindowProcessWrite(const char* "
               "fname);\n");
  fprintf(ofp, "\n");
  fprintf(ofp,
          "It returns 1 for success and 0 for failure.  The executable is\n");
  fprintf(ofp,
          "self-deleting and therefore can be run only once.  It is used by\n");
  fprintf(ofp, "vtkWin32ProcessOutputWindow.\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "*/\n");
  fprintf(ofp, "\n");
  fprintf(ofp, "#include <stdio.h>\n\n");
  while ((n = (int)fread(buffer, 1, 1024, ifp)) > 0) {
    fprintf(ofp, "static unsigned char vtkEncodedArray%s_%d[%d] = {\n", argv[3],
            count++, n);
    for (i = 0; i < n - 1; ++i) {
      fprintf(ofp, "0x%02X", buffer[i]);
      if (i % 10 == 9) {
        fprintf(ofp, ",\n");
      } else {
        fprintf(ofp, ", ");
      }
    }
    fprintf(ofp, "0x%02X};\n\n", buffer[n - 1]);
  }
  fclose(ifp);
  fprintf(ofp, "extern int vtkEncodedArray%sWrite(const char* fname)\n",
          argv[3]);
  fprintf(ofp, "{\n");
  fprintf(ofp, "  FILE* ofp = fopen(fname, \"wb\");\n");
  fprintf(ofp, "  if(!ofp) { return 0; }\n");
  for (i = 0; i < count; ++i) {
    fprintf(ofp,
            "  if(fwrite(vtkEncodedArray%s_%d, 1,\n"
            "            sizeof(vtkEncodedArray%s_%d), ofp) !=\n"
            "       sizeof(vtkEncodedArray%s_%d))\n",
            argv[3], i, argv[3], i, argv[3], i);
    fprintf(ofp, "    {\n");
    fprintf(ofp, "    fclose(ofp);\n");
    fprintf(ofp, "    _unlink(fname);\n");
    fprintf(ofp, "    return 0;\n");
    fprintf(ofp, "    }\n");
  }
  fprintf(ofp, "  fclose(ofp);\n");
  fprintf(ofp, "  return 1;\n");
  fprintf(ofp, "}\n");
  fclose(ofp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1195 <main+0x55>
mov    0x2e6f(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1716 <main+0x5d6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe80(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e4 <main+0xa4>
mov    0x2e21(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1716 <main+0x5d6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123c <main+0xfc>
mov    0x2dd2(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe27(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x2,-0x4(%rbp)
jmp    1716 <main+0x5d6>
mov    -0x20(%rbp),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1383(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x134d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1305(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf1b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x12bd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf3c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf77(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1287(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1263(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf40(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf5a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf90(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xfc4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xff6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1021(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x11e5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1041(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x11c1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1069(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x119d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x108d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10bb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10eb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1155(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe1d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1131(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10c1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jle    15c0 <main+0x480>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x2c(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%r8d
lea    0x1087(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1599 <main+0x459>
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
movzbl -0x430(%rbp,%rax,1),%edx
ff
lea    0x1084(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x9,%edx
jne    1574 <main+0x434>
mov    -0x20(%rbp),%rdi
lea    0x1065(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1586 <main+0x446>
mov    -0x20(%rbp),%rdi
lea    0x1051(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    158b <main+0x44b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    151a <main+0x3da>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x430(%rbp,%rax,1),%edx
ff
lea    0x101f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    14c4 <main+0x384>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0x1002(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10e4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1014(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1025(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    16d0 <main+0x590>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r8
mov    -0x24(%rbp),%r9d
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r10
mov    -0x24(%rbp),%eax
lea    0xff8(%rip),%rsi
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x105b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1050(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1050(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1053(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1050(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1620 <main+0x4e0>
mov    -0x20(%rbp),%rdi
lea    0xffc(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1025(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1010(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%rbp
cmp    $0x4,%edi
jne    15fa <main+0x49a>
mov    0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1620 <main+0x4c0>
mov    0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1646 <main+0x4e6>
mov    %rax,%r14
mov    %rbp,0x18(%rsp)
lea    0xea3(%rip),%rdi
mov    $0x4c,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xeca(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xed5(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xed3(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xef5(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xef4(%rip),%rdi
mov    $0x49,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xf18(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf45(%rip),%rdi
mov    $0x49,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf76(%rip),%rdi
mov    $0x44,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xf95(%rip),%rdi
mov    $0x4c,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xfc9(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xfa7(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xf8e(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xfa1(%rip),%rdi
mov    $0x47,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xfd0(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xffd(%rip),%rdi
mov    $0x43,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x1028(%rip),%rdi
mov    $0x3c,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x104c(%rip),%rdi
mov    $0x43,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0x106a(%rip),%rdi
mov    $0x4b,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0x1090(%rip),%rdi
mov    $0x47,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0x10b2(%rip),%rdi
mov    $0x3f,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x10d9(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x1102(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0xe32(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
lea    0x10d4(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    0x8(%rsp),%rcx
call   1030 <fread@plt>
mov    %rax,%r15
test   %r15d,%r15d
jle    1676 <main+0x516>
lea    0x10e5(%rip),%rbx
lea    0x10e1(%rip),%rbp
xor    %r12d,%r12d
jmp    1549 <main+0x3e9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x14(%rsp),%r12d
add    $0x1,%r12d
mov    0x20(%rsp),%rax
movzbl 0x30(%rsp,%rax,1),%edx
mov    %r14,%rdi
lea    0x10b6(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    0x8(%rsp),%rcx
call   1030 <fread@plt>
mov    %rax,%r15
test   %r15d,%r15d
jle    1679 <main+0x519>
mov    0x18(%rsp),%rax
mov    0x18(%rax),%rdx
mov    %r14,%rdi
lea    0x1037(%rip),%rsi
mov    %r12d,0x14(%rsp)
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
movslq %r15d,%rax
lea    -0x1(%rax),%rcx
mov    %rcx,0x20(%rsp)
cmp    $0x2,%eax
mov    $0xcccccccd,%ecx
lea    0x103d(%rip),%r13
jb     1500 <main+0x3a0>
mov    0x20(%rsp),%eax
mov    %rax,0x28(%rsp)
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    %r15d,%eax
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,1),%r12d
add    $0x9,%r12d
movzbl 0x30(%rsp,%r15,1),%edx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    %r15d,%r12d
mov    %rbp,%rdi
cmove  %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xcccccccd,%ecx
add    $0x1,%r15
cmp    %r15,0x28(%rsp)
jne    15a0 <main+0x440>
jmp    1500 <main+0x3a0>
mov    0x29df(%rip),%rax
movslq (%rax),%rdi
mov    0x0(%rbp),%rdx
lea    0x9f1(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    1808 <main+0x6a8>
mov    0x29b9(%rip),%rax
movslq (%rax),%rdi
mov    0x8(%rbp),%rdx
lea    0x9f2(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x2,%eax
jmp    1808 <main+0x6a8>
mov    0x2993(%rip),%rax
movslq (%rax),%rdi
mov    0x10(%rbp),%rdx
lea    0x9ec(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    $0x2,%eax
jmp    1808 <main+0x6a8>
xor    %r12d,%r12d
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x18(%rsp),%r13
mov    0x18(%r13),%rdx
lea    0xf4b(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x102e(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf57(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf61(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
test   %r12d,%r12d
je     17b3 <main+0x653>
mov    %r12d,%ebx
lea    0x1001(%rip),%r15
lea    0x1009(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%r13),%rdx
mov    %r14,%rdi
lea    0xf33(%rip),%rsi
mov    %ebp,%ecx
mov    %rdx,%r8
mov    %ebp,%r9d
xor    %eax,%eax
push   %rbp
push   %rdx
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xf8a(%rip),%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0x11,%esi
mov    $0x1,%edx
lea    0xf78(%rip),%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0x14,%esi
mov    $0x1,%edx
lea    0xf71(%rip),%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0x6,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1710 <main+0x5b0>
lea    0xf1d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf3f(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf23(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s <input> <output> <array>\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [30 x i8] c"Cannot open input file: \22%s\22\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [31 x i8] c"Cannot open output file: \22%s\22\0A\00"
@.str.5 = [77 x i8] c"/*=========================================================================\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [36 x i8] c" Program: Visualization Toolkit\0A\00"
@.str.8 = [36 x i8] c" Module: vtkEncodeExecutable.c\0A\00"
@.str.9 = [59 x i8] c" Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\0A\00"
@.str.10 = [24 x i8] c" All rights reserved.\0A\00"
@.str.11 = [74 x i8] c" See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\0A\00"
@.str.12 = [70 x i8] c" This software is distributed WITHOUT ANY WARRANTY; without even\0A\00"
@.str.13 = [74 x i8] c" the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\0A\00"
@.str.14 = [69 x i8] c" PURPOSE. See the above copyright notice for more information.\0A\00"
@.str.15 = [77 x i8] c"=========================================================================*/\0A\00"
@.str.16 = [4 x i8] c"/*\0A\00"
@.str.17 = [13 x i8] c"DO NOT EDIT\0A\00"
@.str.18 = [44 x i8] c"This file is generated by running CMake on\0A\00"
@.str.19 = [72 x i8] c"VTK/Utilities/OutputWindowProcess as a separate project using a Visual\0A\00"
@.str.20 = [70 x i8] c"Studio generator. The program built in that project works only when\0A\00"
@.str.21 = [68 x i8] c"compiled by the Visual Studio compiler because it depends on being\0A\00"
@.str.22 = [61 x i8] c"able to manipulate the stack frame of another process. See\0A\00"
@.str.23 = [68 x i8] c"VTK/Utilities/OutputWindowProcess/README.txt for more information.\0A\00"
@.str.24 = [76 x i8] c"This file contains an encoded executable that can be written to disk using\0A\00"
@.str.25 = [72 x i8] c" int vtkEncodedArrayWin32OutputWindowProcessWrite(const char* fname);\0A\00"
@.str.26 = [64 x i8] c"It returns 1 for success and 0 for failure. The executable is\0A\00"
@.str.27 = [66 x i8] c"self-deleting and therefore can be run only once. It is used by\0A\00"
@.str.28 = [30 x i8] c"vtkWin32ProcessOutputWindow.\0A\00"
@.str.29 = [4 x i8] c"*/\0A\00"
@.str.30 = [21 x i8] c"#include <stdio.h>\0A\0A\00"
@.str.31 = [51 x i8] c"static unsigned char vtkEncodedArray%s_%d[%d] = {\0A\00"
@.str.32 = [7 x i8] c"0x%02X\00"
@.str.33 = [3 x i8] c",\0A\00"
@.str.34 = [3 x i8] c", \00"
@.str.35 = [11 x i8] c"0x%02X};\0A\0A\00"
@.str.36 = [54 x i8] c"extern int vtkEncodedArray%sWrite(const char* fname)\0A\00"
@.str.37 = [3 x i8] c"{\0A\00"
@.str.38 = [35 x i8] c" FILE* ofp = fopen(fname, \22wb\22);\0A\00"
@.str.39 = [26 x i8] c" if(!ofp) { return 0; }\0A\00"
@.str.40 = [125 x i8] c" if(fwrite(vtkEncodedArray%s_%d, 1,\0A sizeof(vtkEncodedArray%s_%d), ofp) !=\0A sizeof(vtkEncodedArray%s_%d))\0A\00"
@.str.41 = [7 x i8] c" {\0A\00"
@.str.42 = [18 x i8] c" fclose(ofp);\0A\00"
@.str.43 = [21 x i8] c" _unlink(fname);\0A\00"
@.str.44 = [15 x i8] c" return 0;\0A\00"
@.str.45 = [7 x i8] c" }\0A\00"
@.str.46 = [16 x i8] c" fclose(ofp);\0A\00"
@.str.47 = [13 x i8] c" return 1;\0A\00"
@.str.48 = [3 x i8] c"}\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %22
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %232
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %6
%27 = load i32*, i32** %6
%28 = icmp ne i32* %27, null
br i1 %28, label %37, label %29
29: ; preds = %22
%30 = load i32, i32* @stderr
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %35)
store i32 2, i32* %3
br label %232
37: ; preds = %22
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %41, i32** %7
%42 = load i32*, i32** %7
%43 = icmp ne i32* %42, null
br i1 %43, label %54, label %44
44: ; preds = %37
%45 = load i32, i32* @stderr
%46 = sext i32 %45 to i64
%47 = inttoptr i64 %46 to i32*
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %50)
%52 = load i32*, i32** %6
%53 = call i32 @fclose(i32* %52)
store i32 2, i32* %3
br label %232
54: ; preds = %37
%55 = load i32*, i32** %7
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0))
%57 = load i32*, i32** %7
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%59 = load i32*, i32** %7
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%61 = load i32*, i32** %7
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%63 = load i32*, i32** %7
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%65 = load i32*, i32** %7
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0))
%67 = load i32*, i32** %7
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%69 = load i32*, i32** %7
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.11, i64 0, i64 0))
%71 = load i32*, i32** %7
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%73 = load i32*, i32** %7
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0))
%75 = load i32*, i32** %7
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.13, i64 0, i64 0))
%77 = load i32*, i32** %7
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %77, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.14, i64 0, i64 0))
%79 = load i32*, i32** %7
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%81 = load i32*, i32** %7
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %81, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.15, i64 0, i64 0))
%83 = load i32*, i32** %7
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%85 = load i32*, i32** %7
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%87 = load i32*, i32** %7
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
%89 = load i32*, i32** %7
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%91 = load i32*, i32** %7
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %91, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.18, i64 0, i64 0))
%93 = load i32*, i32** %7
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.19, i64 0, i64 0))
%95 = load i32*, i32** %7
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.20, i64 0, i64 0))
%97 = load i32*, i32** %7
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.21, i64 0, i64 0))
%99 = load i32*, i32** %7
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0))
%101 = load i32*, i32** %7
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.23, i64 0, i64 0))
%103 = load i32*, i32** %7
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%105 = load i32*, i32** %7
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.24, i64 0, i64 0))
%107 = load i32*, i32** %7
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%109 = load i32*, i32** %7
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %109, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.25, i64 0, i64 0))
%111 = load i32*, i32** %7
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%113 = load i32*, i32** %7
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.26, i64 0, i64 0))
%115 = load i32*, i32** %7
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.27, i64 0, i64 0))
%117 = load i32*, i32** %7
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i64 0, i64 0))
%119 = load i32*, i32** %7
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%121 = load i32*, i32** %7
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0))
%123 = load i32*, i32** %7
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%125 = load i32*, i32** %7
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %125, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.30, i64 0, i64 0))
br label %127
127: ; preds = %168, %54
%128 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%129 = load i32*, i32** %6
%130 = call i64 @fread(i8* %128, i32 1, i32 1024, i32* %129)
%131 = trunc i64 %130 to i32
store i32 %131, i32* %9
%132 = icmp sgt i32 %131, 0
br i1 %132, label %133, label %177
133: ; preds = %127
%134 = load i32*, i32** %7
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 3
%137 = load i8*, i8** %136
%138 = load i32, i32* %10
%139 = add nsw i32 %138, 1
store i32 %139, i32* %10
%140 = load i32, i32* %9
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %134, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.31, i64 0, i64 0), i8* %137, i32 %138, i32 %140)
store i32 0, i32* %8
br label %142
142: ; preds = %165, %133
%143 = load i32, i32* %8
%144 = load i32, i32* %9
%145 = sub nsw i32 %144, 1
%146 = icmp slt i32 %143, %145
br i1 %146, label %147, label %168
147: ; preds = %142
%148 = load i32*, i32** %7
%149 = load i32, i32* %8
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %150
%152 = load i8, i8* %151
%153 = zext i8 %152 to i32
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 %153)
%155 = load i32, i32* %8
%156 = srem i32 %155, 10
%157 = icmp eq i32 %156, 9
br i1 %157, label %158, label %161
158: ; preds = %147
%159 = load i32*, i32** %7
%160 = call i32 (i32*, i8*, ...) @fprintf(i32* %159, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0))
br label %164
161: ; preds = %147
%162 = load i32*, i32** %7
%163 = call i32 (i32*, i8*, ...) @fprintf(i32* %162, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.34, i64 0, i64 0))
br label %164
164: ; preds = %161, %158
br label %165
165: ; preds = %164
%166 = load i32, i32* %8
%167 = add nsw i32 %166, 1
store i32 %167, i32* %8
br label %142
168: ; preds = %142
%169 = load i32*, i32** %7
%170 = load i32, i32* %9
%171 = sub nsw i32 %170, 1
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %172
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = call i32 (i32*, i8*, ...) @fprintf(i32* %169, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.35, i64 0, i64 0), i32 %175)
br label %127
177: ; preds = %127
%178 = load i32*, i32** %6
%179 = call i32 @fclose(i32* %178)
%180 = load i32*, i32** %7
%181 = load i8**, i8*** %5
%182 = getelementptr inbounds i8*, i8** %181, i64 3
%183 = load i8*, i8** %182
%184 = call i32 (i32*, i8*, ...) @fprintf(i32* %180, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.36, i64 0, i64 0), i8* %183)
%185 = load i32*, i32** %7
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %185, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%187 = load i32*, i32** %7
%188 = call i32 (i32*, i8*, ...) @fprintf(i32* %187, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.38, i64 0, i64 0))
%189 = load i32*, i32** %7
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %189, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.39, i64 0, i64 0))
store i32 0, i32* %8
br label %191
191: ; preds = %220, %177
%192 = load i32, i32* %8
%193 = load i32, i32* %10
%194 = icmp slt i32 %192, %193
br i1 %194, label %195, label %223
195: ; preds = %191
%196 = load i32*, i32** %7
%197 = load i8**, i8*** %5
%198 = getelementptr inbounds i8*, i8** %197, i64 3
%199 = load i8*, i8** %198
%200 = load i32, i32* %8
%201 = load i8**, i8*** %5
%202 = getelementptr inbounds i8*, i8** %201, i64 3
%203 = load i8*, i8** %202
%204 = load i32, i32* %8
%205 = load i8**, i8*** %5
%206 = getelementptr inbounds i8*, i8** %205, i64 3
%207 = load i8*, i8** %206
%208 = load i32, i32* %8
%209 = call i32 (i32*, i8*, ...) @fprintf(i32* %196, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str.40, i64 0, i64 0), i8* %199, i32 %200, i8* %203, i32 %204, i8* %207, i32 %208)
%210 = load i32*, i32** %7
%211 = call i32 (i32*, i8*, ...) @fprintf(i32* %210, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.41, i64 0, i64 0))
%212 = load i32*, i32** %7
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.42, i64 0, i64 0))
%214 = load i32*, i32** %7
%215 = call i32 (i32*, i8*, ...) @fprintf(i32* %214, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.43, i64 0, i64 0))
%216 = load i32*, i32** %7
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.44, i64 0, i64 0))
%218 = load i32*, i32** %7
%219 = call i32 (i32*, i8*, ...) @fprintf(i32* %218, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i64 0, i64 0))
br label %220
220: ; preds = %195
%221 = load i32, i32* %8
%222 = add nsw i32 %221, 1
store i32 %222, i32* %8
br label %191
223: ; preds = %191
%224 = load i32*, i32** %7
%225 = call i32 (i32*, i8*, ...) @fprintf(i32* %224, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.46, i64 0, i64 0))
%226 = load i32*, i32** %7
%227 = call i32 (i32*, i8*, ...) @fprintf(i32* %226, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.47, i64 0, i64 0))
%228 = load i32*, i32** %7
%229 = call i32 (i32*, i8*, ...) @fprintf(i32* %228, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.48, i64 0, i64 0))
%230 = load i32*, i32** %7
%231 = call i32 @fclose(i32* %230)
store i32 0, i32* %3
br label %232
232: ; preds = %223, %44, %29, %14
%233 = load i32, i32* %3
ret i32 %233
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s <input> <output> <array>\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [30 x i8] c"Cannot open input file: \22%s\22\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [31 x i8] c"Cannot open output file: \22%s\22\0A\00"
@.str.5 = [77 x i8] c"/*=========================================================================\0A\00"
@.str.7 = [36 x i8] c" Program: Visualization Toolkit\0A\00"
@.str.8 = [36 x i8] c" Module: vtkEncodeExecutable.c\0A\00"
@.str.9 = [59 x i8] c" Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\0A\00"
@.str.10 = [24 x i8] c" All rights reserved.\0A\00"
@.str.11 = [74 x i8] c" See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\0A\00"
@.str.12 = [70 x i8] c" This software is distributed WITHOUT ANY WARRANTY; without even\0A\00"
@.str.13 = [74 x i8] c" the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\0A\00"
@.str.14 = [69 x i8] c" PURPOSE. See the above copyright notice for more information.\0A\00"
@.str.15 = [77 x i8] c"=========================================================================*/\0A\00"
@.str.16 = [4 x i8] c"/*\0A\00"
@.str.17 = [13 x i8] c"DO NOT EDIT\0A\00"
@.str.18 = [44 x i8] c"This file is generated by running CMake on\0A\00"
@.str.19 = [72 x i8] c"VTK/Utilities/OutputWindowProcess as a separate project using a Visual\0A\00"
@.str.20 = [70 x i8] c"Studio generator. The program built in that project works only when\0A\00"
@.str.21 = [68 x i8] c"compiled by the Visual Studio compiler because it depends on being\0A\00"
@.str.22 = [61 x i8] c"able to manipulate the stack frame of another process. See\0A\00"
@.str.23 = [68 x i8] c"VTK/Utilities/OutputWindowProcess/README.txt for more information.\0A\00"
@.str.24 = [76 x i8] c"This file contains an encoded executable that can be written to disk using\0A\00"
@.str.25 = [72 x i8] c" int vtkEncodedArrayWin32OutputWindowProcessWrite(const char* fname);\0A\00"
@.str.26 = [64 x i8] c"It returns 1 for success and 0 for failure. The executable is\0A\00"
@.str.27 = [66 x i8] c"self-deleting and therefore can be run only once. It is used by\0A\00"
@.str.28 = [30 x i8] c"vtkWin32ProcessOutputWindow.\0A\00"
@.str.29 = [4 x i8] c"*/\0A\00"
@.str.30 = [21 x i8] c"#include <stdio.h>\0A\0A\00"
@.str.31 = [51 x i8] c"static unsigned char vtkEncodedArray%s_%d[%d] = {\0A\00"
@.str.32 = [7 x i8] c"0x%02X\00"
@.str.33 = [3 x i8] c",\0A\00"
@.str.34 = [3 x i8] c", \00"
@.str.35 = [11 x i8] c"0x%02X};\0A\0A\00"
@.str.36 = [54 x i8] c"extern int vtkEncodedArray%sWrite(const char* fname)\0A\00"
@.str.37 = [3 x i8] c"{\0A\00"
@.str.38 = [35 x i8] c" FILE* ofp = fopen(fname, \22wb\22);\0A\00"
@.str.39 = [26 x i8] c" if(!ofp) { return 0; }\0A\00"
@.str.40 = [125 x i8] c" if(fwrite(vtkEncodedArray%s_%d, 1,\0A sizeof(vtkEncodedArray%s_%d), ofp) !=\0A sizeof(vtkEncodedArray%s_%d))\0A\00"
@.str.41 = [7 x i8] c" {\0A\00"
@.str.42 = [18 x i8] c" fclose(ofp);\0A\00"
@.str.43 = [21 x i8] c" _unlink(fname);\0A\00"
@.str.44 = [15 x i8] c" return 0;\0A\00"
@.str.45 = [7 x i8] c" }\0A\00"
@.str.46 = [16 x i8] c" fclose(ofp);\0A\00"
@.str.47 = [13 x i8] c" return 1;\0A\00"
@.str.48 = [3 x i8] c"}\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 4
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load i8*, i8** %1
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %135
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load i8*, i8** %13
%22 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %135
23: ; preds = %12
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %35
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
%32 = load i8*, i8** %24
%33 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%34 = tail call i32 @fclose(i32* %15)
br label %135
35: ; preds = %23
%36 = tail call i64 @fwrite(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i64 76, i64 1, i32* %26)
%37 = tail call i32 @fputc(i32 10, i32* %26)
%38 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i64 35, i64 1, i32* %26)
%39 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i64 35, i64 1, i32* %26)
%40 = tail call i32 @fputc(i32 10, i32* %26)
%41 = tail call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i64 58, i64 1, i32* %26)
%42 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i64 23, i64 1, i32* %26)
%43 = tail call i64 @fwrite(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.11, i64 0, i64 0), i64 73, i64 1, i32* %26)
%44 = tail call i32 @fputc(i32 10, i32* %26)
%45 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0), i64 69, i64 1, i32* %26)
%46 = tail call i64 @fwrite(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.13, i64 0, i64 0), i64 73, i64 1, i32* %26)
%47 = tail call i64 @fwrite(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.14, i64 0, i64 0), i64 68, i64 1, i32* %26)
%48 = tail call i32 @fputc(i32 10, i32* %26)
%49 = tail call i64 @fwrite(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.15, i64 0, i64 0), i64 76, i64 1, i32* %26)
%50 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i64 3, i64 1, i32* %26)
%51 = tail call i32 @fputc(i32 10, i32* %26)
%52 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i64 12, i64 1, i32* %26)
%53 = tail call i32 @fputc(i32 10, i32* %26)
%54 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.18, i64 0, i64 0), i64 43, i64 1, i32* %26)
%55 = tail call i64 @fwrite(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.19, i64 0, i64 0), i64 71, i64 1, i32* %26)
%56 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.20, i64 0, i64 0), i64 69, i64 1, i32* %26)
%57 = tail call i64 @fwrite(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.21, i64 0, i64 0), i64 67, i64 1, i32* %26)
%58 = tail call i64 @fwrite(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i64 60, i64 1, i32* %26)
%59 = tail call i64 @fwrite(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.23, i64 0, i64 0), i64 67, i64 1, i32* %26)
%60 = tail call i32 @fputc(i32 10, i32* %26)
%61 = tail call i64 @fwrite(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.24, i64 0, i64 0), i64 75, i64 1, i32* %26)
%62 = tail call i32 @fputc(i32 10, i32* %26)
%63 = tail call i64 @fwrite(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.25, i64 0, i64 0), i64 71, i64 1, i32* %26)
%64 = tail call i32 @fputc(i32 10, i32* %26)
%65 = tail call i64 @fwrite(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.26, i64 0, i64 0), i64 63, i64 1, i32* %26)
%66 = tail call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.27, i64 0, i64 0), i64 65, i64 1, i32* %26)
%67 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i64 0, i64 0), i64 29, i64 1, i32* %26)
%68 = tail call i32 @fputc(i32 10, i32* %26)
%69 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0), i64 3, i64 1, i32* %26)
%70 = tail call i32 @fputc(i32 10, i32* %26)
%71 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.30, i64 0, i64 0), i64 20, i64 1, i32* %26)
%72 = call i64 @fread(i8* %4, i32 1, i32 1024, i32* %15)
%73 = trunc i64 %72 to i32
%74 = icmp sgt i32 %73, 0
br i1 %74, label %75, label %109
75: ; preds = %35
%76 = getelementptr inbounds i8*, i8** %1, i64 3
br label %77
77: ; preds = %75, %100
%78 = phi i32 [ %73, %75 ], [ %107, %100 ]
%79 = phi i32 [ 0, %75 ], [ %81, %100 ]
%80 = load i8*, i8** %76
%81 = add nuw nsw i32 %79, 1
%82 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.31, i64 0, i64 0), i8* %80, i32 %79, i32 %78)
%83 = add nsw i32 %78, -1
%84 = icmp ugt i32 %78, 1
br i1 %84, label %85, label %100
85: ; preds = %77
%86 = zext i32 %83 to i64
br label %87
87: ; preds = %85, %87
%88 = phi i64 [ 0, %85 ], [ %98, %87 ]
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 %91)
%93 = trunc i64 %88 to i32
%94 = urem i32 %93, 10
%95 = icmp eq i32 %94, 9
%96 = select i1 %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.34, i64 0, i64 0)
%97 = tail call i64 @fwrite(i8* %96, i64 2, i64 1, i32* %26)
%98 = add nuw nsw i64 %88, 1
%99 = icmp eq i64 %98, %86
br i1 %99, label %100, label %87
100: ; preds = %87, %77
%101 = sext i32 %83 to i64
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %101
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.35, i64 0, i64 0), i32 %104)
%106 = call i64 @fread(i8* %4, i32 1, i32 1024, i32* %15)
%107 = trunc i64 %106 to i32
%108 = icmp sgt i32 %107, 0
br i1 %108, label %77, label %109
109: ; preds = %100, %35
%110 = phi i32 [ 0, %35 ], [ %81, %100 ]
%111 = tail call i32 @fclose(i32* %15)
%112 = getelementptr inbounds i8*, i8** %1, i64 3
%113 = load i8*, i8** %112
%114 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.36, i64 0, i64 0), i8* %113)
%115 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0), i64 2, i64 1, i32* %26)
%116 = tail call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.38, i64 0, i64 0), i64 34, i64 1, i32* %26)
%117 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.39, i64 0, i64 0), i64 25, i64 1, i32* %26)
%118 = icmp eq i32 %110, 0
br i1 %118, label %130, label %119
119: ; preds = %109, %119
%120 = phi i32 [ %128, %119 ], [ 0, %109 ]
%121 = load i8*, i8** %112
%122 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str.40, i64 0, i64 0), i8* %121, i32 %120, i8* %121, i32 %120, i8* %121, i32 %120)
%123 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.41, i64 0, i64 0), i64 6, i64 1, i32* %26)
%124 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.42, i64 0, i64 0), i64 17, i64 1, i32* %26)
%125 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.43, i64 0, i64 0), i64 20, i64 1, i32* %26)
%126 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.44, i64 0, i64 0), i64 14, i64 1, i32* %26)
%127 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i64 0, i64 0), i64 6, i64 1, i32* %26)
%128 = add nuw i32 %120, 1
%129 = icmp eq i32 %128, %110
br i1 %129, label %130, label %119
130: ; preds = %119, %109
%131 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.46, i64 0, i64 0), i64 15, i64 1, i32* %26)
%132 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.47, i64 0, i64 0), i64 12, i64 1, i32* %26)
%133 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.48, i64 0, i64 0), i64 2, i64 1, i32* %26)
%134 = tail call i32 @fclose(i32* %26)
br label %135
135: ; preds = %130, %28, %17, %6
%136 = phi i32 [ 1, %6 ], [ 0, %130 ], [ 2, %28 ], [ 2, %17 ]
ret i32 %136
}