#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]);
    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    170d <main+0x5cd>
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    170d <main+0x5cd>
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    1233 <main+0xf3>
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>
movl   $0x2,-0x4(%rbp)
jmp    170d <main+0x5cd>
mov    -0x20(%rbp),%rdi
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x138c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1356(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x130e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf24(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x12c6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf45(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf80(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1290(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf60(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x126c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf49(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf63(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf99(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xfcd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xfff(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x102a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x11ee(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x104a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x11ca(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1072(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x11a6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1096(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10c4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10f4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x115e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x113a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10ca(%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    15b7 <main+0x477>
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    0x1090(%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    1590 <main+0x450>
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
movzbl -0x430(%rbp,%rax,1),%edx
ff
lea    0x108d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x9,%edx
jne    156b <main+0x42b>
mov    -0x20(%rbp),%rdi
lea    0x106e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    157d <main+0x43d>
mov    -0x20(%rbp),%rdi
lea    0x105a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1582 <main+0x442>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1511 <main+0x3d1>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x430(%rbp,%rax,1),%edx
ff
lea    0x1028(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    14bb <main+0x37b>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0x100b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10ed(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x101d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x102e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    16c7 <main+0x587>
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    0x1001(%rip),%rsi
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1064(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1059(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1059(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x105c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1059(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1617 <main+0x4d7>
mov    -0x20(%rbp),%rdi
lea    0x1005(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x102e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1019(%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     1637 <main+0x4d7>
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    165d <main+0x4fd>
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    1660 <main+0x500>
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    17e8 <main+0x688>
mov    0x29b9(%rip),%rax
movslq (%rax),%rdi
mov    0x8(%rbp),%rdx
lea    0x9f2(%rip),%rsi
jmp    164c <main+0x4ec>
mov    0x29a2(%rip),%rax
movslq (%rax),%rdi
mov    0x10(%rbp),%rdx
lea    0x9fb(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x2,%eax
jmp    17e8 <main+0x688>
xor    %r12d,%r12d
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x18(%rsp),%r13
mov    0x18(%r13),%rdx
lea    0xf64(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x1047(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf70(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf7a(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
test   %r12d,%r12d
je     1793 <main+0x633>
mov    %r12d,%ebx
lea    0x101a(%rip),%r15
lea    0x1022(%rip),%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x18(%r13),%rdx
mov    %r14,%rdi
lea    0xf53(%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    0xfaa(%rip),%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0x11,%esi
mov    $0x1,%edx
lea    0xf98(%rip),%rdi
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    $0x14,%esi
mov    $0x1,%edx
lea    0xf91(%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    16f0 <main+0x590>
lea    0xf3d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf5f(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xf43(%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 %230
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 %230
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 %52, 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)
store i32 2, i32* %3
br label %230
52: ; preds = %37
%53 = load i32*, i32** %7
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0))
%55 = load i32*, i32** %7
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = load i32*, i32** %7
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, 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.8, i64 0, i64 0))
%61 = load i32*, i32** %7
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%63 = load i32*, i32** %7
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0))
%65 = load i32*, i32** %7
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%67 = load i32*, i32** %7
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.11, i64 0, i64 0))
%69 = load i32*, i32** %7
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%71 = load i32*, i32** %7
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0))
%73 = load i32*, i32** %7
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.13, i64 0, i64 0))
%75 = load i32*, i32** %7
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.14, i64 0, i64 0))
%77 = load i32*, i32** %7
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%79 = load i32*, i32** %7
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.15, i64 0, i64 0))
%81 = load i32*, i32** %7
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%83 = load i32*, i32** %7
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%85 = load i32*, i32** %7
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
%87 = load i32*, i32** %7
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%89 = load i32*, i32** %7
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %89, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.18, i64 0, i64 0))
%91 = load i32*, i32** %7
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %91, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.19, i64 0, i64 0))
%93 = load i32*, i32** %7
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.20, i64 0, i64 0))
%95 = load i32*, i32** %7
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.21, i64 0, i64 0))
%97 = load i32*, i32** %7
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0))
%99 = load i32*, i32** %7
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.23, i64 0, i64 0))
%101 = load i32*, i32** %7
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%103 = load i32*, i32** %7
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.24, i64 0, i64 0))
%105 = load i32*, i32** %7
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%107 = load i32*, i32** %7
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.25, i64 0, i64 0))
%109 = load i32*, i32** %7
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %109, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%111 = load i32*, i32** %7
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.26, i64 0, i64 0))
%113 = load i32*, i32** %7
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.27, i64 0, i64 0))
%115 = load i32*, i32** %7
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i64 0, i64 0))
%117 = load i32*, i32** %7
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%119 = load i32*, i32** %7
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0))
%121 = load i32*, i32** %7
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%123 = load i32*, i32** %7
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.30, i64 0, i64 0))
br label %125
125: ; preds = %166, %52
%126 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%127 = load i32*, i32** %6
%128 = call i64 @fread(i8* %126, i32 1, i32 1024, i32* %127)
%129 = trunc i64 %128 to i32
store i32 %129, i32* %9
%130 = icmp sgt i32 %129, 0
br i1 %130, label %131, label %175
131: ; preds = %125
%132 = load i32*, i32** %7
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 3
%135 = load i8*, i8** %134
%136 = load i32, i32* %10
%137 = add nsw i32 %136, 1
store i32 %137, i32* %10
%138 = load i32, i32* %9
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.31, i64 0, i64 0), i8* %135, i32 %136, i32 %138)
store i32 0, i32* %8
br label %140
140: ; preds = %163, %131
%141 = load i32, i32* %8
%142 = load i32, i32* %9
%143 = sub nsw i32 %142, 1
%144 = icmp slt i32 %141, %143
br i1 %144, label %145, label %166
145: ; preds = %140
%146 = load i32*, i32** %7
%147 = load i32, i32* %8
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %148
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = call i32 (i32*, i8*, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 %151)
%153 = load i32, i32* %8
%154 = srem i32 %153, 10
%155 = icmp eq i32 %154, 9
br i1 %155, label %156, label %159
156: ; preds = %145
%157 = load i32*, i32** %7
%158 = call i32 (i32*, i8*, ...) @fprintf(i32* %157, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0))
br label %162
159: ; preds = %145
%160 = load i32*, i32** %7
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.34, i64 0, i64 0))
br label %162
162: ; preds = %159, %156
br label %163
163: ; preds = %162
%164 = load i32, i32* %8
%165 = add nsw i32 %164, 1
store i32 %165, i32* %8
br label %140
166: ; preds = %140
%167 = load i32*, i32** %7
%168 = load i32, i32* %9
%169 = sub nsw i32 %168, 1
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %170
%172 = load i8, i8* %171
%173 = zext i8 %172 to i32
%174 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.35, i64 0, i64 0), i32 %173)
br label %125
175: ; preds = %125
%176 = load i32*, i32** %6
%177 = call i32 @fclose(i32* %176)
%178 = load i32*, i32** %7
%179 = load i8**, i8*** %5
%180 = getelementptr inbounds i8*, i8** %179, i64 3
%181 = load i8*, i8** %180
%182 = call i32 (i32*, i8*, ...) @fprintf(i32* %178, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.36, i64 0, i64 0), i8* %181)
%183 = load i32*, i32** %7
%184 = call i32 (i32*, i8*, ...) @fprintf(i32* %183, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%185 = load i32*, i32** %7
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %185, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.38, i64 0, i64 0))
%187 = load i32*, i32** %7
%188 = call i32 (i32*, i8*, ...) @fprintf(i32* %187, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.39, i64 0, i64 0))
store i32 0, i32* %8
br label %189
189: ; preds = %218, %175
%190 = load i32, i32* %8
%191 = load i32, i32* %10
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %221
193: ; preds = %189
%194 = load i32*, i32** %7
%195 = load i8**, i8*** %5
%196 = getelementptr inbounds i8*, i8** %195, i64 3
%197 = load i8*, i8** %196
%198 = load i32, i32* %8
%199 = load i8**, i8*** %5
%200 = getelementptr inbounds i8*, i8** %199, i64 3
%201 = load i8*, i8** %200
%202 = load i32, i32* %8
%203 = load i8**, i8*** %5
%204 = getelementptr inbounds i8*, i8** %203, i64 3
%205 = load i8*, i8** %204
%206 = load i32, i32* %8
%207 = call i32 (i32*, i8*, ...) @fprintf(i32* %194, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str.40, i64 0, i64 0), i8* %197, i32 %198, i8* %201, i32 %202, i8* %205, i32 %206)
%208 = load i32*, i32** %7
%209 = call i32 (i32*, i8*, ...) @fprintf(i32* %208, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.41, i64 0, i64 0))
%210 = load i32*, i32** %7
%211 = call i32 (i32*, i8*, ...) @fprintf(i32* %210, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.42, i64 0, i64 0))
%212 = load i32*, i32** %7
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.43, i64 0, i64 0))
%214 = load i32*, i32** %7
%215 = call i32 (i32*, i8*, ...) @fprintf(i32* %214, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.44, i64 0, i64 0))
%216 = load i32*, i32** %7
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i64 0, i64 0))
br label %218
218: ; preds = %193
%219 = load i32, i32* %8
%220 = add nsw i32 %219, 1
store i32 %220, i32* %8
br label %189
221: ; preds = %189
%222 = load i32*, i32** %7
%223 = call i32 (i32*, i8*, ...) @fprintf(i32* %222, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.46, i64 0, i64 0))
%224 = load i32*, i32** %7
%225 = call i32 (i32*, i8*, ...) @fprintf(i32* %224, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.47, i64 0, i64 0))
%226 = load i32*, i32** %7
%227 = call i32 (i32*, i8*, ...) @fprintf(i32* %226, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.48, i64 0, i64 0))
%228 = load i32*, i32** %7
%229 = call i32 @fclose(i32* %228)
store i32 0, i32* %3
br label %230
230: ; preds = %221, %44, %29, %14
%231 = load i32, i32* %3
ret i32 %231
}

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 %134
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 %134
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 %34
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)
br label %134
34: ; preds = %23
%35 = 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)
%36 = tail call i32 @fputc(i32 10, i32* %26)
%37 = 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)
%38 = 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)
%39 = tail call i32 @fputc(i32 10, i32* %26)
%40 = 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)
%41 = 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)
%42 = 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)
%43 = tail call i32 @fputc(i32 10, i32* %26)
%44 = 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)
%45 = 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)
%46 = 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)
%47 = tail call i32 @fputc(i32 10, i32* %26)
%48 = 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)
%49 = 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)
%50 = tail call i32 @fputc(i32 10, i32* %26)
%51 = 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)
%52 = tail call i32 @fputc(i32 10, i32* %26)
%53 = 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)
%54 = 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)
%55 = 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)
%56 = 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)
%57 = 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)
%58 = 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)
%59 = tail call i32 @fputc(i32 10, i32* %26)
%60 = 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)
%61 = tail call i32 @fputc(i32 10, i32* %26)
%62 = 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)
%63 = tail call i32 @fputc(i32 10, i32* %26)
%64 = 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)
%65 = 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)
%66 = 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)
%67 = tail call i32 @fputc(i32 10, i32* %26)
%68 = 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)
%69 = tail call i32 @fputc(i32 10, i32* %26)
%70 = 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)
%71 = call i64 @fread(i8* %4, i32 1, i32 1024, i32* %15)
%72 = trunc i64 %71 to i32
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %108
74: ; preds = %34
%75 = getelementptr inbounds i8*, i8** %1, i64 3
br label %76
76: ; preds = %74, %99
%77 = phi i32 [ %72, %74 ], [ %106, %99 ]
%78 = phi i32 [ 0, %74 ], [ %80, %99 ]
%79 = load i8*, i8** %75
%80 = add nuw nsw i32 %78, 1
%81 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.31, i64 0, i64 0), i8* %79, i32 %78, i32 %77)
%82 = add nsw i32 %77, -1
%83 = icmp ugt i32 %77, 1
br i1 %83, label %84, label %99
84: ; preds = %76
%85 = zext i32 %82 to i64
br label %86
86: ; preds = %84, %86
%87 = phi i64 [ 0, %84 ], [ %97, %86 ]
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 %90)
%92 = trunc i64 %87 to i32
%93 = urem i32 %92, 10
%94 = icmp eq i32 %93, 9
%95 = select i1 %94, 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)
%96 = tail call i64 @fwrite(i8* %95, i64 2, i64 1, i32* %26)
%97 = add nuw nsw i64 %87, 1
%98 = icmp eq i64 %97, %85
br i1 %98, label %99, label %86
99: ; preds = %86, %76
%100 = sext i32 %82 to i64
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = zext i8 %102 to i32
%104 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.35, i64 0, i64 0), i32 %103)
%105 = call i64 @fread(i8* %4, i32 1, i32 1024, i32* %15)
%106 = trunc i64 %105 to i32
%107 = icmp sgt i32 %106, 0
br i1 %107, label %76, label %108
108: ; preds = %99, %34
%109 = phi i32 [ 0, %34 ], [ %80, %99 ]
%110 = tail call i32 @fclose(i32* %15)
%111 = getelementptr inbounds i8*, i8** %1, i64 3
%112 = load i8*, i8** %111
%113 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.36, i64 0, i64 0), i8* %112)
%114 = 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)
%115 = 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)
%116 = 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)
%117 = icmp eq i32 %109, 0
br i1 %117, label %129, label %118
118: ; preds = %108, %118
%119 = phi i32 [ %127, %118 ], [ 0, %108 ]
%120 = load i8*, i8** %111
%121 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str.40, i64 0, i64 0), i8* %120, i32 %119, i8* %120, i32 %119, i8* %120, i32 %119)
%122 = 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)
%123 = 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)
%124 = 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)
%125 = 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)
%126 = 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)
%127 = add nuw i32 %119, 1
%128 = icmp eq i32 %127, %109
br i1 %128, label %129, label %118
129: ; preds = %118, %108
%130 = 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)
%131 = 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)
%132 = 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)
%133 = tail call i32 @fclose(i32* %26)
br label %134
134: ; preds = %129, %28, %17, %6
%135 = phi i32 [ 1, %6 ], [ 0, %129 ], [ 2, %28 ], [ 2, %17 ]
ret i32 %135
}