#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
unsigned int char2int(unsigned char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ int2char(unsigned int, unsigned char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char toupper(char);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  FILE *exe;
  FILE *out;
  unsigned char data[8];
  char filename[256];
  int i;
  unsigned int header_data[12];
  unsigned int size;
  unsigned int padsize;
  signed char yesno = 'Z';
  printf("exefixup v0.02.1 Andrew Kieschnick <andrewk@mail.utexas.edu>\n\n");
  if (argc != 2)
    usage();
  strncpy(filename, argv[1], 256);
  exe = fopen(filename, "r");
  strcat(filename, "-fixed");
  if (!exe) {
    printf("ERROR: Can't open %s\n", filename);
    exit(-1);
  }
  for (i = 0; i < 8; i++)
    fscanf(exe, "%c", &data[i]);
  data[8] = 0;
  if (strncmp((char *)data, "PS-X EXE", 8)) {
    printf("ERROR: Not a PS-X EXE file\n");
    exit(-1);
  }
  for (i = 0; i < 12; i++) {
    fscanf(exe, "%c", &data[0]);
    fscanf(exe, "%c", &data[1]);
    fscanf(exe, "%c", &data[2]);
    fscanf(exe, "%c", &data[3]);
    header_data[i] = char2int(data);
  }
  printf("id\tPS-X EXE\n");
  printf("text\t0x%.8x\n", header_data[0]);
  printf("data\t0x%.8x\n", header_data[1]);
  printf("pc0\t0x%.8x\n", header_data[2]);
  printf("gp0\t0x%.8x\n", header_data[3]);
  printf("t_addr\t0x%.8x\n", header_data[4]);
  printf("t_size\t0x%.8x\n", header_data[5]);
  printf("d_addr\t0x%.8x\n", header_data[6]);
  printf("d_size\t0x%.8x\n", header_data[7]);
  printf("b_addr\t0x%.8x\n", header_data[8]);
  printf("b_size\t0x%.8x\n", header_data[9]);
  printf("s_addr\t0x%.8x\n", header_data[10]);
  printf("s_size\t0x%.8x\n\n", header_data[11]);
  fseek(exe, 0, SEEK_END);
  size = ftell(exe) - 2048;
  padsize = 2048 - (size % 2048);
  if (padsize != 2048) {
    printf("WARNING: EXE size is not a multiple of 2048!\n");
    while ((yesno != 'Y') && (yesno != 'N')) {
      printf("Write a padded EXE (to %s) ? ", filename);
      scanf("%c%*c", &yesno);
      yesno = toupper(yesno);
    }
    if (yesno == 'Y') {
      out = fopen(filename, "w");
      header_data[5] = size + padsize;
      fprintf(out, "PS-X EXE");
      for (i = 0; i < 12; i++) {
        int2char(header_data[i], data);
        fprintf(out, "%c%c%c%c", data[0], data[1], data[2], data[3]);
      }
      fseek(exe, 56, SEEK_SET);
      for (i = 0; i < size + 1992; i++) {
        fscanf(exe, "%c", &data[0]);
        fprintf(out, "%c", data[0]);
      }
      for (i = 0; i < padsize; i++)
        fprintf(out, "%c", 0);
      size = header_data[5];
      fclose(out);
    }
  }
  yesno = 'Z';
  if (size != header_data[5]) {
    printf("WARNING: EXE header t_size does not match filesize-2048\n");
    printf("EXE header:\t 0x%.8x bytes\n", header_data[5]);
    printf("filesize-2048:\t 0x%.8x bytes\n", size);
    while ((yesno != 'Y') && (yesno != 'N')) {
      printf("Write a corrected EXE (to %s) ? ", filename);
      scanf("%c%*c", &yesno);
      yesno = toupper(yesno);
    }
    if (yesno == 'Y') {
      out = fopen(filename, "w");
      fprintf(out, "PS-X EXE");
      for (i = 0; i < 5; i++) {
        int2char(header_data[i], data);
        fprintf(out, "%c%c%c%c", data[0], data[1], data[2], data[3]);
      }
      int2char(size, data);
      fprintf(out, "%c%c%c%c", data[0], data[1], data[2], data[3]);
      for (i = 6; i < 12; i++) {
        int2char(header_data[i], data);
        fprintf(out, "%c%c%c%c", data[0], data[1], data[2], data[3]);
      }
      fseek(exe, 56, SEEK_SET);
      for (i = 0; i < size + 1992; i++) {
        fscanf(exe, "%c", &data[0]);
        fprintf(out, "%c", data[0]);
      }
      fclose(out);
    }
  }
  fclose(exe);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x5a,-0x179(%rbp)
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
je     123f <main+0x3f>
mov    $0x0,%al
call   10d0 <usage@plt>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x100,%edx
call   1030 <strncpy@plt>
lea    -0x130(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   1100 <strcat@plt>
cmpq   $0x0,-0x18(%rbp)
jne    12ac <main+0xac>
lea    -0x130(%rbp),%rsi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
movl   $0x0,-0x134(%rbp)
cmpl   $0x8,-0x134(%rbp)
jge    12f5 <main+0xf5>
mov    -0x18(%rbp),%rdi
movslq -0x134(%rbp),%rax
lea    -0x28(%rbp),%rdx
add    %rax,%rdx
lea    0xeb9(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    12b6 <main+0xb6>
movb   $0x0,-0x20(%rbp)
lea    -0x28(%rbp),%rdi
lea    0xd5a(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     1330 <main+0x130>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
movl   $0x0,-0x134(%rbp)
cmpl   $0xc,-0x134(%rbp)
jge    13d0 <main+0x1d0>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
lea    0xe3f(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
add    $0x1,%rdx
lea    0xe27(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
add    $0x2,%rdx
lea    0xe0f(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
add    $0x3,%rdx
lea    0xdf7(%rip),%rsi
call   1080 <fscanf@plt>
lea    -0x28(%rbp),%rdi
call   10c0 <char2int@plt>
mov    %eax,%ecx
movslq -0x134(%rbp),%rax
mov    %ecx,-0x170(%rbp,%rax,4)
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    133a <main+0x13a>
lea    0xcac(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%esi
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x16c(%rbp),%esi
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x168(%rbp),%esi
lea    0xc97(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x164(%rbp),%esi
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x160(%rbp),%esi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x15c(%rbp),%esi
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x158(%rbp),%esi
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x154(%rbp),%esi
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x150(%rbp),%esi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14c(%rbp),%esi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x148(%rbp),%esi
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x144(%rbp),%esi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2b0f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <ftell@plt>
sub    $0x800,%eax
mov    %eax,-0x174(%rbp)
mov    -0x174(%rbp),%ecx
and    $0x7ff,%ecx
mov    $0x800,%eax
sub    %ecx,%eax
mov    %eax,-0x178(%rbp)
cmpl   $0x800,-0x178(%rbp)
je     1732 <main+0x532>
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x179(%rbp),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0x17a(%rbp)
je     1558 <main+0x358>
movsbl -0x179(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x17a(%rbp)
mov    -0x17a(%rbp),%al
test   $0x1,%al
jne    156b <main+0x36b>
jmp    15aa <main+0x3aa>
lea    -0x130(%rbp),%rsi
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc00(%rip),%rdi
lea    -0x179(%rbp),%rsi
call   10e0 <scanf@plt>
movsbl -0x179(%rbp),%edi
call   1050 <toupper@plt>
mov    %al,-0x179(%rbp)
jmp    152d <main+0x32d>
movsbl -0x179(%rbp),%eax
cmp    $0x59,%eax
jne    172d <main+0x52d>
lea    -0x130(%rbp),%rdi
lea    0xbc5(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x174(%rbp),%eax
add    -0x178(%rbp),%eax
mov    %eax,-0x15c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xa70(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x134(%rbp)
cmpl   $0xc,-0x134(%rbp)
jge    165b <main+0x45b>
movslq -0x134(%rbp),%rax
mov    -0x170(%rbp,%rax,4),%edi
lea    -0x28(%rbp),%rsi
call   1120 <int2char@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
movzbl -0x27(%rbp),%ecx
movzbl -0x26(%rbp),%r8d
movzbl -0x25(%rbp),%r9d
lea    0xb4f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    15ff <main+0x3ff>
mov    -0x18(%rbp),%rdi
mov    0x2972(%rip),%rax
mov    (%rax),%edx
mov    $0x38,%esi
call   10b0 <fseek@plt>
movl   $0x0,-0x134(%rbp)
mov    -0x134(%rbp),%eax
mov    -0x174(%rbp),%ecx
add    $0x7c8,%ecx
cmp    %ecx,%eax
jae    16d4 <main+0x4d4>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
lea    0xaf0(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
lea    0xadc(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    167c <main+0x47c>
movl   $0x0,-0x134(%rbp)
mov    -0x134(%rbp),%eax
cmp    -0x178(%rbp),%eax
jae    1718 <main+0x518>
mov    -0x20(%rbp),%rdi
lea    0xa9a(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    16de <main+0x4de>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x174(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
jmp    1732 <main+0x532>
movb   $0x5a,-0x179(%rbp)
mov    -0x174(%rbp),%eax
cmp    -0x15c(%rbp),%eax
je     19bd <main+0x7bd>
lea    0xa46(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x15c(%rbp),%esi
lea    0xa6b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x174(%rbp),%esi
lea    0xa72(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x179(%rbp),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0x17b(%rbp)
je     17ac <main+0x5ac>
movsbl -0x179(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x17b(%rbp)
mov    -0x17b(%rbp),%al
test   $0x1,%al
jne    17bf <main+0x5bf>
jmp    17fe <main+0x5fe>
lea    -0x130(%rbp),%rsi
lea    0xa3d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x9ac(%rip),%rdi
lea    -0x179(%rbp),%rsi
call   10e0 <scanf@plt>
movsbl -0x179(%rbp),%edi
call   1050 <toupper@plt>
mov    %al,-0x179(%rbp)
jmp    1781 <main+0x581>
movsbl -0x179(%rbp),%eax
cmp    $0x59,%eax
jne    19b8 <main+0x7b8>
lea    -0x130(%rbp),%rdi
lea    0x971(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0x82e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x134(%rbp)
cmpl   $0x5,-0x134(%rbp)
jge    189d <main+0x69d>
movslq -0x134(%rbp),%rax
mov    -0x170(%rbp,%rax,4),%edi
lea    -0x28(%rbp),%rsi
call   1120 <int2char@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
movzbl -0x27(%rbp),%ecx
movzbl -0x26(%rbp),%r8d
movzbl -0x25(%rbp),%r9d
lea    0x90d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1841 <main+0x641>
mov    -0x174(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1120 <int2char@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
movzbl -0x27(%rbp),%ecx
movzbl -0x26(%rbp),%r8d
movzbl -0x25(%rbp),%r9d
lea    0x8c6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x6,-0x134(%rbp)
cmpl   $0xc,-0x134(%rbp)
jge    1936 <main+0x736>
movslq -0x134(%rbp),%rax
mov    -0x170(%rbp,%rax,4),%edi
lea    -0x28(%rbp),%rsi
call   1120 <int2char@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
movzbl -0x27(%rbp),%ecx
movzbl -0x26(%rbp),%r8d
movzbl -0x25(%rbp),%r9d
lea    0x874(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    18da <main+0x6da>
mov    -0x18(%rbp),%rdi
mov    0x2697(%rip),%rax
mov    (%rax),%edx
mov    $0x38,%esi
call   10b0 <fseek@plt>
movl   $0x0,-0x134(%rbp)
mov    -0x134(%rbp),%eax
mov    -0x174(%rbp),%ecx
add    $0x7c8,%ecx
cmp    %ecx,%eax
jae    19af <main+0x7af>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rdx
lea    0x815(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x20(%rbp),%rdi
movzbl -0x28(%rbp),%edx
lea    0x801(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1957 <main+0x757>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
jmp    19bd <main+0x7bd>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movb   $0x5a,0x13(%rsp)
lea    0xf01(%rip),%rdi
call   1060 <puts@plt>
cmp    $0x2,%ebp
je     1263 <main+0x33>
xor    %eax,%eax
call   10f0 <usage@plt>
mov    0x8(%rbx),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%edx
call   1030 <strncpy@plt>
lea    0xd80(%rip),%rsi
mov    %rbx,%rdi
call   1110 <fopen@plt>
mov    %rax,%rbp
lea    0xd70(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strcat@plt>
test   %rbp,%rbp
je     1be4 <main+0x9b4>
lea    0xe4c(%rip),%rbx
lea    0xb(%rsp),%r14
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <fscanf@plt>
lea    0xd(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %rdx,%r12
call   1090 <fscanf@plt>
lea    0xe(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %rdx,%r15
call   1090 <fscanf@plt>
lea    0xf(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <fscanf@plt>
lea    0x10(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <fscanf@plt>
lea    0x11(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <fscanf@plt>
lea    0x12(%rsp),%rdx
mov    %rbp,%r13
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <fscanf@plt>
movb   $0x0,0x13(%rsp)
lea    0xe52(%rip),%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1c01 <main+0x9d1>
xor    %r14d,%r14d
lea    0xd94(%rip),%rbp
lea    0xb(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1090 <fscanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
lea    0xc(%rsp),%rdx
call   1090 <fscanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1090 <fscanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1090 <fscanf@plt>
mov    %rbx,%rdi
call   10e0 <char2int@plt>
mov    %eax,0x30(%rsp,%r14,4)
add    $0x1,%r14
cmp    $0xc,%r14
jne    1370 <main+0x140>
lea    0xdc9(%rip),%rdi
call   1060 <puts@plt>
mov    0x30(%rsp),%esi
lea    0xc47(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x34(%rsp),%esi
lea    0xc42(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x38(%rsp),%esi
lea    0xc3d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x3c(%rsp),%esi
lea    0xc37(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x40(%rsp),%esi
lea    0xc31(%rip),%rdi
mov    %esi,0x2c(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x44(%rsp),%esi
lea    0xc2a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x48(%rsp),%esi
lea    0xc27(%rip),%rdi
mov    %esi,0x28(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x4c(%rsp),%esi
lea    0xc20(%rip),%rdi
mov    %esi,0x24(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x50(%rsp),%esi
lea    0xc19(%rip),%rdi
mov    %esi,0x20(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x54(%rsp),%esi
lea    0xc12(%rip),%rdi
mov    %esi,0x1c(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x58(%rsp),%esi
lea    0xc0b(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x5c(%rsp),%esi
lea    0xc08(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2b28(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %r13,%rdi
call   10c0 <ftell@plt>
mov    %eax,%r15d
lea    -0x800(%r15),%eax
mov    %r15d,%r12d
and    $0x7ff,%r12d
je     155c <main+0x32c>
mov    %eax,0x18(%rsp)
mov    $0x800,%eax
sub    %r12d,%eax
mov    %eax,0x14(%rsp)
lea    0xcd4(%rip),%rdi
call   1060 <puts@plt>
mov    $0x5a,%al
lea    0x60(%rsp),%rbp
lea    0xbd4(%rip),%rbx
lea    0x13(%rsp),%r14
cmp    $0x4e,%al
je     1552 <main+0x322>
nopl   (%rax)
cmp    $0x59,%al
je     1564 <main+0x334>
lea    0xb9f(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1100 <scanf@plt>
movsbl 0x13(%rsp),%edi
call   1050 <toupper@plt>
mov    %al,0x13(%rsp)
cmp    $0x4e,%al
jne    1520 <main+0x2f0>
mov    0x18(%rsp),%r12d
jmp    186c <main+0x63c>
mov    %eax,%r12d
jmp    186c <main+0x63c>
lea    0xb83(%rip),%rsi
lea    0x60(%rsp),%rdi
call   1110 <fopen@plt>
mov    %rax,%r14
mov    0x14(%rsp),%eax
add    0x18(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %eax,0x44(%rsp)
lea    0xc05(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1140 <fwrite@plt>
mov    0x30(%rsp),%edi
lea    0xb(%rsp),%rbx
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
lea    0xb21(%rip),%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x34(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x38(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x3c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x40(%rsp),%edi
mov    %edi,0x2c(%rsp)
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x44(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x48(%rsp),%edi
mov    %edi,0x28(%rsp)
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x4c(%rsp),%edi
mov    %edi,0x24(%rsp)
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x50(%rsp),%edi
mov    %edi,0x20(%rsp)
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x54(%rsp),%edi
mov    %edi,0x1c(%rsp)
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x58(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x5c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x27dc(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    $0x38,%esi
call   10d0 <fseek@plt>
add    $0xffffffc8,%r15d
je     1841 <main+0x611>
lea    0x8de(%rip),%rbx
lea    0xb(%rsp),%rbp
nopl   (%rax)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <fscanf@plt>
movzbl 0xb(%rsp),%edi
mov    %r14,%rsi
call   10a0 <fputc@plt>
add    $0xffffffff,%r15d
jne    1820 <main+0x5f0>
or     $0xfffff800,%r12d
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r14,%rsi
call   10a0 <fputc@plt>
inc    %r12d
jne    1850 <main+0x620>
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    0x14(%rsp),%r12d
movb   $0x5a,0x13(%rsp)
mov    0x44(%rsp),%ebx
cmp    %ebx,%r12d
je     1bc8 <main+0x998>
lea    0x918(%rip),%rdi
call   1060 <puts@plt>
lea    0x868(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x873(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x13(%rsp),%al
lea    0x87c(%rip),%r15
lea    0x60(%rsp),%r14
lea    0x826(%rip),%rbx
lea    0x13(%rsp),%rbp
cmp    $0x4e,%al
je     1bc8 <main+0x998>
nop
cmp    $0x59,%al
je     1903 <main+0x6d3>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1100 <scanf@plt>
movsbl 0x13(%rsp),%edi
call   1050 <toupper@plt>
mov    %al,0x13(%rsp)
cmp    $0x4e,%al
jne    18d0 <main+0x6a0>
jmp    1bc8 <main+0x998>
lea    0x7e4(%rip),%rsi
lea    0x60(%rsp),%rdi
call   1110 <fopen@plt>
mov    %rax,%r15
lea    0x876(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1140 <fwrite@plt>
mov    0x30(%rsp),%edi
lea    0xb(%rsp),%rbx
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r12d,%ebp
lea    0x78f(%rip),%r12
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x34(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x38(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x3c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x28(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x24(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x20(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x1c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x58(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x5c(%rsp),%edi
mov    %rbx,%rsi
call   1150 <int2char@plt>
movzbl 0xb(%rsp),%edx
movzbl 0xc(%rsp),%ecx
movzbl 0xd(%rsp),%r8d
movzbl 0xe(%rsp),%r9d
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2460(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    $0x38,%esi
call   10d0 <fseek@plt>
add    $0x7c8,%ebp
je     1bc0 <main+0x990>
lea    0x560(%rip),%r14
lea    0xb(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <fscanf@plt>
movzbl 0xb(%rsp),%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
add    $0xffffffff,%ebp
jne    1ba0 <main+0x970>
mov    %r15,%rdi
call   1070 <fclose@plt>
mov    %r13,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x41e(%rip),%rdi
lea    0x60(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
lea    0x5fa(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"exefixup v0.02.1 Andrew Kieschnick <andrewk@mail.utexas.edu>\0A\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"-fixed\00"
@.str.3 = [22 x i8] c"ERROR: Can't open %s\0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [9 x i8] c"PS-X EXE\00"
@.str.6 = [28 x i8] c"ERROR: Not a PS-X EXE file\0A\00"
@.str.7 = [13 x i8] c"id\09PS-X EXE\0A\00"
@.str.8 = [13 x i8] c"text\090x%.8x\0A\00"
@.str.9 = [13 x i8] c"data\090x%.8x\0A\00"
@.str.10 = [12 x i8] c"pc0\090x%.8x\0A\00"
@.str.11 = [12 x i8] c"gp0\090x%.8x\0A\00"
@.str.12 = [15 x i8] c"t_addr\090x%.8x\0A\00"
@.str.13 = [15 x i8] c"t_size\090x%.8x\0A\00"
@.str.14 = [15 x i8] c"d_addr\090x%.8x\0A\00"
@.str.15 = [15 x i8] c"d_size\090x%.8x\0A\00"
@.str.16 = [15 x i8] c"b_addr\090x%.8x\0A\00"
@.str.17 = [15 x i8] c"b_size\090x%.8x\0A\00"
@.str.18 = [15 x i8] c"s_addr\090x%.8x\0A\00"
@.str.19 = [16 x i8] c"s_size\090x%.8x\0A\0A\00"
@SEEK_END = global i32 0
@.str.20 = [46 x i8] c"WARNING: EXE size is not a multiple of 2048!\0A\00"
@.str.21 = [30 x i8] c"Write a padded EXE (to %s) ? \00"
@.str.22 = [6 x i8] c"%c%*c\00"
@.str.23 = [2 x i8] c"w\00"
@.str.24 = [9 x i8] c"%c%c%c%c\00"
@SEEK_SET = global i32 0
@.str.25 = [57 x i8] c"WARNING: EXE header t_size does not match filesize-2048\0A\00"
@.str.26 = [27 x i8] c"EXE header:\09 0x%.8x bytes\0A\00"
@.str.27 = [30 x i8] c"filesize-2048:\09 0x%.8x bytes\0A\00"
@.str.28 = [33 x i8] c"Write a corrected EXE (to %s) ? \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 [8 x i8]
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca [12 x i32]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 90, i8* %14
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (...) @usage()
br label %20
20: ; preds = %18, %2
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strncpy(i8* %21, i8* %24, i32 256)
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %6
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%29 = call i32 @strcat(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32*, i32** %6
%31 = icmp ne i32* %30, null
br i1 %31, label %36, label %32
32: ; preds = %20
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = call i32 @exit(i32 -1)
unreachable
36: ; preds = %20
store i32 0, i32* %10
br label %37
37: ; preds = %46, %36
%38 = load i32, i32* %10
%39 = icmp slt i32 %38, 8
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = load i32*, i32** %6
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 %43
%45 = call i32 @fscanf(i32* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %37
49: ; preds = %37
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 8
store i8 0, i8* %50
%51 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%52 = call i64 @strncmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 8)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%56 = call i32 @exit(i32 -1)
unreachable
57: ; preds = %49
store i32 0, i32* %10
br label %58
58: ; preds = %79, %57
%59 = load i32, i32* %10
%60 = icmp slt i32 %59, 12
br i1 %60, label %61, label %82
61: ; preds = %58
%62 = load i32*, i32** %6
%63 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%64 = call i32 @fscanf(i32* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %63)
%65 = load i32*, i32** %6
%66 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%67 = call i32 @fscanf(i32* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %66)
%68 = load i32*, i32** %6
%69 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%70 = call i32 @fscanf(i32* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %69)
%71 = load i32*, i32** %6
%72 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%73 = call i32 @fscanf(i32* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%75 = call i32 @char2int(i8* %74)
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 %77
store i32 %75, i32* %78
br label %79
79: ; preds = %61
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 1
store i32 %81, i32* %10
br label %58
82: ; preds = %58
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%84 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 0
%85 = load i32, i32* %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %85)
%87 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 1
%88 = load i32, i32* %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %88)
%90 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 2
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %91)
%93 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 3
%94 = load i32, i32* %93
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %94)
%96 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 4
%97 = load i32, i32* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %97)
%99 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
%100 = load i32, i32* %99
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 %100)
%102 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 6
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i32 %103)
%105 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 7
%106 = load i32, i32* %105
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i32 %106)
%108 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 8
%109 = load i32, i32* %108
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 9
%112 = load i32, i32* %111
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i32 %112)
%114 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 10
%115 = load i32, i32* %114
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), i32 %115)
%117 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 11
%118 = load i32, i32* %117
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 %118)
%120 = load i32*, i32** %6
%121 = load i32, i32* @SEEK_END
%122 = call i32 @fseek(i32* %120, i32 0, i32 %121)
%123 = load i32*, i32** %6
%124 = call i32 @ftell(i32* %123)
%125 = sub nsw i32 %124, 2048
store i32 %125, i32* %12
%126 = load i32, i32* %12
%127 = urem i32 %126, 2048
%128 = sub i32 2048, %127
store i32 %128, i32* %13
%129 = load i32, i32* %13
%130 = icmp ne i32 %129, 2048
br i1 %130, label %131, label %227
131: ; preds = %82
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.20, i64 0, i64 0))
br label %133
133: ; preds = %143, %131
%134 = load i8, i8* %14
%135 = sext i8 %134 to i32
%136 = icmp ne i32 %135, 89
br i1 %136, label %137, label %141
137: ; preds = %133
%138 = load i8, i8* %14
%139 = sext i8 %138 to i32
%140 = icmp ne i32 %139, 78
br label %141
141: ; preds = %137, %133
%142 = phi i1 [ false, %133 ], [ %140, %137 ]
br i1 %142, label %143, label %149
143: ; preds = %141
%144 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i8* %144)
%146 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* %14)
%147 = load i8, i8* %14
%148 = call signext i8 @toupper(i8 signext %147)
store i8 %148, i8* %14
br label %133
149: ; preds = %141
%150 = load i8, i8* %14
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 89
br i1 %152, label %153, label %226
153: ; preds = %149
%154 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%155 = call i32* @fopen(i8* %154, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
store i32* %155, i32** %7
%156 = load i32, i32* %12
%157 = load i32, i32* %13
%158 = add i32 %156, %157
%159 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
store i32 %158, i32* %159
%160 = load i32*, i32** %7
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %10
br label %162
162: ; preds = %186, %153
%163 = load i32, i32* %10
%164 = icmp slt i32 %163, 12
br i1 %164, label %165, label %189
165: ; preds = %162
%166 = load i32, i32* %10
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 %167
%169 = load i32, i32* %168
%170 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%171 = call i32 @int2char(i32 %169, i8* %170)
%172 = load i32*, i32** %7
%173 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%177 = load i8, i8* %176
%178 = zext i8 %177 to i32
%179 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%180 = load i8, i8* %179
%181 = zext i8 %180 to i32
%182 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%183 = load i8, i8* %182
%184 = zext i8 %183 to i32
%185 = call i32 (i32*, i8*, ...) @fprintf(i32* %172, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %175, i32 %178, i32 %181, i32 %184)
br label %186
186: ; preds = %165
%187 = load i32, i32* %10
%188 = add nsw i32 %187, 1
store i32 %188, i32* %10
br label %162
189: ; preds = %162
%190 = load i32*, i32** %6
%191 = load i32, i32* @SEEK_SET
%192 = call i32 @fseek(i32* %190, i32 56, i32 %191)
store i32 0, i32* %10
br label %193
193: ; preds = %207, %189
%194 = load i32, i32* %10
%195 = load i32, i32* %12
%196 = add i32 %195, 1992
%197 = icmp ult i32 %194, %196
br i1 %197, label %198, label %210
198: ; preds = %193
%199 = load i32*, i32** %6
%200 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%201 = call i32 @fscanf(i32* %199, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %200)
%202 = load i32*, i32** %7
%203 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%204 = load i8, i8* %203
%205 = zext i8 %204 to i32
%206 = call i32 (i32*, i8*, ...) @fprintf(i32* %202, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %205)
br label %207
207: ; preds = %198
%208 = load i32, i32* %10
%209 = add nsw i32 %208, 1
store i32 %209, i32* %10
br label %193
210: ; preds = %193
store i32 0, i32* %10
br label %211
211: ; preds = %218, %210
%212 = load i32, i32* %10
%213 = load i32, i32* %13
%214 = icmp ult i32 %212, %213
br i1 %214, label %215, label %221
215: ; preds = %211
%216 = load i32*, i32** %7
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 0)
br label %218
218: ; preds = %215
%219 = load i32, i32* %10
%220 = add nsw i32 %219, 1
store i32 %220, i32* %10
br label %211
221: ; preds = %211
%222 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
%223 = load i32, i32* %222
store i32 %223, i32* %12
%224 = load i32*, i32** %7
%225 = call i32 @fclose(i32* %224)
br label %226
226: ; preds = %221, %149
br label %227
227: ; preds = %226, %82
store i8 90, i8* %14
%228 = load i32, i32* %12
%229 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
%230 = load i32, i32* %229
%231 = icmp ne i32 %228, %230
br i1 %231, label %232, label %361
232: ; preds = %227
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.25, i64 0, i64 0))
%234 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
%235 = load i32, i32* %234
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0), i32 %235)
%237 = load i32, i32* %12
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.27, i64 0, i64 0), i32 %237)
br label %239
239: ; preds = %249, %232
%240 = load i8, i8* %14
%241 = sext i8 %240 to i32
%242 = icmp ne i32 %241, 89
br i1 %242, label %243, label %247
243: ; preds = %239
%244 = load i8, i8* %14
%245 = sext i8 %244 to i32
%246 = icmp ne i32 %245, 78
br label %247
247: ; preds = %243, %239
%248 = phi i1 [ false, %239 ], [ %246, %243 ]
br i1 %248, label %249, label %255
249: ; preds = %247
%250 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.28, i64 0, i64 0), i8* %250)
%252 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* %14)
%253 = load i8, i8* %14
%254 = call signext i8 @toupper(i8 signext %253)
store i8 %254, i8* %14
br label %239
255: ; preds = %247
%256 = load i8, i8* %14
%257 = sext i8 %256 to i32
%258 = icmp eq i32 %257, 89
br i1 %258, label %259, label %360
259: ; preds = %255
%260 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%261 = call i32* @fopen(i8* %260, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
store i32* %261, i32** %7
%262 = load i32*, i32** %7
%263 = call i32 (i32*, i8*, ...) @fprintf(i32* %262, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %10
br label %264
264: ; preds = %288, %259
%265 = load i32, i32* %10
%266 = icmp slt i32 %265, 5
br i1 %266, label %267, label %291
267: ; preds = %264
%268 = load i32, i32* %10
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 %269
%271 = load i32, i32* %270
%272 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%273 = call i32 @int2char(i32 %271, i8* %272)
%274 = load i32*, i32** %7
%275 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%276 = load i8, i8* %275
%277 = zext i8 %276 to i32
%278 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%279 = load i8, i8* %278
%280 = zext i8 %279 to i32
%281 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%282 = load i8, i8* %281
%283 = zext i8 %282 to i32
%284 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%285 = load i8, i8* %284
%286 = zext i8 %285 to i32
%287 = call i32 (i32*, i8*, ...) @fprintf(i32* %274, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %277, i32 %280, i32 %283, i32 %286)
br label %288
288: ; preds = %267
%289 = load i32, i32* %10
%290 = add nsw i32 %289, 1
store i32 %290, i32* %10
br label %264
291: ; preds = %264
%292 = load i32, i32* %12
%293 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%294 = call i32 @int2char(i32 %292, i8* %293)
%295 = load i32*, i32** %7
%296 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%297 = load i8, i8* %296
%298 = zext i8 %297 to i32
%299 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%300 = load i8, i8* %299
%301 = zext i8 %300 to i32
%302 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%303 = load i8, i8* %302
%304 = zext i8 %303 to i32
%305 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%306 = load i8, i8* %305
%307 = zext i8 %306 to i32
%308 = call i32 (i32*, i8*, ...) @fprintf(i32* %295, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %298, i32 %301, i32 %304, i32 %307)
store i32 6, i32* %10
br label %309
309: ; preds = %333, %291
%310 = load i32, i32* %10
%311 = icmp slt i32 %310, 12
br i1 %311, label %312, label %336
312: ; preds = %309
%313 = load i32, i32* %10
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 %314
%316 = load i32, i32* %315
%317 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%318 = call i32 @int2char(i32 %316, i8* %317)
%319 = load i32*, i32** %7
%320 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%321 = load i8, i8* %320
%322 = zext i8 %321 to i32
%323 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%324 = load i8, i8* %323
%325 = zext i8 %324 to i32
%326 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%327 = load i8, i8* %326
%328 = zext i8 %327 to i32
%329 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%330 = load i8, i8* %329
%331 = zext i8 %330 to i32
%332 = call i32 (i32*, i8*, ...) @fprintf(i32* %319, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %322, i32 %325, i32 %328, i32 %331)
br label %333
333: ; preds = %312
%334 = load i32, i32* %10
%335 = add nsw i32 %334, 1
store i32 %335, i32* %10
br label %309
336: ; preds = %309
%337 = load i32*, i32** %6
%338 = load i32, i32* @SEEK_SET
%339 = call i32 @fseek(i32* %337, i32 56, i32 %338)
store i32 0, i32* %10
br label %340
340: ; preds = %354, %336
%341 = load i32, i32* %10
%342 = load i32, i32* %12
%343 = add i32 %342, 1992
%344 = icmp ult i32 %341, %343
br i1 %344, label %345, label %357
345: ; preds = %340
%346 = load i32*, i32** %6
%347 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%348 = call i32 @fscanf(i32* %346, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %347)
%349 = load i32*, i32** %7
%350 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%351 = load i8, i8* %350
%352 = zext i8 %351 to i32
%353 = call i32 (i32*, i8*, ...) @fprintf(i32* %349, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %352)
br label %354
354: ; preds = %345
%355 = load i32, i32* %10
%356 = add nsw i32 %355, 1
store i32 %356, i32* %10
br label %340
357: ; preds = %340
%358 = load i32*, i32** %7
%359 = call i32 @fclose(i32* %358)
br label %360
360: ; preds = %357, %255
br label %361
361: ; preds = %360, %227
%362 = load i32*, i32** %6
%363 = call i32 @fclose(i32* %362)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"-fixed\00"
@.str.3 = [22 x i8] c"ERROR: Can't open %s\0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [9 x i8] c"PS-X EXE\00"
@.str.8 = [13 x i8] c"text\090x%.8x\0A\00"
@.str.9 = [13 x i8] c"data\090x%.8x\0A\00"
@.str.10 = [12 x i8] c"pc0\090x%.8x\0A\00"
@.str.11 = [12 x i8] c"gp0\090x%.8x\0A\00"
@.str.12 = [15 x i8] c"t_addr\090x%.8x\0A\00"
@.str.13 = [15 x i8] c"t_size\090x%.8x\0A\00"
@.str.14 = [15 x i8] c"d_addr\090x%.8x\0A\00"
@.str.15 = [15 x i8] c"d_size\090x%.8x\0A\00"
@.str.16 = [15 x i8] c"b_addr\090x%.8x\0A\00"
@.str.17 = [15 x i8] c"b_size\090x%.8x\0A\00"
@.str.18 = [15 x i8] c"s_addr\090x%.8x\0A\00"
@.str.19 = [16 x i8] c"s_size\090x%.8x\0A\0A\00"
@SEEK_END = global i32 0
@.str.21 = [30 x i8] c"Write a padded EXE (to %s) ? \00"
@.str.22 = [6 x i8] c"%c%*c\00"
@.str.23 = [2 x i8] c"w\00"
@.str.24 = [9 x i8] c"%c%c%c%c\00"
@SEEK_SET = global i32 0
@.str.26 = [27 x i8] c"EXE header:\09 0x%.8x bytes\0A\00"
@.str.27 = [30 x i8] c"filesize-2048:\09 0x%.8x bytes\0A\00"
@.str.28 = [33 x i8] c"Write a corrected EXE (to %s) ? \00"
@str = [62 x i8] c"exefixup v0.02.1 Andrew Kieschnick <andrewk@mail.utexas.edu>\0A\00"
@str.29 = [12 x i8] c"id\09PS-X EXE\00"
@str.30 = [56 x i8] c"WARNING: EXE header t_size does not match filesize-2048\00"
@str.31 = [45 x i8] c"WARNING: EXE size is not a multiple of 2048!\00"
@str.32 = [27 x i8] c"ERROR: Not a PS-X EXE file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i8]
%4 = alloca [256 x i8]
%5 = alloca [12 x i32]
%6 = alloca i8
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = bitcast [12 x i32]* %5 to i8*
store i8 90, i8* %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%11 = icmp eq i32 %0, 2
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 (...) @usage()
br label %14
14: ; preds = %12, %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strncpy(i8* %8, i8* %16, i32 256)
%18 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32* %18, null
br i1 %20, label %40, label %21
21: ; preds = %14
%22 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 1
%24 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 2
%26 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 3
%28 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 4
%30 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 5
%32 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 6
%34 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 7
%36 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 8
store i8 0, i8* %37
%38 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 8)
%39 = icmp eq i64 %38, 0
br i1 %39, label %46, label %43
40: ; preds = %14
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %21
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.32, i64 0, i64 0))
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %21, %46
%47 = phi i64 [ %54, %46 ], [ 0, %21 ]
%48 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%49 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %23)
%50 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%51 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%52 = call i32 @char2int(i8* %7)
%53 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %47
store i32 %52, i32* %53
%54 = add nuw nsw i64 %47, 1
%55 = icmp eq i64 %54, 12
br i1 %55, label %56, label %46
56: ; preds = %46
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.29, i64 0, i64 0))
%58 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 1
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 2
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 3
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 4
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 5
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 6
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 7
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 8
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 9
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 10
%89 = load i32, i32* %88
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 11
%92 = load i32, i32* %91
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 %92)
%94 = load i32, i32* @SEEK_END
%95 = call i32 @fseek(i32* %18, i32 0, i32 %94)
%96 = call i32 @ftell(i32* %18)
%97 = add nsw i32 %96, -2048
%98 = and i32 %96, 2047
%99 = sub nuw nsw i32 2048, %98
%100 = icmp eq i32 %98, 0
br i1 %100, label %266, label %101
101: ; preds = %56
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.31, i64 0, i64 0))
br label %103
103: ; preds = %105, %101
%104 = phi i8 [ %109, %105 ], [ 90, %101 ]
switch i8 %104, label %105 [
i8 89, label %110
i8 78, label %266
]
105: ; preds = %103
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i8* %8)
%107 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* %6)
%108 = load i8, i8* %6
%109 = call signext i8 @toupper(i8 signext %108)
store i8 %109, i8* %6
br label %103
110: ; preds = %103
%111 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
%112 = add i32 %99, %97
store i32 %112, i32* %73
%113 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i64 8, i64 1, i32* %111)
%114 = load i32, i32* %58
%115 = call i32 @int2char(i32 %114, i8* %7)
%116 = load i8, i8* %7
%117 = zext i8 %116 to i32
%118 = load i8, i8* %23
%119 = zext i8 %118 to i32
%120 = load i8, i8* %25
%121 = zext i8 %120 to i32
%122 = load i8, i8* %27
%123 = zext i8 %122 to i32
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %117, i32 %119, i32 %121, i32 %123)
%125 = load i32, i32* %61
%126 = call i32 @int2char(i32 %125, i8* %7)
%127 = load i8, i8* %7
%128 = zext i8 %127 to i32
%129 = load i8, i8* %23
%130 = zext i8 %129 to i32
%131 = load i8, i8* %25
%132 = zext i8 %131 to i32
%133 = load i8, i8* %27
%134 = zext i8 %133 to i32
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %128, i32 %130, i32 %132, i32 %134)
%136 = load i32, i32* %64
%137 = call i32 @int2char(i32 %136, i8* %7)
%138 = load i8, i8* %7
%139 = zext i8 %138 to i32
%140 = load i8, i8* %23
%141 = zext i8 %140 to i32
%142 = load i8, i8* %25
%143 = zext i8 %142 to i32
%144 = load i8, i8* %27
%145 = zext i8 %144 to i32
%146 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %139, i32 %141, i32 %143, i32 %145)
%147 = load i32, i32* %67
%148 = call i32 @int2char(i32 %147, i8* %7)
%149 = load i8, i8* %7
%150 = zext i8 %149 to i32
%151 = load i8, i8* %23
%152 = zext i8 %151 to i32
%153 = load i8, i8* %25
%154 = zext i8 %153 to i32
%155 = load i8, i8* %27
%156 = zext i8 %155 to i32
%157 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %150, i32 %152, i32 %154, i32 %156)
%158 = load i32, i32* %70
%159 = call i32 @int2char(i32 %158, i8* %7)
%160 = load i8, i8* %7
%161 = zext i8 %160 to i32
%162 = load i8, i8* %23
%163 = zext i8 %162 to i32
%164 = load i8, i8* %25
%165 = zext i8 %164 to i32
%166 = load i8, i8* %27
%167 = zext i8 %166 to i32
%168 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %161, i32 %163, i32 %165, i32 %167)
%169 = load i32, i32* %73
%170 = call i32 @int2char(i32 %169, i8* %7)
%171 = load i8, i8* %7
%172 = zext i8 %171 to i32
%173 = load i8, i8* %23
%174 = zext i8 %173 to i32
%175 = load i8, i8* %25
%176 = zext i8 %175 to i32
%177 = load i8, i8* %27
%178 = zext i8 %177 to i32
%179 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %172, i32 %174, i32 %176, i32 %178)
%180 = load i32, i32* %76
%181 = call i32 @int2char(i32 %180, i8* %7)
%182 = load i8, i8* %7
%183 = zext i8 %182 to i32
%184 = load i8, i8* %23
%185 = zext i8 %184 to i32
%186 = load i8, i8* %25
%187 = zext i8 %186 to i32
%188 = load i8, i8* %27
%189 = zext i8 %188 to i32
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %183, i32 %185, i32 %187, i32 %189)
%191 = load i32, i32* %79
%192 = call i32 @int2char(i32 %191, i8* %7)
%193 = load i8, i8* %7
%194 = zext i8 %193 to i32
%195 = load i8, i8* %23
%196 = zext i8 %195 to i32
%197 = load i8, i8* %25
%198 = zext i8 %197 to i32
%199 = load i8, i8* %27
%200 = zext i8 %199 to i32
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %194, i32 %196, i32 %198, i32 %200)
%202 = load i32, i32* %82
%203 = call i32 @int2char(i32 %202, i8* %7)
%204 = load i8, i8* %7
%205 = zext i8 %204 to i32
%206 = load i8, i8* %23
%207 = zext i8 %206 to i32
%208 = load i8, i8* %25
%209 = zext i8 %208 to i32
%210 = load i8, i8* %27
%211 = zext i8 %210 to i32
%212 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %205, i32 %207, i32 %209, i32 %211)
%213 = load i32, i32* %85
%214 = call i32 @int2char(i32 %213, i8* %7)
%215 = load i8, i8* %7
%216 = zext i8 %215 to i32
%217 = load i8, i8* %23
%218 = zext i8 %217 to i32
%219 = load i8, i8* %25
%220 = zext i8 %219 to i32
%221 = load i8, i8* %27
%222 = zext i8 %221 to i32
%223 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %216, i32 %218, i32 %220, i32 %222)
%224 = load i32, i32* %88
%225 = call i32 @int2char(i32 %224, i8* %7)
%226 = load i8, i8* %7
%227 = zext i8 %226 to i32
%228 = load i8, i8* %23
%229 = zext i8 %228 to i32
%230 = load i8, i8* %25
%231 = zext i8 %230 to i32
%232 = load i8, i8* %27
%233 = zext i8 %232 to i32
%234 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %227, i32 %229, i32 %231, i32 %233)
%235 = load i32, i32* %91
%236 = call i32 @int2char(i32 %235, i8* %7)
%237 = load i8, i8* %7
%238 = zext i8 %237 to i32
%239 = load i8, i8* %23
%240 = zext i8 %239 to i32
%241 = load i8, i8* %25
%242 = zext i8 %241 to i32
%243 = load i8, i8* %27
%244 = zext i8 %243 to i32
%245 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %238, i32 %240, i32 %242, i32 %244)
%246 = load i32, i32* @SEEK_SET
%247 = call i32 @fseek(i32* %18, i32 56, i32 %246)
%248 = add i32 %96, -56
%249 = icmp eq i32 %248, 0
br i1 %249, label %258, label %250
250: ; preds = %110, %250
%251 = phi i32 [ %256, %250 ], [ 0, %110 ]
%252 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%253 = load i8, i8* %7
%254 = zext i8 %253 to i32
%255 = call i32 @fputc(i32 %254, i32* %111)
%256 = add nuw i32 %251, 1
%257 = icmp eq i32 %256, %248
br i1 %257, label %258, label %250
258: ; preds = %250, %110
br label %259
259: ; preds = %258, %259
%260 = phi i32 [ %262, %259 ], [ 0, %258 ]
%261 = call i32 @fputc(i32 0, i32* %111)
%262 = add nuw nsw i32 %260, 1
%263 = icmp eq i32 %262, %99
br i1 %263, label %264, label %259
264: ; preds = %259
%265 = call i32 @fclose(i32* %111)
br label %266
266: ; preds = %103, %264, %56
%267 = phi i32 [ %213, %264 ], [ %86, %56 ], [ %86, %103 ]
%268 = phi i32 [ %202, %264 ], [ %83, %56 ], [ %83, %103 ]
%269 = phi i32 [ %191, %264 ], [ %80, %56 ], [ %80, %103 ]
%270 = phi i32 [ %180, %264 ], [ %77, %56 ], [ %77, %103 ]
%271 = phi i32 [ %158, %264 ], [ %71, %56 ], [ %71, %103 ]
%272 = phi i32 [ %112, %264 ], [ %97, %56 ], [ %97, %103 ]
store i8 90, i8* %6
%273 = load i32, i32* %73
%274 = icmp eq i32 %272, %273
br i1 %274, label %430, label %275
275: ; preds = %266
%276 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.30, i64 0, i64 0))
%277 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0), i32 %273)
%278 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.27, i64 0, i64 0), i32 %272)
%279 = load i8, i8* %6
br label %280
280: ; preds = %282, %275
%281 = phi i8 [ %286, %282 ], [ %279, %275 ]
switch i8 %281, label %282 [
i8 89, label %287
i8 78, label %430
]
282: ; preds = %280
%283 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.28, i64 0, i64 0), i8* %8)
%284 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* %6)
%285 = load i8, i8* %6
%286 = call signext i8 @toupper(i8 signext %285)
store i8 %286, i8* %6
br label %280
287: ; preds = %280
%288 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
%289 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i64 8, i64 1, i32* %288)
%290 = load i32, i32* %58
%291 = call i32 @int2char(i32 %290, i8* %7)
%292 = load i8, i8* %7
%293 = zext i8 %292 to i32
%294 = load i8, i8* %23
%295 = zext i8 %294 to i32
%296 = load i8, i8* %25
%297 = zext i8 %296 to i32
%298 = load i8, i8* %27
%299 = zext i8 %298 to i32
%300 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %293, i32 %295, i32 %297, i32 %299)
%301 = load i32, i32* %61
%302 = call i32 @int2char(i32 %301, i8* %7)
%303 = load i8, i8* %7
%304 = zext i8 %303 to i32
%305 = load i8, i8* %23
%306 = zext i8 %305 to i32
%307 = load i8, i8* %25
%308 = zext i8 %307 to i32
%309 = load i8, i8* %27
%310 = zext i8 %309 to i32
%311 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %304, i32 %306, i32 %308, i32 %310)
%312 = load i32, i32* %64
%313 = call i32 @int2char(i32 %312, i8* %7)
%314 = load i8, i8* %7
%315 = zext i8 %314 to i32
%316 = load i8, i8* %23
%317 = zext i8 %316 to i32
%318 = load i8, i8* %25
%319 = zext i8 %318 to i32
%320 = load i8, i8* %27
%321 = zext i8 %320 to i32
%322 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %315, i32 %317, i32 %319, i32 %321)
%323 = load i32, i32* %67
%324 = call i32 @int2char(i32 %323, i8* %7)
%325 = load i8, i8* %7
%326 = zext i8 %325 to i32
%327 = load i8, i8* %23
%328 = zext i8 %327 to i32
%329 = load i8, i8* %25
%330 = zext i8 %329 to i32
%331 = load i8, i8* %27
%332 = zext i8 %331 to i32
%333 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %326, i32 %328, i32 %330, i32 %332)
%334 = call i32 @int2char(i32 %271, i8* %7)
%335 = load i8, i8* %7
%336 = zext i8 %335 to i32
%337 = load i8, i8* %23
%338 = zext i8 %337 to i32
%339 = load i8, i8* %25
%340 = zext i8 %339 to i32
%341 = load i8, i8* %27
%342 = zext i8 %341 to i32
%343 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %336, i32 %338, i32 %340, i32 %342)
%344 = call i32 @int2char(i32 %272, i8* %7)
%345 = load i8, i8* %7
%346 = zext i8 %345 to i32
%347 = load i8, i8* %23
%348 = zext i8 %347 to i32
%349 = load i8, i8* %25
%350 = zext i8 %349 to i32
%351 = load i8, i8* %27
%352 = zext i8 %351 to i32
%353 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %346, i32 %348, i32 %350, i32 %352)
%354 = call i32 @int2char(i32 %270, i8* %7)
%355 = load i8, i8* %7
%356 = zext i8 %355 to i32
%357 = load i8, i8* %23
%358 = zext i8 %357 to i32
%359 = load i8, i8* %25
%360 = zext i8 %359 to i32
%361 = load i8, i8* %27
%362 = zext i8 %361 to i32
%363 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %356, i32 %358, i32 %360, i32 %362)
%364 = call i32 @int2char(i32 %269, i8* %7)
%365 = load i8, i8* %7
%366 = zext i8 %365 to i32
%367 = load i8, i8* %23
%368 = zext i8 %367 to i32
%369 = load i8, i8* %25
%370 = zext i8 %369 to i32
%371 = load i8, i8* %27
%372 = zext i8 %371 to i32
%373 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %366, i32 %368, i32 %370, i32 %372)
%374 = call i32 @int2char(i32 %268, i8* %7)
%375 = load i8, i8* %7
%376 = zext i8 %375 to i32
%377 = load i8, i8* %23
%378 = zext i8 %377 to i32
%379 = load i8, i8* %25
%380 = zext i8 %379 to i32
%381 = load i8, i8* %27
%382 = zext i8 %381 to i32
%383 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %376, i32 %378, i32 %380, i32 %382)
%384 = call i32 @int2char(i32 %267, i8* %7)
%385 = load i8, i8* %7
%386 = zext i8 %385 to i32
%387 = load i8, i8* %23
%388 = zext i8 %387 to i32
%389 = load i8, i8* %25
%390 = zext i8 %389 to i32
%391 = load i8, i8* %27
%392 = zext i8 %391 to i32
%393 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %386, i32 %388, i32 %390, i32 %392)
%394 = load i32, i32* %88
%395 = call i32 @int2char(i32 %394, i8* %7)
%396 = load i8, i8* %7
%397 = zext i8 %396 to i32
%398 = load i8, i8* %23
%399 = zext i8 %398 to i32
%400 = load i8, i8* %25
%401 = zext i8 %400 to i32
%402 = load i8, i8* %27
%403 = zext i8 %402 to i32
%404 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %397, i32 %399, i32 %401, i32 %403)
%405 = load i32, i32* %91
%406 = call i32 @int2char(i32 %405, i8* %7)
%407 = load i8, i8* %7
%408 = zext i8 %407 to i32
%409 = load i8, i8* %23
%410 = zext i8 %409 to i32
%411 = load i8, i8* %25
%412 = zext i8 %411 to i32
%413 = load i8, i8* %27
%414 = zext i8 %413 to i32
%415 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 %408, i32 %410, i32 %412, i32 %414)
%416 = load i32, i32* @SEEK_SET
%417 = call i32 @fseek(i32* %18, i32 56, i32 %416)
%418 = add i32 %272, 1992
%419 = icmp eq i32 %418, 0
br i1 %419, label %428, label %420
420: ; preds = %287, %420
%421 = phi i32 [ %426, %420 ], [ 0, %287 ]
%422 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%423 = load i8, i8* %7
%424 = zext i8 %423 to i32
%425 = call i32 @fputc(i32 %424, i32* %288)
%426 = add nuw i32 %421, 1
%427 = icmp eq i32 %426, %418
br i1 %427, label %428, label %420
428: ; preds = %420, %287
%429 = call i32 @fclose(i32* %288)
br label %430
430: ; preds = %280, %428, %266
%431 = call i32 @fclose(i32* %18)
ret i32 0
}