#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 */

/* Variables and functions */
int /*<<< orphan*/ dskbcr_(int *, int *);
int /*<<< orphan*/ dskbor_(int *, char *, int *, int *);
int /*<<< orphan*/ dskbr_(int *, char *, int *, int *);
int /*<<< orphan*/ dskbwr_(int *, int *);
int filec_getdebug();
int getbo();
int /*<<< orphan*/ gethd(char *, char *, char *);
int /*<<< orphan*/ gethdl(int *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puthd(char *, char *, char *);
int sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ swpbyt(int /*<<< orphan*/, int, char *);
int rdmad(char *filename, char *head, short *array, int as1, int as2, int *is1,
          int *is2) {
  int readl, remain;
  int i, j, k;
  int istat, lhead, bo, dim;
  char s[80], byteo[80];
  int lun = 1;
  int lflag;
  unsigned char lsb[10 * 1024], msb[10 * 1024];
  unsigned char *lp, *mp, *alp, *amp;
  int lstart, mstart;
  int llen, n, val;
  int filec_debug = filec_getdebug();
  j = strlen(filename);
  if (filec_debug)
    printf("Opening file: %s\n", filename);
  dskbor_(&lun, filename, &j, &istat);
  if (istat != 0)
    return (istat);
  lflag = (1 == 1);
  if (filec_debug)
    printf("Reading header\n");
  dskbwr_(&lun, &lflag);
  readl = 512;
  dskbr_(&lun, head, &readl, &istat);
  if (filec_debug)
    printf("Read Completion status : %d\n", istat);
  if (istat != 0)
    goto close;
  gethdl(&lhead, head);
  if (filec_debug)
    printf("Header length : %d\n", lhead);
  readl = lhead - 512;
  if (readl > 0) {
    dskbr_(&lun, head + 512, &readl, &istat);
    if (istat != 0)
      goto close;
  }
  lflag = (1 == 0);
  dskbwr_(&lun, &lflag);
  gethd("TYPE", s, head);
  if (filec_debug)
    printf("Type >%s<\n", s);
  if (strcmp(s, "mad") == 0 || strcmp(s, "unsigned_short") == 0) {
    gethd("BYTE_ORDER", byteo, head);
    gethd("SIZE1", s, head);
    if (*s == 0 || sscanf(s, "%d", is1) != 1)
      goto close;
    gethd("SIZE2", s, head);
    if (*s == 0 || sscanf(s, "%d", is2) != 1)
      goto close;
    gethd("DIM", s, head);
    if (*s == 0 || sscanf(s, "%d", &dim) != 1)
      goto close;
    if (filec_debug)
      printf("Image size %d %d %d\n", *is1, *is2, dim);
    if (*is1 == as1) {
      if (filec_debug)
        printf("Reading in single chunk\n");
      readl = (*is1) * (*is2) * 2;
      dskbr_(&lun, (char *)array, &readl, &istat);
      if (filec_debug)
        printf("Read Completion status : %d\n", istat);
      if (istat != 0)
        goto close;
    } else {
      if (filec_debug)
        printf("Reading one line at a time\n");
      readl = *is1 * 2;
      for (j = 0; j < *is2; j++) {
        dskbr_(&lun, (char *)(array + j * as1), &readl, &istat);
        if (istat != 0)
          goto close;
      }
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (*byteo) {
      if (strcmp(byteo, "little_endian") == 0)
        bo = 0;
      else if (strcmp(byteo, "big_endian") == 0)
        bo = 1;
      else {
        istat = -2;
        goto close;
      }
    }
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      for (j = 0; j < *is2; j++)
        swpbyt(0, 2 * *is1, (char *)(array + j * as1));
    }
  } else if (strcmp(s, "swap_rlmsb") == 0) {
    gethd("SIZE1", s, head);
    if (*s == 0 || sscanf(s, "%d", is1) != 1)
      goto close;
    gethd("SIZE2", s, head);
    if (*s == 0 || sscanf(s, "%d", is2) != 1)
      goto close;
    gethd("DIM", s, head);
    if (*s == 0 || sscanf(s, "%d", &dim) != 1)
      goto close;
    bo = getbo();
    if (bo == 0) {
      lstart = 0;
      mstart = 1;
    } else if (bo == 1) {
      lstart = 1;
      mstart = 0;
    }
    llen = 2;
    dskbr_(&lun, (char *)lsb, &llen, &istat);
    if (istat != 0)
      goto close;
    llen = (int)lsb[llen - 2] * 256 + lsb[llen - 1];
    for (j = 0; j < (*is2 - 1); j++) {
      if (filec_debug)
        printf("Reading %d bytes\n", llen);
      dskbr_(&lun, (char *)lsb, &llen, &istat);
      if (istat != 0)
        goto close;
      if (filec_debug)
        printf("Uncompressing %d bytes\n", llen - (*is1) - 2);
      for (lp = lsb + (*is1), mp = msb; lp < lsb + llen - 2;) {
        n = *lp++;
        val = *lp++;
        for (i = 0; i < n; i++)
          *mp++ = val;
      }
      if (filec_debug)
        printf("Restored %d bytes in MSB\n", mp - msb);
      alp = (unsigned char *)array + 2 * j * as1 + lstart;
      amp = (unsigned char *)array + 2 * j * as1 + mstart;
      for (lp = lsb, mp = msb; lp < lsb + (*is1); alp += 2, amp += 2) {
        *alp = *lp++;
        *amp = *mp++;
      }
      if (filec_debug) {
        printf("Done line %d\n", j);
        printf("=================================\n");
      }
      llen = (int)lsb[llen - 2] * 256 + lsb[llen - 1];
    }
    llen -= 2;
    dskbr_(&lun, (char *)lsb, &llen, &istat);
    if (istat != 0)
      goto close;
    for (lp = lsb + (*is1), mp = msb; lp < lsb + llen;) {
      n = *lp++;
      val = *lp++;
      for (i = 0; i < n; i++)
        *mp++ = val;
    }
    if (filec_debug)
      printf("Restored %d bytes in MSB\n", mp - msb);
    alp = (unsigned char *)array + 2 * j * as1 + lstart;
    amp = (unsigned char *)array + 2 * j * as1 + mstart;
    for (lp = lsb, mp = msb; lp < lsb + (*is1); alp += 2, amp += 2) {
      *alp = *lp++;
      *amp = *mp++;
    }
    if (filec_debug)
      printf("===================================\n");
    puthd("TYPE", "unsigned_short", head);
  } else {
    if (filec_debug)
      printf("Unsupported Filetype (%s)\n");
    istat = -2;
    goto close;
  }
close:
  if (filec_debug)
    printf("Done reading Image size %d %d (%d)\n", *is1, *is2, istat);
  if (istat != 0)
    dskbcr_(&lun, &i);
  else
    dskbcr_(&lun, &istat);
  if (filec_debug)
    printf("RDFILE completion status %d\n", istat);
  return (istat);
}


x86 assembly (clang, -O0):
<rdmad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5150,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x1,-0x104(%rbp)
mov    $0x0,%al
call   1030 <filec_getdebug@plt>
mov    %eax,-0x5148(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x5148(%rbp)
je     1248 <rdmad+0x68>
mov    -0x10(%rbp),%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1050 <dskbor_@plt>
cmpl   $0x0,-0x48(%rbp)
je     1275 <rdmad+0x95>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1eff <rdmad+0xd1f>
movl   $0x1,-0x108(%rbp)
cmpl   $0x0,-0x5148(%rbp)
je     129a <rdmad+0xba>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x104(%rbp),%rdi
lea    -0x108(%rbp),%rsi
call   10b0 <dskbwr_@plt>
movl   $0x200,-0x34(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x34(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x5148(%rbp)
je     12ea <rdmad+0x10a>
mov    -0x48(%rbp),%esi
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     12f9 <rdmad+0x119>
jmp    1e82 <rdmad+0xca2>
mov    -0x18(%rbp),%rsi
lea    -0x4c(%rbp),%rdi
call   10e0 <gethdl@plt>
cmpl   $0x0,-0x5148(%rbp)
je     1324 <rdmad+0x144>
mov    -0x4c(%rbp),%esi
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4c(%rbp),%eax
sub    $0x200,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jle    136c <rdmad+0x18c>
mov    -0x18(%rbp),%rsi
add    $0x200,%rsi
lea    -0x104(%rbp),%rdi
lea    -0x34(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x48(%rbp)
je     1367 <rdmad+0x187>
jmp    1e82 <rdmad+0xca2>
jmp    136c <rdmad+0x18c>
movl   $0x0,-0x108(%rbp)
lea    -0x104(%rbp),%rdi
lea    -0x108(%rbp),%rsi
call   10b0 <dskbwr_@plt>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xcb8(%rip),%rdi
call   10d0 <gethd@plt>
cmpl   $0x0,-0x5148(%rbp)
je     13c2 <rdmad+0x1e2>
lea    -0xb0(%rbp),%rsi
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xc93(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     13fc <rdmad+0x21c>
lea    -0xb0(%rbp),%rdi
lea    0xc7a(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1753 <rdmad+0x573>
lea    -0x100(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xc68(%rip),%rdi
call   10d0 <gethd@plt>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xc5c(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     145a <rdmad+0x27a>
lea    -0xb0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xc3b(%rip),%rsi
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     145f <rdmad+0x27f>
jmp    1e82 <rdmad+0xca2>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xc19(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     14a6 <rdmad+0x2c6>
lea    -0xb0(%rbp),%rdi
mov    0x10(%rbp),%rdx
lea    0xbef(%rip),%rsi
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     14ab <rdmad+0x2cb>
jmp    1e82 <rdmad+0xca2>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xbd3(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     14f2 <rdmad+0x312>
lea    -0xb0(%rbp),%rdi
lea    0xba7(%rip),%rsi
lea    -0x54(%rbp),%rdx
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     14f7 <rdmad+0x317>
jmp    1e82 <rdmad+0xca2>
cmpl   $0x0,-0x5148(%rbp)
je     1521 <rdmad+0x341>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x54(%rbp),%ecx
lea    0xb7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
cmp    -0x24(%rbp),%eax
jne    15a8 <rdmad+0x3c8>
cmpl   $0x0,-0x5148(%rbp)
je     154b <rdmad+0x36b>
lea    0xb65(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
imul   (%rcx),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x34(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x5148(%rbp)
je     1594 <rdmad+0x3b4>
mov    -0x48(%rbp),%esi
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     15a3 <rdmad+0x3c3>
jmp    1e82 <rdmad+0xca2>
jmp    1634 <rdmad+0x454>
cmpl   $0x0,-0x5148(%rbp)
je     15c3 <rdmad+0x3e3>
lea    0xb06(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    162f <rdmad+0x44f>
mov    -0x20(%rbp),%rsi
mov    -0x40(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%rsi
lea    -0x104(%rbp),%rdi
lea    -0x34(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x48(%rbp)
je     161c <rdmad+0x43c>
jmp    1e82 <rdmad+0xca2>
jmp    1621 <rdmad+0x441>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    15d6 <rdmad+0x3f6>
jmp    1634 <rdmad+0x454>
movl   $0x1,-0x108(%rbp)
lea    -0x104(%rbp),%rdi
lea    -0x108(%rbp),%rsi
call   10b0 <dskbwr_@plt>
cmpb   $0x0,-0x100(%rbp)
je     16c6 <rdmad+0x4e6>
lea    -0x100(%rbp),%rdi
lea    0xa72(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1687 <rdmad+0x4a7>
movl   $0x0,-0x50(%rbp)
jmp    16c1 <rdmad+0x4e1>
lea    -0x100(%rbp),%rdi
lea    0xa57(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    16b0 <rdmad+0x4d0>
movl   $0x1,-0x50(%rbp)
jmp    16bc <rdmad+0x4dc>
movl   $0xfffffffe,-0x48(%rbp)
jmp    1e82 <rdmad+0xca2>
jmp    16c1 <rdmad+0x4e1>
jmp    16c6 <rdmad+0x4e6>
mov    -0x50(%rbp),%eax
mov    %eax,-0x514c(%rbp)
mov    $0x0,%al
call   1100 <getbo@plt>
mov    %eax,%ecx
mov    -0x514c(%rbp),%eax
cmp    %ecx,%eax
je     174e <rdmad+0x56e>
cmpl   $0x0,-0x5148(%rbp)
je     1701 <rdmad+0x521>
lea    0x9fd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1749 <rdmad+0x569>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
shl    $0x1,%esi
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%rdx
xor    %edi,%edi
call   1090 <swpbyt@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1708 <rdmad+0x528>
jmp    174e <rdmad+0x56e>
jmp    1e7d <rdmad+0xc9d>
lea    -0xb0(%rbp),%rdi
lea    0x9a6(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1e51 <rdmad+0xc71>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x8ff(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     17b7 <rdmad+0x5d7>
lea    -0xb0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0x8de(%rip),%rsi
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     17bc <rdmad+0x5dc>
jmp    1e82 <rdmad+0xca2>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x8bc(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     1803 <rdmad+0x623>
lea    -0xb0(%rbp),%rdi
mov    0x10(%rbp),%rdx
lea    0x892(%rip),%rsi
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1808 <rdmad+0x628>
jmp    1e82 <rdmad+0xca2>
lea    -0xb0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x876(%rip),%rdi
call   10d0 <gethd@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x0,%eax
je     184f <rdmad+0x66f>
lea    -0xb0(%rbp),%rdi
lea    0x84a(%rip),%rsi
lea    -0x54(%rbp),%rdx
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1854 <rdmad+0x674>
jmp    1e82 <rdmad+0xca2>
mov    $0x0,%al
call   1100 <getbo@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1881 <rdmad+0x6a1>
movl   $0x0,-0x5134(%rbp)
movl   $0x1,-0x5138(%rbp)
jmp    18a4 <rdmad+0x6c4>
cmpl   $0x1,-0x50(%rbp)
jne    189f <rdmad+0x6bf>
movl   $0x1,-0x5134(%rbp)
movl   $0x0,-0x5138(%rbp)
jmp    18a4 <rdmad+0x6c4>
movl   $0x2,-0x513c(%rbp)
lea    -0x2910(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x513c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x48(%rbp)
je     18db <rdmad+0x6fb>
jmp    1e82 <rdmad+0xca2>
mov    -0x513c(%rbp),%eax
sub    $0x2,%eax
cltq
movzbl -0x2910(%rbp,%rax,1),%eax
ff
shl    $0x8,%eax
mov    -0x513c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl -0x2910(%rbp,%rcx,1),%ecx
ff
add    %ecx,%eax
mov    %eax,-0x513c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1bf7 <rdmad+0xa17>
cmpl   $0x0,-0x5148(%rbp)
je     1949 <rdmad+0x769>
mov    -0x513c(%rbp),%esi
lea    0x7d0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x2910(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x513c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x48(%rbp)
je     1976 <rdmad+0x796>
jmp    1e82 <rdmad+0xca2>
cmpl   $0x0,-0x5148(%rbp)
je     19a0 <rdmad+0x7c0>
mov    -0x513c(%rbp),%esi
mov    -0x30(%rbp),%rax
sub    (%rax),%esi
sub    $0x2,%esi
lea    0x78b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x2910(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x5118(%rbp)
lea    -0x5110(%rbp),%rax
mov    %rax,-0x5120(%rbp)
mov    -0x5118(%rbp),%rax
lea    -0x2910(%rbp),%rcx
movslq -0x513c(%rbp),%rdx
add    %rdx,%rcx
add    $0xfffffffffffffffe,%rcx
cmp    %rcx,%rax
jae    1a6f <rdmad+0x88f>
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x5140(%rbp)
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x5144(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x5140(%rbp),%eax
jge    1a6a <rdmad+0x88a>
mov    -0x5144(%rbp),%eax
mov    %al,%cl
mov    -0x5120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x5120(%rbp)
mov    %cl,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1a2e <rdmad+0x84e>
jmp    19c6 <rdmad+0x7e6>
cmpl   $0x0,-0x5148(%rbp)
je     1a9b <rdmad+0x8bb>
mov    -0x5120(%rbp),%rsi
lea    -0x5110(%rbp),%rax
sub    %rax,%rsi
lea    0x6a8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x5134(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x5128(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x5138(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x5130(%rbp)
lea    -0x2910(%rbp),%rax
mov    %rax,-0x5118(%rbp)
lea    -0x5110(%rbp),%rax
mov    %rax,-0x5120(%rbp)
mov    -0x5118(%rbp),%rax
lea    -0x2910(%rbp),%rcx
mov    -0x30(%rbp),%rdx
movslq (%rdx),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1b8b <rdmad+0x9ab>
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
mov    (%rax),%cl
mov    -0x5128(%rbp),%rax
mov    %cl,(%rax)
mov    -0x5120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5120(%rbp)
mov    (%rax),%cl
mov    -0x5130(%rbp),%rax
mov    %cl,(%rax)
mov    -0x5128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x5128(%rbp)
mov    -0x5130(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x5130(%rbp)
jmp    1b01 <rdmad+0x921>
cmpl   $0x0,-0x5148(%rbp)
je     1bb7 <rdmad+0x9d7>
mov    -0x40(%rbp),%esi
lea    0x5b4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x5b6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x513c(%rbp),%eax
sub    $0x2,%eax
cltq
movzbl -0x2910(%rbp,%rax,1),%eax
ff
shl    $0x8,%eax
mov    -0x513c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl -0x2910(%rbp,%rcx,1),%ecx
ff
add    %ecx,%eax
mov    %eax,-0x513c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1914 <rdmad+0x734>
mov    -0x513c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x513c(%rbp)
lea    -0x2910(%rbp),%rsi
lea    -0x104(%rbp),%rdi
lea    -0x513c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <dskbr_@plt>
cmpl   $0x0,-0x48(%rbp)
je     1c33 <rdmad+0xa53>
jmp    1e82 <rdmad+0xca2>
lea    -0x2910(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x5118(%rbp)
lea    -0x5110(%rbp),%rax
mov    %rax,-0x5120(%rbp)
mov    -0x5118(%rbp),%rax
lea    -0x2910(%rbp),%rcx
movslq -0x513c(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1cfe <rdmad+0xb1e>
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x5140(%rbp)
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x5144(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x5140(%rbp),%eax
jge    1cf9 <rdmad+0xb19>
mov    -0x5144(%rbp),%eax
mov    %al,%cl
mov    -0x5120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x5120(%rbp)
mov    %cl,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1cbd <rdmad+0xadd>
jmp    1c59 <rdmad+0xa79>
cmpl   $0x0,-0x5148(%rbp)
je     1d2a <rdmad+0xb4a>
mov    -0x5120(%rbp),%rsi
lea    -0x5110(%rbp),%rax
sub    %rax,%rsi
lea    0x419(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x5134(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x5128(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x5138(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x5130(%rbp)
lea    -0x2910(%rbp),%rax
mov    %rax,-0x5118(%rbp)
lea    -0x5110(%rbp),%rax
mov    %rax,-0x5120(%rbp)
mov    -0x5118(%rbp),%rax
lea    -0x2910(%rbp),%rcx
mov    -0x30(%rbp),%rdx
movslq (%rdx),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1e1a <rdmad+0xc3a>
mov    -0x5118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5118(%rbp)
mov    (%rax),%cl
mov    -0x5128(%rbp),%rax
mov    %cl,(%rax)
mov    -0x5120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x5120(%rbp)
mov    (%rax),%cl
mov    -0x5130(%rbp),%rax
mov    %cl,(%rax)
mov    -0x5128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x5128(%rbp)
mov    -0x5130(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x5130(%rbp)
jmp    1d90 <rdmad+0xbb0>
cmpl   $0x0,-0x5148(%rbp)
je     1e35 <rdmad+0xc55>
lea    0x336(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdx
lea    0x213(%rip),%rdi
lea    0x220(%rip),%rsi
call   1080 <puthd@plt>
jmp    1e78 <rdmad+0xc98>
cmpl   $0x0,-0x5148(%rbp)
je     1e6c <rdmad+0xc8c>
lea    0x324(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffe,-0x48(%rbp)
jmp    1e82 <rdmad+0xca2>
jmp    1e7d <rdmad+0xc9d>
jmp    1e82 <rdmad+0xca2>
cmpl   $0x0,-0x5148(%rbp)
je     1eac <rdmad+0xccc>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x48(%rbp),%ecx
lea    0x2ff(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     1ecb <rdmad+0xceb>
lea    -0x104(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
call   1060 <dskbcr_@plt>
jmp    1edb <rdmad+0xcfb>
lea    -0x104(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1060 <dskbcr_@plt>
cmpl   $0x0,-0x5148(%rbp)
je     1ef9 <rdmad+0xd19>
mov    -0x48(%rbp),%esi
lea    0x2d6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdmad>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50b8,%rsp
mov    %r9,%r14
mov    %ecx,0x20(%rsp)
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbp
movl   $0x1,0x10(%rsp)
xor    %eax,%eax
call   1030 <filec_getdebug@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,0x14(%rsp)
test   %r15d,%r15d
je     1245 <rdmad+0x55>
lea    0xdc5(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%rbx
mov    %rbp,%rsi
mov    %rbx,%rcx
call   1060 <dskbor_@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jne    1c0d <rdmad+0xa1d>
movl   $0x1,0x24(%rsp)
test   %r15d,%r15d
je     12f7 <rdmad+0x107>
mov    %r13,0x28(%rsp)
lea    0xf4d(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbp
lea    0x24(%rsp),%rsi
mov    %rbp,%rdi
call   10c0 <dskbwr_@plt>
movl   $0x200,0x18(%rsp)
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1100 <dskbr_@plt>
mov    0x8(%rsp),%esi
lea    0xd4f(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jne    1bbc <rdmad+0x9cc>
lea    0x30(%rsp),%rdi
mov    %r12,%rsi
call   10f0 <gethdl@plt>
mov    0x30(%rsp),%esi
lea    0xd41(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1349 <rdmad+0x159>
lea    0x10(%rsp),%rbp
lea    0x24(%rsp),%rsi
mov    %rbp,%rdi
call   10c0 <dskbwr_@plt>
movl   $0x200,0x18(%rsp)
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
je     1337 <rdmad+0x147>
lea    0x1c(%rsp),%r13
jmp    1be5 <rdmad+0x9f5>
mov    %r13,0x28(%rsp)
lea    0x30(%rsp),%rdi
mov    %r12,%rsi
call   10f0 <gethdl@plt>
mov    0x30(%rsp),%eax
lea    -0x200(%rax),%ecx
mov    %ecx,0x18(%rsp)
cmp    $0x201,%eax
jl     1385 <rdmad+0x195>
lea    0x200(%r12),%rsi
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
jne    1bb3 <rdmad+0x9c3>
movl   $0x0,0x24(%rsp)
lea    0x10(%rsp),%rdi
lea    0x24(%rsp),%rsi
call   10c0 <dskbwr_@plt>
lea    0xca0(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
test   %r15d,%r15d
je     13c8 <rdmad+0x1d8>
lea    0xc8c(%rip),%rdi
lea    0x40(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc84(%rip),%rsi
lea    0x40(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     142e <rdmad+0x23e>
lea    0xc72(%rip),%rsi
lea    0x40(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     142e <rdmad+0x23e>
lea    0xcb7(%rip),%rsi
lea    0x40(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1582 <rdmad+0x392>
test   %r15d,%r15d
je     1421 <rdmad+0x231>
lea    0xcf5(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
movl   $0xfffffffe,0x8(%rsp)
ff
jmp    1bb3 <rdmad+0x9c3>
lea    0xc31(%rip),%rdi
lea    0xb0(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
lea    0xc25(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xc0c(%rip),%rsi
lea    0x40(%rsp),%rdi
mov    %r14,%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
lea    0xbf2(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xbd0(%rip),%rsi
lea    0x40(%rsp),%rdi
mov    0x50f0(%rsp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
lea    0xbb7(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xb8f(%rip),%rsi
lea    0x40(%rsp),%rdi
lea    0x34(%rsp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
mov    (%r14),%esi
test   %r15d,%r15d
je     1661 <rdmad+0x471>
mov    0x50f0(%rsp),%rbp
mov    0x0(%rbp),%edx
mov    0x34(%rsp),%ecx
lea    0xb62(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x20(%rsp),%eax
cmp    %eax,(%r14)
mov    0x28(%rsp),%r12
jne    16a3 <rdmad+0x4b3>
lea    0xc77(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%eax
imul   0x0(%rbp),%eax
add    %eax,%eax
mov    %eax,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r12,%rsi
call   1100 <dskbr_@plt>
mov    0x8(%rsp),%esi
lea    0xa9c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1696 <rdmad+0x4a6>
lea    0xae8(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xacf(%rip),%rsi
lea    0x40(%rsp),%rdi
mov    %r14,%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
lea    0xab5(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xa93(%rip),%rsi
lea    0x40(%rsp),%rdi
mov    0x50f0(%rsp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
lea    0xa7a(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
call   10e0 <gethd@plt>
cmpb   $0x0,0x40(%rsp)
je     1bb3 <rdmad+0x9c3>
lea    0xa52(%rip),%rsi
lea    0x40(%rsp),%rdi
lea    0x34(%rsp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1bb3 <rdmad+0x9c3>
xor    %ebp,%ebp
xor    %eax,%eax
call   1110 <getbo@plt>
test   %eax,%eax
je     17f3 <rdmad+0x603>
cmp    $0x1,%eax
jne    17fa <rdmad+0x60a>
mov    $0x1,%ebp
jmp    17fc <rdmad+0x60c>
cmp    0x20(%rsp),%esi
mov    0x50f0(%rsp),%rbp
jne    16b2 <rdmad+0x4c2>
mov    0x0(%rbp),%eax
imul   0x20(%rsp),%eax
add    %eax,%eax
mov    %eax,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    0x28(%rsp),%rsi
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
jne    1bb3 <rdmad+0x9c3>
jmp    1717 <rdmad+0x527>
lea    0xaf4(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%esi
add    %esi,%esi
mov    %esi,0x18(%rsp)
movl   $0x0,0x14(%rsp)
cmpl   $0x0,0x0(%rbp)
jle    1717 <rdmad+0x527>
xor    %eax,%eax
lea    0x10(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x8(%rsp),%rbp
imul   0x20(%rsp),%eax
cltq
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,2),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
jne    1bb3 <rdmad+0x9c3>
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x14(%rsp)
mov    0x50f0(%rsp),%rcx
cmp    (%rcx),%eax
jl     16d7 <rdmad+0x4e7>
movl   $0x1,0x24(%rsp)
lea    0x10(%rsp),%rdi
lea    0x24(%rsp),%rsi
call   10c0 <dskbwr_@plt>
cmpb   $0x0,0xb0(%rsp)
je     1775 <rdmad+0x585>
lea    0x95a(%rip),%rsi
lea    0xb0(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     177e <rdmad+0x58e>
lea    0x94f(%rip),%rsi
lea    0xb0(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1421 <rdmad+0x231>
mov    $0x1,%ebp
jmp    1780 <rdmad+0x590>
xor    %eax,%eax
call   1110 <getbo@plt>
jmp    178f <rdmad+0x59f>
xor    %ebp,%ebp
xor    %eax,%eax
call   1110 <getbo@plt>
cmp    %eax,%ebp
je     1bb3 <rdmad+0x9c3>
test   %r15d,%r15d
je     17a0 <rdmad+0x5b0>
lea    0x9f4(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,0x14(%rsp)
mov    0x50f0(%rsp),%rax
cmpl   $0x0,(%rax)
jle    1bb3 <rdmad+0x9c3>
xor    %eax,%eax
mov    (%r14),%esi
add    %esi,%esi
imul   0x20(%rsp),%eax
cltq
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,2),%rdx
xor    %edi,%edi
call   10a0 <swpbyt@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x14(%rsp)
mov    0x50f0(%rsp),%rcx
cmp    (%rcx),%eax
jl     17bb <rdmad+0x5cb>
jmp    1bb3 <rdmad+0x9c3>
mov    $0x1,%eax
jmp    17fe <rdmad+0x60e>
xor    %ebp,%ebp
xor    %eax,%eax
mov    %rax,0x38(%rsp)
movl   $0x2,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xb0(%rsp),%r13
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r13,%rsi
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
jne    1bb3 <rdmad+0x9c3>
movslq 0xc(%rsp),%rax
movzwl -0x2(%rax,%r13,1),%esi
shl    $0x10,%esi
bswap  %esi
mov    %esi,0xc(%rsp)
movl   $0x0,0x14(%rsp)
mov    0x50f0(%rsp),%rax
cmpl   $0x2,(%rax)
mov    %rbp,0x98(%rsp)
jl     1a73 <rdmad+0x883>
mov    0x28(%rsp),%rax
mov    0x38(%rsp),%rcx
add    %rax,%rcx
mov    %rcx,0xa8(%rsp)
add    %rbp,%rax
mov    %rax,0xa0(%rsp)
lea    0x1c(%rsp),%r13
lea    0x28b0(%rsp),%rbp
jmp    18d8 <rdmad+0x6e8>
movslq 0xc(%rsp),%rax
lea    0xb0(%rsp),%rcx
movzwl -0x2(%rax,%rcx,1),%esi
shl    $0x10,%esi
bswap  %esi
mov    %esi,0xc(%rsp)
add    $0x1,%ebp
mov    %ebp,0x14(%rsp)
mov    0x50f0(%rsp),%rax
mov    (%rax),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
lea    0x28b0(%rsp),%rbp
jge    1a73 <rdmad+0x883>
test   %r15d,%r15d
je     192d <rdmad+0x73d>
lea    0x7d9(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0xb0(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1100 <dskbr_@plt>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jne    1bbc <rdmad+0x9cc>
mov    0xc(%rsp),%esi
sub    (%r14),%esi
add    $0xfffffffe,%esi
lea    0x7ab(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1954 <rdmad+0x764>
lea    0x10(%rsp),%rdi
lea    0xb0(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
jne    1be5 <rdmad+0x9f5>
movslq (%r14),%rax
add    %rsp,%rax
add    $0xb0,%rax
movslq 0xc(%rsp),%rdi
lea    (%rsp,%rdi,1),%rcx
add    $0xae,%rcx
mov    %rbp,%rsi
cmp    %rcx,%rax
jae    19cb <rdmad+0x7db>
mov    %rbp,%rsi
jmp    198f <rdmad+0x79f>
movslq %edi,%rcx
add    %rsp,%rcx
add    $0xae,%rcx
cmp    %rcx,%rax
jae    19cb <rdmad+0x7db>
movzbl (%rax),%edx
mov    0x1(%rax),%cl
add    $0x2,%rax
movl   $0x0,0x1c(%rsp)
test   %edx,%edx
je     197d <rdmad+0x78d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %cl,(%rsi)
add    $0x1,%rsi
mov    0x1c(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x1c(%rsp)
cmp    %edx,%edi
jl     19b0 <rdmad+0x7c0>
mov    0xc(%rsp),%edi
jmp    197d <rdmad+0x78d>
test   %r15d,%r15d
je     19e1 <rdmad+0x7f1>
sub    %rbp,%rsi
lea    0x70d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x14(%rsp),%ebp
cmpl   $0x0,(%r14)
jle    1a45 <rdmad+0x855>
mov    %ebp,%ecx
imul   0x20(%rsp),%ecx
movslq %ecx,%rdx
mov    0xa8(%rsp),%rax
lea    (%rax,%rdx,2),%rcx
mov    0xa0(%rsp),%rax
lea    (%rax,%rdx,2),%rdx
xor    %esi,%esi
movzbl 0xb0(%rsp,%rsi,1),%eax
mov    %al,(%rdx,%rsi,2)
movzbl 0x28b0(%rsp,%rsi,1),%eax
mov    %al,(%rcx,%rsi,2)
movslq (%r14),%rax
add    %rsp,%rax
add    $0xb0,%rax
lea    (%rsp,%rsi,1),%rdi
add    $0xb1,%rdi
add    $0x1,%rsi
cmp    %rax,%rdi
jb     1a0f <rdmad+0x81f>
test   %r15d,%r15d
je     1899 <rdmad+0x6a9>
lea    0x6ac(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x708(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%ebp
jmp    1899 <rdmad+0x6a9>
add    $0xfffffffe,%esi
mov    %esi,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xb0(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1100 <dskbr_@plt>
cmpl   $0x0,0x8(%rsp)
mov    0x98(%rsp),%rbp
mov    0x38(%rsp),%r13
jne    1bb3 <rdmad+0x9c3>
movslq (%r14),%rax
mov    0xc(%rsp),%edi
lea    0x28b0(%rsp),%rsi
cmp    %edi,%eax
jge    1b0f <rdmad+0x91f>
add    %rsp,%rax
add    $0xb0,%rax
jmp    1ade <rdmad+0x8ee>
movslq %edi,%rcx
add    %rsp,%rcx
add    $0xb0,%rcx
cmp    %rcx,%rax
jae    1b0f <rdmad+0x91f>
movzbl (%rax),%edx
mov    0x1(%rax),%cl
add    $0x2,%rax
movl   $0x0,0x1c(%rsp)
test   %edx,%edx
je     1acc <rdmad+0x8dc>
mov    %cl,(%rsi)
add    $0x1,%rsi
mov    0x1c(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x1c(%rsp)
cmp    %edx,%edi
jl     1af4 <rdmad+0x904>
mov    0xc(%rsp),%edi
jmp    1acc <rdmad+0x8dc>
test   %r15d,%r15d
je     1b2d <rdmad+0x93d>
lea    0x28b0(%rsp),%rax
sub    %rax,%rsi
lea    0x5c1(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,(%r14)
jle    1b8c <rdmad+0x99c>
movslq 0x14(%rsp),%rax
movslq 0x20(%rsp),%rcx
imul   %rax,%rcx
mov    0x28(%rsp),%rax
lea    (%rax,%rcx,2),%rax
add    %rax,%r13
add    %rax,%rbp
xor    %eax,%eax
movzbl 0xb0(%rsp,%rax,1),%ecx
mov    %cl,0x0(%rbp,%rax,2)
movzbl 0x28b0(%rsp,%rax,1),%ecx
mov    %cl,0x0(%r13,%rax,2)
movslq (%r14),%rcx
add    %rsp,%rcx
add    $0xb0,%rcx
lea    (%rsp,%rax,1),%rdx
add    $0xb1,%rdx
add    $0x1,%rax
cmp    %rcx,%rdx
jb     1b52 <rdmad+0x962>
test   %r15d,%r15d
je     1b9d <rdmad+0x9ad>
lea    0x5d3(%rip),%rdi
call   1040 <puts@plt>
lea    0x49f(%rip),%rdi
lea    0x4ac(%rip),%rsi
mov    %r12,%rdx
call   1090 <puthd@plt>
test   %r15d,%r15d
je     1bd7 <rdmad+0x9e7>
mov    0x8(%rsp),%ecx
mov    (%r14),%esi
mov    0x50f0(%rsp),%rax
mov    (%rax),%edx
lea    0x55a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0x8(%rsp)
lea    0x1c(%rsp),%r13
cmove  %rbx,%r13
lea    0x10(%rsp),%rdi
mov    %r13,%rsi
call   1070 <dskbcr_@plt>
test   %r15d,%r15d
je     1c09 <rdmad+0xa19>
mov    0x8(%rsp),%esi
lea    0x54c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%eax
add    $0x50b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Opening file: %s\0A\00"
@.str.1 = [16 x i8] c"Reading header\0A\00"
@.str.2 = [29 x i8] c"Read Completion status : %d\0A\00"
@.str.3 = [20 x i8] c"Header length : %d\0A\00"
@.str.4 = [5 x i8] c"TYPE\00"
@.str.5 = [11 x i8] c"Type >%s<\0A\00"
@.str.6 = [4 x i8] c"mad\00"
@.str.7 = [15 x i8] c"unsigned_short\00"
@.str.8 = [11 x i8] c"BYTE_ORDER\00"
@.str.9 = [6 x i8] c"SIZE1\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [6 x i8] c"SIZE2\00"
@.str.12 = [4 x i8] c"DIM\00"
@.str.13 = [21 x i8] c"Image size %d %d %d\0A\00"
@.str.14 = [25 x i8] c"Reading in single chunk\0A\00"
@.str.15 = [28 x i8] c"Reading one line at a time\0A\00"
@.str.16 = [14 x i8] c"little_endian\00"
@.str.17 = [11 x i8] c"big_endian\00"
@.str.18 = [16 x i8] c"Swapping bytes\0A\00"
@.str.19 = [11 x i8] c"swap_rlmsb\00"
@.str.20 = [18 x i8] c"Reading %d bytes\0A\00"
@.str.21 = [24 x i8] c"Uncompressing %d bytes\0A\00"
@.str.22 = [26 x i8] c"Restored %d bytes in MSB\0A\00"
@.str.23 = [14 x i8] c"Done line %d\0A\00"
@.str.24 = [35 x i8] c"=================================\0A\00"
@.str.25 = [37 x i8] c"===================================\0A\00"
@.str.26 = [27 x i8] c"Unsupported Filetype (%s)\0A\00"
@.str.27 = [36 x i8] c"Done reading Image size %d %d (%d)\0A\00"
@.str.28 = [29 x i8] c"RDFILE completion status %d\0A\00"
define i32 @rdmad(i8* %0, i8* %1, i16* %2, i32 %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i16*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca [80 x i8]
%26 = alloca [80 x i8]
%27 = alloca i32
%28 = alloca i32
%29 = alloca [10240 x i8]
%30 = alloca [10240 x i8]
%31 = alloca i8*
%32 = alloca i8*
%33 = alloca i8*
%34 = alloca i8*
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i16* %2, i16** %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32* %5, i32** %14
store i32* %6, i32** %15
store i32 1, i32* %27
%41 = call i32 (...) @filec_getdebug()
store i32 %41, i32* %40
%42 = load i8*, i8** %9
%43 = call i32 @strlen(i8* %42)
store i32 %43, i32* %19
%44 = load i32, i32* %40
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %7
%47 = load i8*, i8** %9
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %46, %7
%50 = load i8*, i8** %9
%51 = call i32 @dskbor_(i32* %27, i8* %50, i32* %19, i32* %21)
%52 = load i32, i32* %21
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = load i32, i32* %21
store i32 %55, i32* %8
br label %643
56: ; preds = %49
store i32 1, i32* %28
%57 = load i32, i32* %40
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
%62 = call i32 @dskbwr_(i32* %27, i32* %28)
store i32 512, i32* %16
%63 = load i8*, i8** %10
%64 = call i32 @dskbr_(i32* %27, i8* %63, i32* %16, i32* %21)
%65 = load i32, i32* %40
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %61
%68 = load i32, i32* %21
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %67, %61
%71 = load i32, i32* %21
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %70
br label %618
74: ; preds = %70
%75 = load i8*, i8** %10
%76 = call i32 @gethdl(i32* %22, i8* %75)
%77 = load i32, i32* %40
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* %22
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %79, %74
%83 = load i32, i32* %22
%84 = sub nsw i32 %83, 512
store i32 %84, i32* %16
%85 = load i32, i32* %16
%86 = icmp sgt i32 %85, 0
br i1 %86, label %87, label %95
87: ; preds = %82
%88 = load i8*, i8** %10
%89 = getelementptr inbounds i8, i8* %88, i64 512
%90 = call i32 @dskbr_(i32* %27, i8* %89, i32* %16, i32* %21)
%91 = load i32, i32* %21
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %87
br label %618
94: ; preds = %87
br label %95
95: ; preds = %94, %82
store i32 0, i32* %28
%96 = call i32 @dskbwr_(i32* %27, i32* %28)
%97 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%98 = load i8*, i8** %10
%99 = call i32 @gethd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %97, i8* %98)
%100 = load i32, i32* %40
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %95
%103 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %103)
br label %105
105: ; preds = %102, %95
%106 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %113, label %109
109: ; preds = %105
%110 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%111 = call i64 @strcmp(i8* %110, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%112 = icmp eq i64 %111, 0
br i1 %112, label %113, label %278
113: ; preds = %109, %105
%114 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%115 = load i8*, i8** %10
%116 = call i32 @gethd(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %114, i8* %115)
%117 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%118 = load i8*, i8** %10
%119 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %117, i8* %118)
%120 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 0
br i1 %123, label %129, label %124
124: ; preds = %113
%125 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%126 = load i32*, i32** %14
%127 = call i32 @sscanf(i8* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %126)
%128 = icmp ne i32 %127, 1
br i1 %128, label %129, label %130
129: ; preds = %124, %113
br label %618
130: ; preds = %124
%131 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%132 = load i8*, i8** %10
%133 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %131, i8* %132)
%134 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %136, 0
br i1 %137, label %143, label %138
138: ; preds = %130
%139 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%140 = load i32*, i32** %15
%141 = call i32 @sscanf(i8* %139, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %140)
%142 = icmp ne i32 %141, 1
br i1 %142, label %143, label %144
143: ; preds = %138, %130
br label %618
144: ; preds = %138
%145 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%146 = load i8*, i8** %10
%147 = call i32 @gethd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %145, i8* %146)
%148 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp eq i32 %150, 0
br i1 %151, label %156, label %152
152: ; preds = %144
%153 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%154 = call i32 @sscanf(i8* %153, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %24)
%155 = icmp ne i32 %154, 1
br i1 %155, label %156, label %157
156: ; preds = %152, %144
br label %618
157: ; preds = %152
%158 = load i32, i32* %40
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %167
160: ; preds = %157
%161 = load i32*, i32** %14
%162 = load i32, i32* %161
%163 = load i32*, i32** %15
%164 = load i32, i32* %163
%165 = load i32, i32* %24
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %162, i32 %164, i32 %165)
br label %167
167: ; preds = %160, %157
%168 = load i32*, i32** %14
%169 = load i32, i32* %168
%170 = load i32, i32* %12
%171 = icmp eq i32 %169, %170
br i1 %171, label %172, label %197
172: ; preds = %167
%173 = load i32, i32* %40
%174 = icmp ne i32 %173, 0
br i1 %174, label %175, label %177
175: ; preds = %172
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
br label %177
177: ; preds = %175, %172
%178 = load i32*, i32** %14
%179 = load i32, i32* %178
%180 = load i32*, i32** %15
%181 = load i32, i32* %180
%182 = mul nsw i32 %179, %181
%183 = mul nsw i32 %182, 2
store i32 %183, i32* %16
%184 = load i16*, i16** %11
%185 = bitcast i16* %184 to i8*
%186 = call i32 @dskbr_(i32* %27, i8* %185, i32* %16, i32* %21)
%187 = load i32, i32* %40
%188 = icmp ne i32 %187, 0
br i1 %188, label %189, label %192
189: ; preds = %177
%190 = load i32, i32* %21
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %190)
br label %192
192: ; preds = %189, %177
%193 = load i32, i32* %21
%194 = icmp ne i32 %193, 0
br i1 %194, label %195, label %196
195: ; preds = %192
br label %618
196: ; preds = %192
br label %228
197: ; preds = %167
%198 = load i32, i32* %40
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %202
200: ; preds = %197
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0))
br label %202
202: ; preds = %200, %197
%203 = load i32*, i32** %14
%204 = load i32, i32* %203
%205 = mul nsw i32 %204, 2
store i32 %205, i32* %16
store i32 0, i32* %19
br label %206
206: ; preds = %224, %202
%207 = load i32, i32* %19
%208 = load i32*, i32** %15
%209 = load i32, i32* %208
%210 = icmp slt i32 %207, %209
br i1 %210, label %211, label %227
211: ; preds = %206
%212 = load i16*, i16** %11
%213 = load i32, i32* %19
%214 = load i32, i32* %12
%215 = mul nsw i32 %213, %214
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i16, i16* %212, i64 %216
%218 = bitcast i16* %217 to i8*
%219 = call i32 @dskbr_(i32* %27, i8* %218, i32* %16, i32* %21)
%220 = load i32, i32* %21
%221 = icmp ne i32 %220, 0
br i1 %221, label %222, label %223
222: ; preds = %211
br label %618
223: ; preds = %211
br label %224
224: ; preds = %223
%225 = load i32, i32* %19
%226 = add nsw i32 %225, 1
store i32 %226, i32* %19
br label %206
227: ; preds = %206
br label %228
228: ; preds = %227, %196
store i32 1, i32* %28
%229 = call i32 @dskbwr_(i32* %27, i32* %28)
%230 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%231 = load i8, i8* %230
%232 = icmp ne i8 %231, 0
br i1 %232, label %233, label %246
233: ; preds = %228
%234 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%235 = call i64 @strcmp(i8* %234, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0))
%236 = icmp eq i64 %235, 0
br i1 %236, label %237, label %238
237: ; preds = %233
store i32 0, i32* %23
br label %245
238: ; preds = %233
%239 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%240 = call i64 @strcmp(i8* %239, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%241 = icmp eq i64 %240, 0
br i1 %241, label %242, label %243
242: ; preds = %238
store i32 1, i32* %23
br label %244
243: ; preds = %238
store i32 -2, i32* %21
br label %618
244: ; preds = %242
br label %245
245: ; preds = %244, %237
br label %246
246: ; preds = %245, %228
%247 = load i32, i32* %23
%248 = call i32 (...) @getbo()
%249 = icmp ne i32 %247, %248
br i1 %249, label %250, label %277
250: ; preds = %246
%251 = load i32, i32* %40
%252 = icmp ne i32 %251, 0
br i1 %252, label %253, label %255
253: ; preds = %250
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0))
br label %255
255: ; preds = %253, %250
store i32 0, i32* %19
br label %256
256: ; preds = %273, %255
%257 = load i32, i32* %19
%258 = load i32*, i32** %15
%259 = load i32, i32* %258
%260 = icmp slt i32 %257, %259
br i1 %260, label %261, label %276
261: ; preds = %256
%262 = load i32*, i32** %14
%263 = load i32, i32* %262
%264 = mul nsw i32 2, %263
%265 = load i16*, i16** %11
%266 = load i32, i32* %19
%267 = load i32, i32* %12
%268 = mul nsw i32 %266, %267
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds i16, i16* %265, i64 %269
%271 = bitcast i16* %270 to i8*
%272 = call i32 @swpbyt(i32 0, i32 %264, i8* %271)
br label %273
273: ; preds = %261
%274 = load i32, i32* %19
%275 = add nsw i32 %274, 1
store i32 %275, i32* %19
br label %256
276: ; preds = %256
br label %277
277: ; preds = %276, %246
br label %617
278: ; preds = %109
%279 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%280 = call i64 @strcmp(i8* %279, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0))
%281 = icmp eq i64 %280, 0
br i1 %281, label %282, label %610
282: ; preds = %278
%283 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%284 = load i8*, i8** %10
%285 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %283, i8* %284)
%286 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%287 = load i8, i8* %286
%288 = sext i8 %287 to i32
%289 = icmp eq i32 %288, 0
br i1 %289, label %295, label %290
290: ; preds = %282
%291 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%292 = load i32*, i32** %14
%293 = call i32 @sscanf(i8* %291, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %292)
%294 = icmp ne i32 %293, 1
br i1 %294, label %295, label %296
295: ; preds = %290, %282
br label %618
296: ; preds = %290
%297 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%298 = load i8*, i8** %10
%299 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %297, i8* %298)
%300 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%301 = load i8, i8* %300
%302 = sext i8 %301 to i32
%303 = icmp eq i32 %302, 0
br i1 %303, label %309, label %304
304: ; preds = %296
%305 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%306 = load i32*, i32** %15
%307 = call i32 @sscanf(i8* %305, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %306)
%308 = icmp ne i32 %307, 1
br i1 %308, label %309, label %310
309: ; preds = %304, %296
br label %618
310: ; preds = %304
%311 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%312 = load i8*, i8** %10
%313 = call i32 @gethd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %311, i8* %312)
%314 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%315 = load i8, i8* %314
%316 = sext i8 %315 to i32
%317 = icmp eq i32 %316, 0
br i1 %317, label %322, label %318
318: ; preds = %310
%319 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%320 = call i32 @sscanf(i8* %319, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %24)
%321 = icmp ne i32 %320, 1
br i1 %321, label %322, label %323
322: ; preds = %318, %310
br label %618
323: ; preds = %318
%324 = call i32 (...) @getbo()
store i32 %324, i32* %23
%325 = load i32, i32* %23
%326 = icmp eq i32 %325, 0
br i1 %326, label %327, label %328
327: ; preds = %323
store i32 0, i32* %35
store i32 1, i32* %36
br label %333
328: ; preds = %323
%329 = load i32, i32* %23
%330 = icmp eq i32 %329, 1
br i1 %330, label %331, label %332
331: ; preds = %328
store i32 1, i32* %35
store i32 0, i32* %36
br label %332
332: ; preds = %331, %328
br label %333
333: ; preds = %332, %327
store i32 2, i32* %37
%334 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%335 = call i32 @dskbr_(i32* %27, i8* %334, i32* %37, i32* %21)
%336 = load i32, i32* %21
%337 = icmp ne i32 %336, 0
br i1 %337, label %338, label %339
338: ; preds = %333
br label %618
339: ; preds = %333
%340 = load i32, i32* %37
%341 = sub nsw i32 %340, 2
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 %342
%344 = load i8, i8* %343
%345 = zext i8 %344 to i32
%346 = mul nsw i32 %345, 256
%347 = load i32, i32* %37
%348 = sub nsw i32 %347, 1
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 %349
%351 = load i8, i8* %350
%352 = zext i8 %351 to i32
%353 = add nsw i32 %346, %352
store i32 %353, i32* %37
store i32 0, i32* %19
br label %354
354: ; preds = %498, %339
%355 = load i32, i32* %19
%356 = load i32*, i32** %15
%357 = load i32, i32* %356
%358 = sub nsw i32 %357, 1
%359 = icmp slt i32 %355, %358
br i1 %359, label %360, label %501
360: ; preds = %354
%361 = load i32, i32* %40
%362 = icmp ne i32 %361, 0
br i1 %362, label %363, label %366
363: ; preds = %360
%364 = load i32, i32* %37
%365 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0), i32 %364)
br label %366
366: ; preds = %363, %360
%367 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%368 = call i32 @dskbr_(i32* %27, i8* %367, i32* %37, i32* %21)
%369 = load i32, i32* %21
%370 = icmp ne i32 %369, 0
br i1 %370, label %371, label %372
371: ; preds = %366
br label %618
372: ; preds = %366
%373 = load i32, i32* %40
%374 = icmp ne i32 %373, 0
br i1 %374, label %375, label %382
375: ; preds = %372
%376 = load i32, i32* %37
%377 = load i32*, i32** %14
%378 = load i32, i32* %377
%379 = sub nsw i32 %376, %378
%380 = sub nsw i32 %379, 2
%381 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.21, i64 0, i64 0), i32 %380)
br label %382
382: ; preds = %375, %372
%383 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%384 = load i32*, i32** %14
%385 = load i32, i32* %384
%386 = sext i32 %385 to i64
%387 = getelementptr inbounds i8, i8* %383, i64 %386
store i8* %387, i8** %31
%388 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
store i8* %388, i8** %32
br label %389
389: ; preds = %418, %382
%390 = load i8*, i8** %31
%391 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%392 = load i32, i32* %37
%393 = sext i32 %392 to i64
%394 = getelementptr inbounds i8, i8* %391, i64 %393
%395 = getelementptr inbounds i8, i8* %394, i64 -2
%396 = icmp ult i8* %390, %395
br i1 %396, label %397, label %419
397: ; preds = %389
%398 = load i8*, i8** %31
%399 = getelementptr inbounds i8, i8* %398, i32 1
store i8* %399, i8** %31
%400 = load i8, i8* %398
%401 = zext i8 %400 to i32
store i32 %401, i32* %38
%402 = load i8*, i8** %31
%403 = getelementptr inbounds i8, i8* %402, i32 1
store i8* %403, i8** %31
%404 = load i8, i8* %402
%405 = zext i8 %404 to i32
store i32 %405, i32* %39
store i32 0, i32* %18
br label %406
406: ; preds = %415, %397
%407 = load i32, i32* %18
%408 = load i32, i32* %38
%409 = icmp slt i32 %407, %408
br i1 %409, label %410, label %418
410: ; preds = %406
%411 = load i32, i32* %39
%412 = trunc i32 %411 to i8
%413 = load i8*, i8** %32
%414 = getelementptr inbounds i8, i8* %413, i32 1
store i8* %414, i8** %32
store i8 %412, i8* %413
br label %415
415: ; preds = %410
%416 = load i32, i32* %18
%417 = add nsw i32 %416, 1
store i32 %417, i32* %18
br label %406
418: ; preds = %406
br label %389
419: ; preds = %389
%420 = load i32, i32* %40
%421 = icmp ne i32 %420, 0
br i1 %421, label %422, label %429
422: ; preds = %419
%423 = load i8*, i8** %32
%424 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
%425 = ptrtoint i8* %423 to i64
%426 = ptrtoint i8* %424 to i64
%427 = sub i64 %425, %426
%428 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.22, i64 0, i64 0), i64 %427)
br label %429
429: ; preds = %422, %419
%430 = load i16*, i16** %11
%431 = bitcast i16* %430 to i8*
%432 = load i32, i32* %19
%433 = mul nsw i32 2, %432
%434 = load i32, i32* %12
%435 = mul nsw i32 %433, %434
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds i8, i8* %431, i64 %436
%438 = load i32, i32* %35
%439 = sext i32 %438 to i64
%440 = getelementptr inbounds i8, i8* %437, i64 %439
store i8* %440, i8** %33
%441 = load i16*, i16** %11
%442 = bitcast i16* %441 to i8*
%443 = load i32, i32* %19
%444 = mul nsw i32 2, %443
%445 = load i32, i32* %12
%446 = mul nsw i32 %444, %445
%447 = sext i32 %446 to i64
%448 = getelementptr inbounds i8, i8* %442, i64 %447
%449 = load i32, i32* %36
%450 = sext i32 %449 to i64
%451 = getelementptr inbounds i8, i8* %448, i64 %450
store i8* %451, i8** %34
%452 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
store i8* %452, i8** %31
%453 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
store i8* %453, i8** %32
br label %454
454: ; preds = %471, %429
%455 = load i8*, i8** %31
%456 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%457 = load i32*, i32** %14
%458 = load i32, i32* %457
%459 = sext i32 %458 to i64
%460 = getelementptr inbounds i8, i8* %456, i64 %459
%461 = icmp ult i8* %455, %460
br i1 %461, label %462, label %476
462: ; preds = %454
%463 = load i8*, i8** %31
%464 = getelementptr inbounds i8, i8* %463, i32 1
store i8* %464, i8** %31
%465 = load i8, i8* %463
%466 = load i8*, i8** %33
store i8 %465, i8* %466
%467 = load i8*, i8** %32
%468 = getelementptr inbounds i8, i8* %467, i32 1
store i8* %468, i8** %32
%469 = load i8, i8* %467
%470 = load i8*, i8** %34
store i8 %469, i8* %470
br label %471
471: ; preds = %462
%472 = load i8*, i8** %33
%473 = getelementptr inbounds i8, i8* %472, i64 2
store i8* %473, i8** %33
%474 = load i8*, i8** %34
%475 = getelementptr inbounds i8, i8* %474, i64 2
store i8* %475, i8** %34
br label %454
476: ; preds = %454
%477 = load i32, i32* %40
%478 = icmp ne i32 %477, 0
br i1 %478, label %479, label %483
479: ; preds = %476
%480 = load i32, i32* %19
%481 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), i32 %480)
%482 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0))
br label %483
483: ; preds = %479, %476
%484 = load i32, i32* %37
%485 = sub nsw i32 %484, 2
%486 = sext i32 %485 to i64
%487 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 %486
%488 = load i8, i8* %487
%489 = zext i8 %488 to i32
%490 = mul nsw i32 %489, 256
%491 = load i32, i32* %37
%492 = sub nsw i32 %491, 1
%493 = sext i32 %492 to i64
%494 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 %493
%495 = load i8, i8* %494
%496 = zext i8 %495 to i32
%497 = add nsw i32 %490, %496
store i32 %497, i32* %37
br label %498
498: ; preds = %483
%499 = load i32, i32* %19
%500 = add nsw i32 %499, 1
store i32 %500, i32* %19
br label %354
501: ; preds = %354
%502 = load i32, i32* %37
%503 = sub nsw i32 %502, 2
store i32 %503, i32* %37
%504 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%505 = call i32 @dskbr_(i32* %27, i8* %504, i32* %37, i32* %21)
%506 = load i32, i32* %21
%507 = icmp ne i32 %506, 0
br i1 %507, label %508, label %509
508: ; preds = %501
br label %618
509: ; preds = %501
%510 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%511 = load i32*, i32** %14
%512 = load i32, i32* %511
%513 = sext i32 %512 to i64
%514 = getelementptr inbounds i8, i8* %510, i64 %513
store i8* %514, i8** %31
%515 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
store i8* %515, i8** %32
br label %516
516: ; preds = %544, %509
%517 = load i8*, i8** %31
%518 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%519 = load i32, i32* %37
%520 = sext i32 %519 to i64
%521 = getelementptr inbounds i8, i8* %518, i64 %520
%522 = icmp ult i8* %517, %521
br i1 %522, label %523, label %545
523: ; preds = %516
%524 = load i8*, i8** %31
%525 = getelementptr inbounds i8, i8* %524, i32 1
store i8* %525, i8** %31
%526 = load i8, i8* %524
%527 = zext i8 %526 to i32
store i32 %527, i32* %38
%528 = load i8*, i8** %31
%529 = getelementptr inbounds i8, i8* %528, i32 1
store i8* %529, i8** %31
%530 = load i8, i8* %528
%531 = zext i8 %530 to i32
store i32 %531, i32* %39
store i32 0, i32* %18
br label %532
532: ; preds = %541, %523
%533 = load i32, i32* %18
%534 = load i32, i32* %38
%535 = icmp slt i32 %533, %534
br i1 %535, label %536, label %544
536: ; preds = %532
%537 = load i32, i32* %39
%538 = trunc i32 %537 to i8
%539 = load i8*, i8** %32
%540 = getelementptr inbounds i8, i8* %539, i32 1
store i8* %540, i8** %32
store i8 %538, i8* %539
br label %541
541: ; preds = %536
%542 = load i32, i32* %18
%543 = add nsw i32 %542, 1
store i32 %543, i32* %18
br label %532
544: ; preds = %532
br label %516
545: ; preds = %516
%546 = load i32, i32* %40
%547 = icmp ne i32 %546, 0
br i1 %547, label %548, label %555
548: ; preds = %545
%549 = load i8*, i8** %32
%550 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
%551 = ptrtoint i8* %549 to i64
%552 = ptrtoint i8* %550 to i64
%553 = sub i64 %551, %552
%554 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.22, i64 0, i64 0), i64 %553)
br label %555
555: ; preds = %548, %545
%556 = load i16*, i16** %11
%557 = bitcast i16* %556 to i8*
%558 = load i32, i32* %19
%559 = mul nsw i32 2, %558
%560 = load i32, i32* %12
%561 = mul nsw i32 %559, %560
%562 = sext i32 %561 to i64
%563 = getelementptr inbounds i8, i8* %557, i64 %562
%564 = load i32, i32* %35
%565 = sext i32 %564 to i64
%566 = getelementptr inbounds i8, i8* %563, i64 %565
store i8* %566, i8** %33
%567 = load i16*, i16** %11
%568 = bitcast i16* %567 to i8*
%569 = load i32, i32* %19
%570 = mul nsw i32 2, %569
%571 = load i32, i32* %12
%572 = mul nsw i32 %570, %571
%573 = sext i32 %572 to i64
%574 = getelementptr inbounds i8, i8* %568, i64 %573
%575 = load i32, i32* %36
%576 = sext i32 %575 to i64
%577 = getelementptr inbounds i8, i8* %574, i64 %576
store i8* %577, i8** %34
%578 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
store i8* %578, i8** %31
%579 = getelementptr inbounds [10240 x i8], [10240 x i8]* %30, i64 0, i64 0
store i8* %579, i8** %32
br label %580
580: ; preds = %597, %555
%581 = load i8*, i8** %31
%582 = getelementptr inbounds [10240 x i8], [10240 x i8]* %29, i64 0, i64 0
%583 = load i32*, i32** %14
%584 = load i32, i32* %583
%585 = sext i32 %584 to i64
%586 = getelementptr inbounds i8, i8* %582, i64 %585
%587 = icmp ult i8* %581, %586
br i1 %587, label %588, label %602
588: ; preds = %580
%589 = load i8*, i8** %31
%590 = getelementptr inbounds i8, i8* %589, i32 1
store i8* %590, i8** %31
%591 = load i8, i8* %589
%592 = load i8*, i8** %33
store i8 %591, i8* %592
%593 = load i8*, i8** %32
%594 = getelementptr inbounds i8, i8* %593, i32 1
store i8* %594, i8** %32
%595 = load i8, i8* %593
%596 = load i8*, i8** %34
store i8 %595, i8* %596
br label %597
597: ; preds = %588
%598 = load i8*, i8** %33
%599 = getelementptr inbounds i8, i8* %598, i64 2
store i8* %599, i8** %33
%600 = load i8*, i8** %34
%601 = getelementptr inbounds i8, i8* %600, i64 2
store i8* %601, i8** %34
br label %580
602: ; preds = %580
%603 = load i32, i32* %40
%604 = icmp ne i32 %603, 0
br i1 %604, label %605, label %607
605: ; preds = %602
%606 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.25, i64 0, i64 0))
br label %607
607: ; preds = %605, %602
%608 = load i8*, i8** %10
%609 = call i32 @puthd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %608)
br label %616
610: ; preds = %278
%611 = load i32, i32* %40
%612 = icmp ne i32 %611, 0
br i1 %612, label %613, label %615
613: ; preds = %610
%614 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0))
br label %615
615: ; preds = %613, %610
store i32 -2, i32* %21
br label %618
616: ; preds = %607
br label %617
617: ; preds = %616, %277
br label %618
618: ; preds = %617, %615, %508, %371, %338, %322, %309, %295, %243, %222, %195, %156, %143, %129, %93, %73
%619 = load i32, i32* %40
%620 = icmp ne i32 %619, 0
br i1 %620, label %621, label %628
621: ; preds = %618
%622 = load i32*, i32** %14
%623 = load i32, i32* %622
%624 = load i32*, i32** %15
%625 = load i32, i32* %624
%626 = load i32, i32* %21
%627 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.27, i64 0, i64 0), i32 %623, i32 %625, i32 %626)
br label %628
628: ; preds = %621, %618
%629 = load i32, i32* %21
%630 = icmp ne i32 %629, 0
br i1 %630, label %631, label %633
631: ; preds = %628
%632 = call i32 @dskbcr_(i32* %27, i32* %18)
br label %635
633: ; preds = %628
%634 = call i32 @dskbcr_(i32* %27, i32* %21)
br label %635
635: ; preds = %633, %631
%636 = load i32, i32* %40
%637 = icmp ne i32 %636, 0
br i1 %637, label %638, label %641
638: ; preds = %635
%639 = load i32, i32* %21
%640 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i32 %639)
br label %641
641: ; preds = %638, %635
%642 = load i32, i32* %21
store i32 %642, i32* %8
br label %643
643: ; preds = %641, %54
%644 = load i32, i32* %8
ret i32 %644
}

LLVM IR (-O2):
@.str = [18 x i8] c"Opening file: %s\0A\00"
@.str.2 = [29 x i8] c"Read Completion status : %d\0A\00"
@.str.3 = [20 x i8] c"Header length : %d\0A\00"
@.str.4 = [5 x i8] c"TYPE\00"
@.str.5 = [11 x i8] c"Type >%s<\0A\00"
@.str.6 = [4 x i8] c"mad\00"
@.str.7 = [15 x i8] c"unsigned_short\00"
@.str.8 = [11 x i8] c"BYTE_ORDER\00"
@.str.9 = [6 x i8] c"SIZE1\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [6 x i8] c"SIZE2\00"
@.str.12 = [4 x i8] c"DIM\00"
@.str.13 = [21 x i8] c"Image size %d %d %d\0A\00"
@.str.16 = [14 x i8] c"little_endian\00"
@.str.17 = [11 x i8] c"big_endian\00"
@.str.19 = [11 x i8] c"swap_rlmsb\00"
@.str.20 = [18 x i8] c"Reading %d bytes\0A\00"
@.str.21 = [24 x i8] c"Uncompressing %d bytes\0A\00"
@.str.22 = [26 x i8] c"Restored %d bytes in MSB\0A\00"
@.str.23 = [14 x i8] c"Done line %d\0A\00"
@.str.26 = [27 x i8] c"Unsupported Filetype (%s)\0A\00"
@.str.27 = [36 x i8] c"Done reading Image size %d %d (%d)\0A\00"
@.str.28 = [29 x i8] c"RDFILE completion status %d\0A\00"
@str = [36 x i8] c"===================================\00"
@str.29 = [34 x i8] c"=================================\00"
@str.30 = [15 x i8] c"Swapping bytes\00"
@str.31 = [27 x i8] c"Reading one line at a time\00"
@str.32 = [24 x i8] c"Reading in single chunk\00"
@str.33 = [15 x i8] c"Reading header\00"
define i32 @rdmad(i8* %0, i8* %1, i16* %2, i32 %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [80 x i8]
%15 = alloca [80 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca [10240 x i8]
%19 = alloca [10240 x i8]
%20 = alloca i32
%21 = bitcast i32* %8 to i8*
%22 = bitcast i32* %9 to i8*
%23 = bitcast i32* %10 to i8*
%24 = bitcast i32* %11 to i8*
%25 = bitcast i32* %12 to i8*
%26 = bitcast i32* %13 to i8*
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%29 = bitcast i32* %16 to i8*
store i32 1, i32* %16
%30 = bitcast i32* %17 to i8*
%31 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 0
%32 = getelementptr inbounds [10240 x i8], [10240 x i8]* %19, i64 0, i64 0
%33 = bitcast i32* %20 to i8*
%34 = tail call i32 (...) @filec_getdebug()
%35 = tail call i32 @strlen(i8* %0)
store i32 %35, i32* %10
%36 = icmp eq i32 %34, 0
br i1 %36, label %39, label %37
37: ; preds = %7
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %39
39: ; preds = %37, %7
%40 = call i32 @dskbor_(i32* %16, i8* %0, i32* %10, i32* %11)
%41 = load i32, i32* %11
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %450
43: ; preds = %39
store i32 1, i32* %17
br i1 %36, label %44, label %49
44: ; preds = %43
%45 = call i32 @dskbwr_(i32* %16, i32* %17)
store i32 512, i32* %8
%46 = call i32 @dskbr_(i32* %16, i8* %1, i32* %8, i32* %11)
%47 = load i32, i32* %11
%48 = icmp eq i32 %47, 0
br i1 %48, label %57, label %442
49: ; preds = %43
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.33, i64 0, i64 0))
%51 = call i32 @dskbwr_(i32* %16, i32* %17)
store i32 512, i32* %8
%52 = call i32 @dskbr_(i32* %16, i8* %1, i32* %8, i32* %11)
%53 = load i32, i32* %11
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %11
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %433
57: ; preds = %44
%58 = call i32 @gethdl(i32* %12, i8* %1)
br label %63
59: ; preds = %49
%60 = call i32 @gethdl(i32* %12, i8* %1)
%61 = load i32, i32* %12
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %57, %59
%64 = load i32, i32* %12
%65 = add nsw i32 %64, -512
store i32 %65, i32* %8
%66 = icmp sgt i32 %64, 512
br i1 %66, label %67, label %72
67: ; preds = %63
%68 = getelementptr inbounds i8, i8* %1, i64 512
%69 = call i32 @dskbr_(i32* %16, i8* %68, i32* %8, i32* %11)
%70 = load i32, i32* %11
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %430
72: ; preds = %67, %63
store i32 0, i32* %17
%73 = call i32 @dskbwr_(i32* %16, i32* %17)
%74 = call i32 @gethd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %27, i8* %1)
br i1 %36, label %77, label %75
75: ; preds = %72
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %27)
br label %77
77: ; preds = %75, %72
%78 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %83, label %80
80: ; preds = %77
%81 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %192
83: ; preds = %80, %77
%84 = call i32 @gethd(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %28, i8* %1)
%85 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %27, i8* %1)
%86 = load i8, i8* %27
%87 = icmp eq i8 %86, 0
br i1 %87, label %430, label %88
88: ; preds = %83
%89 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %5)
%90 = icmp eq i32 %89, 1
br i1 %90, label %91, label %430
91: ; preds = %88
%92 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %27, i8* %1)
%93 = load i8, i8* %27
%94 = icmp eq i8 %93, 0
br i1 %94, label %430, label %95
95: ; preds = %91
%96 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %6)
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %430
98: ; preds = %95
%99 = call i32 @gethd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %27, i8* %1)
%100 = load i8, i8* %27
%101 = icmp eq i8 %100, 0
br i1 %101, label %430, label %102
102: ; preds = %98
%103 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %13)
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %430
105: ; preds = %102
%106 = load i32, i32* %5
br i1 %36, label %107, label %109
107: ; preds = %105
%108 = icmp eq i32 %106, %3
br i1 %108, label %125, label %137
109: ; preds = %105
%110 = load i32, i32* %6
%111 = load i32, i32* %13
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %106, i32 %110, i32 %111)
%113 = load i32, i32* %5
%114 = icmp eq i32 %113, %3
br i1 %114, label %115, label %134
115: ; preds = %109
%116 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.32, i64 0, i64 0))
%117 = load i32, i32* %5
%118 = load i32, i32* %6
%119 = shl i32 %117, 1
%120 = mul i32 %119, %118
store i32 %120, i32* %8
%121 = bitcast i16* %2 to i8*
%122 = call i32 @dskbr_(i32* %16, i8* %121, i32* %8, i32* %11)
%123 = load i32, i32* %11
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %123)
br label %131
125: ; preds = %107
%126 = load i32, i32* %6
%127 = shl i32 %3, 1
%128 = mul i32 %127, %126
store i32 %128, i32* %8
%129 = bitcast i16* %2 to i8*
%130 = call i32 @dskbr_(i32* %16, i8* %129, i32* %8, i32* %11)
br label %131
131: ; preds = %125, %115
%132 = load i32, i32* %11
%133 = icmp eq i32 %132, 0
br i1 %133, label %156, label %430
134: ; preds = %109
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.31, i64 0, i64 0))
%136 = load i32, i32* %5
br label %137
137: ; preds = %107, %134
%138 = phi i32 [ %106, %107 ], [ %136, %134 ]
%139 = shl nsw i32 %138, 1
store i32 %139, i32* %8
store i32 0, i32* %10
%140 = load i32, i32* %6
%141 = icmp sgt i32 %140, 0
br i1 %141, label %142, label %156
142: ; preds = %137, %151
%143 = phi i32 [ %153, %151 ], [ 0, %137 ]
%144 = mul nsw i32 %143, %3
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i16, i16* %2, i64 %145
%147 = bitcast i16* %146 to i8*
%148 = call i32 @dskbr_(i32* %16, i8* %147, i32* %8, i32* %11)
%149 = load i32, i32* %11
%150 = icmp eq i32 %149, 0
br i1 %150, label %151, label %430
151: ; preds = %142
%152 = load i32, i32* %10
%153 = add nsw i32 %152, 1
store i32 %153, i32* %10
%154 = load i32, i32* %6
%155 = icmp slt i32 %153, %154
br i1 %155, label %142, label %156
156: ; preds = %151, %137, %131
store i32 1, i32* %17
%157 = call i32 @dskbwr_(i32* %16, i32* %17)
%158 = load i8, i8* %28
%159 = icmp eq i8 %158, 0
br i1 %159, label %160, label %162
160: ; preds = %156
%161 = call i32 (...) @getbo()
br label %173
162: ; preds = %156
%163 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0))
%164 = icmp eq i64 %163, 0
br i1 %164, label %169, label %165
165: ; preds = %162
%166 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%167 = icmp eq i64 %166, 0
br i1 %167, label %169, label %168
168: ; preds = %165
store i32 -2, i32* %11
br label %430
169: ; preds = %165, %162
%170 = phi i32 [ 0, %162 ], [ 1, %165 ]
%171 = call i32 (...) @getbo()
%172 = icmp eq i32 %170, %171
br i1 %172, label %430, label %173
173: ; preds = %160, %169
br i1 %36, label %176, label %174
174: ; preds = %173
%175 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.30, i64 0, i64 0))
br label %176
176: ; preds = %174, %173
store i32 0, i32* %10
%177 = load i32, i32* %6
%178 = icmp sgt i32 %177, 0
br i1 %178, label %179, label %430
179: ; preds = %176, %179
%180 = phi i32 [ %189, %179 ], [ 0, %176 ]
%181 = load i32, i32* %5
%182 = shl nsw i32 %181, 1
%183 = mul nsw i32 %180, %3
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i16, i16* %2, i64 %184
%186 = bitcast i16* %185 to i8*
%187 = call i32 @swpbyt(i32 0, i32 %182, i8* %186)
%188 = load i32, i32* %10
%189 = add nsw i32 %188, 1
store i32 %189, i32* %10
%190 = load i32, i32* %6
%191 = icmp slt i32 %189, %190
br i1 %191, label %179, label %430
192: ; preds = %80
%193 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0))
%194 = icmp eq i64 %193, 0
br i1 %194, label %195, label %426
195: ; preds = %192
%196 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %27, i8* %1)
%197 = load i8, i8* %27
%198 = icmp eq i8 %197, 0
br i1 %198, label %430, label %199
199: ; preds = %195
%200 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %5)
%201 = icmp eq i32 %200, 1
br i1 %201, label %202, label %430
202: ; preds = %199
%203 = call i32 @gethd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %27, i8* %1)
%204 = load i8, i8* %27
%205 = icmp eq i8 %204, 0
br i1 %205, label %430, label %206
206: ; preds = %202
%207 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %6)
%208 = icmp eq i32 %207, 1
br i1 %208, label %209, label %430
209: ; preds = %206
%210 = call i32 @gethd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %27, i8* %1)
%211 = load i8, i8* %27
%212 = icmp eq i8 %211, 0
br i1 %212, label %430, label %213
213: ; preds = %209
%214 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %13)
%215 = icmp eq i32 %214, 1
br i1 %215, label %216, label %430
216: ; preds = %213
%217 = call i32 (...) @getbo()
switch i32 %217, label %219 [
i32 0, label %220
i32 1, label %218
]
218: ; preds = %216
br label %220
219: ; preds = %216
br label %220
220: ; preds = %216, %219, %218
%221 = phi i64 [ 1, %218 ], [ 0, %216 ], [ 0, %219 ]
%222 = phi i64 [ 0, %218 ], [ 1, %216 ], [ 0, %219 ]
store i32 2, i32* %20
%223 = call i32 @dskbr_(i32* %16, i8* %31, i32* %20, i32* %11)
%224 = load i32, i32* %11
%225 = icmp eq i32 %224, 0
br i1 %225, label %226, label %430
226: ; preds = %220
%227 = load i32, i32* %20
%228 = add nsw i32 %227, -2
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %229
%231 = load i8, i8* %230
%232 = zext i8 %231 to i32
%233 = shl nuw nsw i32 %232, 8
%234 = add nsw i32 %227, -1
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %235
%237 = load i8, i8* %236
%238 = zext i8 %237 to i32
%239 = or i32 %233, %238
store i32 %239, i32* %20
store i32 0, i32* %10
%240 = load i32, i32* %6
%241 = icmp sgt i32 %240, 1
br i1 %241, label %242, label %351
242: ; preds = %226
%243 = ptrtoint [10240 x i8]* %19 to i64
br label %244
244: ; preds = %242, %332
%245 = phi i32 [ %239, %242 ], [ %346, %332 ]
br i1 %36, label %246, label %250
246: ; preds = %244
%247 = call i32 @dskbr_(i32* %16, i8* %31, i32* %20, i32* %11)
%248 = load i32, i32* %11
%249 = icmp eq i32 %248, 0
br i1 %249, label %261, label %442
250: ; preds = %244
%251 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0), i32 %245)
%252 = call i32 @dskbr_(i32* %16, i8* %31, i32* %20, i32* %11)
%253 = load i32, i32* %11
%254 = icmp eq i32 %253, 0
br i1 %254, label %255, label %433
255: ; preds = %250
%256 = load i32, i32* %20
%257 = load i32, i32* %5
%258 = add i32 %256, -2
%259 = sub i32 %258, %257
%260 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.21, i64 0, i64 0), i32 %259)
br label %261
261: ; preds = %246, %255
%262 = load i32, i32* %5
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %263
%265 = load i32, i32* %20
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %266
%268 = getelementptr inbounds i8, i8* %267, i64 -2
%269 = icmp ult i8* %264, %268
br i1 %269, label %279, label %295
270: ; preds = %289
%271 = load i32, i32* %20
br label %272
272: ; preds = %270, %279
%273 = phi i32 [ %280, %279 ], [ %271, %270 ]
%274 = phi i8* [ %281, %279 ], [ %291, %270 ]
%275 = sext i32 %273 to i64
%276 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %275
%277 = getelementptr inbounds i8, i8* %276, i64 -2
%278 = icmp ult i8* %286, %277
br i1 %278, label %279, label %295
279: ; preds = %261, %272
%280 = phi i32 [ %273, %272 ], [ %265, %261 ]
%281 = phi i8* [ %274, %272 ], [ %32, %261 ]
%282 = phi i8* [ %286, %272 ], [ %264, %261 ]
%283 = getelementptr inbounds i8, i8* %282, i64 1
%284 = load i8, i8* %282
%285 = zext i8 %284 to i32
%286 = getelementptr inbounds i8, i8* %282, i64 2
%287 = load i8, i8* %283
store i32 0, i32* %9
%288 = icmp eq i8 %284, 0
br i1 %288, label %272, label %289
289: ; preds = %279, %289
%290 = phi i8* [ %291, %289 ], [ %281, %279 ]
%291 = getelementptr inbounds i8, i8* %290, i64 1
store i8 %287, i8* %290
%292 = load i32, i32* %9
%293 = add nsw i32 %292, 1
store i32 %293, i32* %9
%294 = icmp slt i32 %293, %285
br i1 %294, label %289, label %270
295: ; preds = %272, %261
%296 = phi i8* [ %32, %261 ], [ %274, %272 ]
br i1 %36, label %301, label %297
297: ; preds = %295
%298 = ptrtoint i8* %296 to i64
%299 = sub i64 %298, %243
%300 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.22, i64 0, i64 0), i64 %299)
br label %301
301: ; preds = %297, %295
%302 = load i32, i32* %10
%303 = mul nsw i32 %302, %3
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds i16, i16* %2, i64 %304
%306 = bitcast i16* %305 to i8*
%307 = load i32, i32* %5
%308 = icmp sgt i32 %307, 0
br i1 %308, label %309, label %327
309: ; preds = %301
%310 = getelementptr inbounds i8, i8* %306, i64 %222
%311 = getelementptr inbounds i8, i8* %306, i64 %221
br label %312
312: ; preds = %309, %312
%313 = phi i8* [ %322, %312 ], [ %310, %309 ]
%314 = phi i8* [ %321, %312 ], [ %311, %309 ]
%315 = phi i8* [ %319, %312 ], [ %32, %309 ]
%316 = phi i8* [ %317, %312 ], [ %31, %309 ]
%317 = getelementptr inbounds i8, i8* %316, i64 1
%318 = load i8, i8* %316
store i8 %318, i8* %314
%319 = getelementptr inbounds i8, i8* %315, i64 1
%320 = load i8, i8* %315
store i8 %320, i8* %313
%321 = getelementptr inbounds i8, i8* %314, i64 2
%322 = getelementptr inbounds i8, i8* %313, i64 2
%323 = load i32, i32* %5
%324 = sext i32 %323 to i64
%325 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %324
%326 = icmp ult i8* %317, %325
br i1 %326, label %312, label %327
327: ; preds = %312, %301
br i1 %36, label %332, label %328
328: ; preds = %327
%329 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), i32 %302)
%330 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.29, i64 0, i64 0))
%331 = load i32, i32* %10
br label %332
332: ; preds = %328, %327
%333 = phi i32 [ %331, %328 ], [ %302, %327 ]
%334 = load i32, i32* %20
%335 = add nsw i32 %334, -2
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %336
%338 = load i8, i8* %337
%339 = zext i8 %338 to i32
%340 = shl nuw nsw i32 %339, 8
%341 = add nsw i32 %334, -1
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %342
%344 = load i8, i8* %343
%345 = zext i8 %344 to i32
%346 = or i32 %340, %345
store i32 %346, i32* %20
%347 = add nsw i32 %333, 1
store i32 %347, i32* %10
%348 = load i32, i32* %6
%349 = add nsw i32 %348, -1
%350 = icmp slt i32 %347, %349
br i1 %350, label %244, label %351
351: ; preds = %332, %226
%352 = phi i32 [ %239, %226 ], [ %346, %332 ]
%353 = add nsw i32 %352, -2
store i32 %353, i32* %20
%354 = call i32 @dskbr_(i32* %16, i8* %31, i32* %20, i32* %11)
%355 = load i32, i32* %11
%356 = icmp eq i32 %355, 0
br i1 %356, label %357, label %430
357: ; preds = %351
%358 = load i32, i32* %5
%359 = load i32, i32* %20
%360 = icmp slt i32 %358, %359
br i1 %360, label %361, label %388
361: ; preds = %357
%362 = sext i32 %358 to i64
%363 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %362
br label %372
364: ; preds = %382
%365 = load i32, i32* %20
br label %366
366: ; preds = %364, %372
%367 = phi i32 [ %373, %372 ], [ %365, %364 ]
%368 = phi i8* [ %374, %372 ], [ %384, %364 ]
%369 = sext i32 %367 to i64
%370 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %369
%371 = icmp ult i8* %379, %370
br i1 %371, label %372, label %388
372: ; preds = %361, %366
%373 = phi i32 [ %367, %366 ], [ %359, %361 ]
%374 = phi i8* [ %368, %366 ], [ %32, %361 ]
%375 = phi i8* [ %379, %366 ], [ %363, %361 ]
%376 = getelementptr inbounds i8, i8* %375, i64 1
%377 = load i8, i8* %375
%378 = zext i8 %377 to i32
%379 = getelementptr inbounds i8, i8* %375, i64 2
%380 = load i8, i8* %376
store i32 0, i32* %9
%381 = icmp eq i8 %377, 0
br i1 %381, label %366, label %382
382: ; preds = %372, %382
%383 = phi i8* [ %384, %382 ], [ %374, %372 ]
%384 = getelementptr inbounds i8, i8* %383, i64 1
store i8 %380, i8* %383
%385 = load i32, i32* %9
%386 = add nsw i32 %385, 1
store i32 %386, i32* %9
%387 = icmp slt i32 %386, %378
br i1 %387, label %382, label %364
388: ; preds = %366, %357
%389 = phi i8* [ %32, %357 ], [ %368, %366 ]
br i1 %36, label %395, label %390
390: ; preds = %388
%391 = ptrtoint i8* %389 to i64
%392 = ptrtoint [10240 x i8]* %19 to i64
%393 = sub i64 %391, %392
%394 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.22, i64 0, i64 0), i64 %393)
br label %395
395: ; preds = %390, %388
%396 = load i32, i32* %10
%397 = mul nsw i32 %396, %3
%398 = sext i32 %397 to i64
%399 = getelementptr inbounds i16, i16* %2, i64 %398
%400 = bitcast i16* %399 to i8*
%401 = load i32, i32* %5
%402 = icmp sgt i32 %401, 0
br i1 %402, label %403, label %421
403: ; preds = %395
%404 = getelementptr inbounds i8, i8* %400, i64 %222
%405 = getelementptr inbounds i8, i8* %400, i64 %221
br label %406
406: ; preds = %403, %406
%407 = phi i8* [ %416, %406 ], [ %404, %403 ]
%408 = phi i8* [ %415, %406 ], [ %405, %403 ]
%409 = phi i8* [ %413, %406 ], [ %32, %403 ]
%410 = phi i8* [ %411, %406 ], [ %31, %403 ]
%411 = getelementptr inbounds i8, i8* %410, i64 1
%412 = load i8, i8* %410
store i8 %412, i8* %408
%413 = getelementptr inbounds i8, i8* %409, i64 1
%414 = load i8, i8* %409
store i8 %414, i8* %407
%415 = getelementptr inbounds i8, i8* %408, i64 2
%416 = getelementptr inbounds i8, i8* %407, i64 2
%417 = load i32, i32* %5
%418 = sext i32 %417 to i64
%419 = getelementptr inbounds [10240 x i8], [10240 x i8]* %18, i64 0, i64 %418
%420 = icmp ult i8* %411, %419
br i1 %420, label %406, label %421
421: ; preds = %406, %395
br i1 %36, label %424, label %422
422: ; preds = %421
%423 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %424
424: ; preds = %422, %421
%425 = call i32 @puthd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %1)
br label %430
426: ; preds = %192
br i1 %36, label %429, label %427
427: ; preds = %426
%428 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0))
br label %429
429: ; preds = %427, %426
store i32 -2, i32* %11
br label %430
430: ; preds = %142, %179, %176, %424, %169, %351, %220, %209, %213, %202, %206, %195, %199, %131, %98, %102, %91, %95, %83, %88, %67, %429, %168
br i1 %36, label %438, label %431
431: ; preds = %430
%432 = load i32, i32* %11
br label %433
433: ; preds = %250, %431, %49
%434 = phi i32 [ %432, %431 ], [ %55, %49 ], [ %253, %250 ]
%435 = load i32, i32* %5
%436 = load i32, i32* %6
%437 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.27, i64 0, i64 0), i32 %435, i32 %436, i32 %434)
br label %438
438: ; preds = %433, %430
%439 = load i32, i32* %11
%440 = icmp eq i32 %439, 0
%441 = select i1 %440, i32* %11, i32* %9
br label %442
442: ; preds = %246, %438, %44
%443 = phi i32* [ %9, %44 ], [ %441, %438 ], [ %9, %246 ]
%444 = call i32 @dskbcr_(i32* %16, i32* %443)
br i1 %36, label %448, label %445
445: ; preds = %442
%446 = load i32, i32* %11
%447 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i32 %446)
br label %448
448: ; preds = %445, %442
%449 = load i32, i32* %11
br label %450
450: ; preds = %39, %448
%451 = phi i32 [ %449, %448 ], [ %41, %39 ]
ret i32 %451
}