#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*/ clrhd(char *);
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 /*<<< orphan*/ free(char *);
int getbo();
void *malloc(int);
int mar_getnover(char *);
int /*<<< orphan*/ mar_getover(unsigned int *, int, int *, int *, int *);
int /*<<< orphan*/ mar_putheader(char *, char *);
int /*<<< orphan*/ memcpy(int *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puthd(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ swpbyt(int, int, char *);
int rdmar(char *filename, char **head, int *lhead, char **array, int *naxis,
          int *axis, int *type) {
  int readl;
  int i, j;
  int istat, cbo;
  char s[80];
  int lun = 1;
  int lflag;
  int is1, is2;
  int martest[512];
  char marhead[2000];
  int nover;
  int filec_debug = filec_getdebug();
  *array = 0;
  *head = 0;
  is1 = 0;
  is2 = 0;
  cbo = getbo();
  j = strlen(filename);
  if (filec_debug)
    printf("Opening file: %s\n", filename);
  dskbor_(&lun, filename, &j, &istat);
  if (istat != 0)
    return -1;
  lflag = (1 == 1);
  if (filec_debug)
    printf("Reading header\n");
  dskbwr_(&lun, &lflag);
  readl = 512;
  dskbr_(&lun, marhead, &readl, &istat);
  if (filec_debug)
    printf("Read Completion status : %d\n", istat);
  if (istat != 0)
    goto close;
  memcpy(martest, marhead, 8);
  if (filec_debug) {
    if (cbo == 0)
      printf("This computer is little endian\n");
    else
      printf("This computer is big endian\n");
  }
  if (cbo == 0)
    swpbyt(1, 8, (char *)martest);
  if (filec_debug)
    printf("Checking if mar image %d %d \n", *martest, *(martest + 1));
  if ((*martest == 2000 && *(martest + 1) == 2000) ||
      (*martest == 1200 && *(martest + 1) == 1200)) {
    is1 = *martest;
    is2 = *(martest + 1);
    if (filec_debug)
      printf("Read MAR Image Plate (%d x %d)\n", is1, is2);
    readl = is1 * 2 - 512;
    dskbr_(&lun, marhead, &readl, &istat);
    nover = mar_getnover(marhead);
    if (filec_debug)
      printf("Number of overflow pixels %d\n", nover);
    *lhead = 4096;
    *head = malloc(4096);
    memset(*head, 0, 4096);
    clrhd(*head);
    mar_putheader(marhead, *head);
    *naxis = 2;
    axis[0] = is1;
    axis[1] = is2;
    puthd("DIM", "2", *head);
    sprintf(s, "%d", is1);
    puthd("SIZE1", s, *head);
    sprintf(s, "%d", is1);
    puthd("SIZE2", s, *head);
    if (filec_debug)
      printf("Updated Header        : \n%s<END\n", *head);
    if (nover <= 0) {
      unsigned int *data;
      *type = 4;
      puthd("TYPE", "unsigned_short", *head);
      readl = is1 * is2 * sizeof(unsigned short);
      data = malloc(readl);
      *array = (char *)data;
      dskbr_(&lun, (char *)data, &readl, &istat);
      if (cbo == 0)
        swpbyt(0, readl, (char *)data);
    } else {
      unsigned short *a;
      unsigned int *b;
      int x, y, val;
      int datal;
      int *data;
      *type = 5;
      datal = is1 * is2 * sizeof(int);
      data = malloc(datal);
      *array = (char *)data;
      readl = is1 * is2 * sizeof(unsigned short);
      a = (unsigned short *)data;
      dskbr_(&lun, (char *)a, &readl, &istat);
      if (cbo == 0)
        swpbyt(0, readl, (char *)a);
      j = is1 * is2 - 1;
      for (i = j; i >= 0; i--)
        data[i] = (int)a[i];
      readl = nover * sizeof(unsigned int) * 2;
      b = (unsigned int *)malloc(readl);
      dskbr_(&lun, (char *)b, &readl, &istat);
      if (cbo == 0)
        swpbyt(1, readl, (char *)b);
      for (i = 0; i < nover; i++) {
        mar_getover(b, i, &x, &y, &val);
        if (filec_debug)
          printf("Overflow (%d,%d) : %d\n", x, y, val);
        data[y * is1 + x] = val;
      }
      free((char *)b);
    }
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
  } else
    istat = -1;
close:
  if (filec_debug)
    printf("Done reading MAR image (size %d x %d) (istat %d)\n", is1, is2,
           istat);
  if (istat != 0)
    dskbcr_(&lun, &i);
  else
    dskbcr_(&lun, &istat);
  if (filec_debug)
    printf("RDMAR completion status %d\n", istat);
  if (istat != 0) {
    if (*array != 0)
      free(*array);
    if (*head != 0)
      free(*head);
    return istat;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<rdmar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10c0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x1,-0xa4(%rbp)
mov    $0x0,%al
call   1040 <filec_getdebug@plt>
mov    %eax,-0x1088(%rbp)
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    $0x0,%al
call   1130 <getbo@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x1088(%rbp)
je     12cd <rdmar+0x9d>
mov    -0x10(%rbp),%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x44(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1070 <dskbor_@plt>
cmpl   $0x0,-0x48(%rbp)
je     12fb <rdmar+0xcb>
movl   $0xffffffff,-0x4(%rbp)
jmp    1992 <rdmar+0x762>
movl   $0x1,-0xa8(%rbp)
cmpl   $0x0,-0x1088(%rbp)
je     1320 <rdmar+0xf0>
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0xa4(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
call   10f0 <dskbwr_@plt>
movl   $0x200,-0x3c(%rbp)
lea    -0x1080(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1120 <dskbr_@plt>
cmpl   $0x0,-0x1088(%rbp)
je     1373 <rdmar+0x143>
mov    -0x48(%rbp),%esi
lea    0xcb6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     1382 <rdmar+0x152>
jmp    18cb <rdmar+0x69b>
lea    -0x8b0(%rbp),%rdi
lea    -0x1080(%rbp),%rsi
mov    $0x8,%edx
call   10e0 <memcpy@plt>
cmpl   $0x0,-0x1088(%rbp)
je     13d7 <rdmar+0x1a7>
cmpl   $0x0,-0x4c(%rbp)
jne    13c4 <rdmar+0x194>
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    13d2 <rdmar+0x1a2>
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    13d7 <rdmar+0x1a7>
cmpl   $0x0,-0x4c(%rbp)
jne    13f7 <rdmar+0x1c7>
lea    -0x8b0(%rbp),%rdx
mov    $0x1,%edi
mov    $0x8,%esi
call   10b0 <swpbyt@plt>
cmpl   $0x0,-0x1088(%rbp)
je     141e <rdmar+0x1ee>
mov    -0x8b0(%rbp),%esi
mov    -0x8ac(%rbp),%edx
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x7d0,-0x8b0(%rbp)
jne    143e <rdmar+0x20e>
cmpl   $0x7d0,-0x8ac(%rbp)
je     145e <rdmar+0x22e>
cmpl   $0x4b0,-0x8b0(%rbp)
jne    18bf <rdmar+0x68f>
cmpl   $0x4b0,-0x8ac(%rbp)
jne    18bf <rdmar+0x68f>
mov    -0x8b0(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x8ac(%rbp),%eax
mov    %eax,-0xb0(%rbp)
cmpl   $0x0,-0x1088(%rbp)
je     149d <rdmar+0x26d>
mov    -0xac(%rbp),%esi
mov    -0xb0(%rbp),%edx
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0xac(%rbp),%eax
shl    $0x1,%eax
sub    $0x200,%eax
mov    %eax,-0x3c(%rbp)
lea    -0x1080(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1120 <dskbr_@plt>
lea    -0x1080(%rbp),%rdi
call   1050 <mar_getnover@plt>
mov    %eax,-0x1084(%rbp)
cmpl   $0x0,-0x1088(%rbp)
je     14fc <rdmar+0x2cc>
mov    -0x1084(%rbp),%esi
lea    0xbc5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x20(%rbp),%rax
movl   $0x1000,(%rax)
mov    $0x1000,%edi
call   1100 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10c0 <memset@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1150 <clrhd@plt>
lea    -0x1080(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1110 <mar_putheader@plt>
mov    -0x30(%rbp),%rax
movl   $0x2,(%rax)
mov    -0xac(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xb0(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xb5b(%rip),%rdi
lea    0xb65(%rip),%rsi
call   10a0 <puthd@plt>
lea    -0xa0(%rbp),%rdi
mov    -0xac(%rbp),%edx
lea    0xb3f(%rip),%rsi
call   1140 <sprintf@plt>
lea    -0xa0(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xb28(%rip),%rdi
call   10a0 <puthd@plt>
lea    -0xa0(%rbp),%rdi
mov    -0xac(%rbp),%edx
lea    0xb0c(%rip),%rsi
call   1140 <sprintf@plt>
lea    -0xa0(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xafb(%rip),%rdi
call   10a0 <puthd@plt>
cmpl   $0x0,-0x1088(%rbp)
je     1611 <rdmar+0x3e1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xae1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x1084(%rbp)
jg     16b0 <rdmar+0x480>
mov    0x10(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xad6(%rip),%rdi
lea    0xad4(%rip),%rsi
call   10a0 <puthd@plt>
mov    -0xac(%rbp),%eax
imul   -0xb0(%rbp),%eax
cltq
shl    $0x1,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
call   1100 <malloc@plt>
mov    %rax,-0x1090(%rbp)
mov    -0x1090(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1090(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1120 <dskbr_@plt>
cmpl   $0x0,-0x4c(%rbp)
jne    16ab <rdmar+0x47b>
mov    -0x3c(%rbp),%esi
mov    -0x1090(%rbp),%rdx
xor    %edi,%edi
call   10b0 <swpbyt@plt>
jmp    189c <rdmar+0x66c>
mov    0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0xac(%rbp),%eax
imul   -0xb0(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,-0x10b0(%rbp)
mov    -0x10b0(%rbp),%edi
call   1100 <malloc@plt>
mov    %rax,-0x10b8(%rbp)
mov    -0x10b8(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xac(%rbp),%eax
imul   -0xb0(%rbp),%eax
cltq
shl    $0x1,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x10b8(%rbp),%rax
mov    %rax,-0x1098(%rbp)
mov    -0x1098(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1120 <dskbr_@plt>
cmpl   $0x0,-0x4c(%rbp)
jne    174d <rdmar+0x51d>
mov    -0x3c(%rbp),%esi
mov    -0x1098(%rbp),%rdx
xor    %edi,%edi
call   10b0 <swpbyt@plt>
mov    -0xac(%rbp),%eax
imul   -0xb0(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jl     179b <rdmar+0x56b>
mov    -0x1098(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzwl (%rax,%rcx,2),%edx
mov    -0x10b8(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    1766 <rdmar+0x536>
movslq -0x1084(%rbp),%rax
shl    $0x2,%rax
shl    $0x1,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
call   1100 <malloc@plt>
mov    %rax,-0x10a0(%rbp)
mov    -0x10a0(%rbp),%rsi
lea    -0xa4(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1120 <dskbr_@plt>
cmpl   $0x0,-0x4c(%rbp)
jne    17f5 <rdmar+0x5c5>
mov    -0x3c(%rbp),%esi
mov    -0x10a0(%rbp),%rdx
mov    $0x1,%edi
call   10b0 <swpbyt@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x1084(%rbp),%eax
jge    1890 <rdmar+0x660>
mov    -0x10a0(%rbp),%rdi
mov    -0x40(%rbp),%esi
lea    -0x10a4(%rbp),%rdx
lea    -0x10a8(%rbp),%rcx
lea    -0x10ac(%rbp),%r8
call   10d0 <mar_getover@plt>
cmpl   $0x0,-0x1088(%rbp)
je     185c <rdmar+0x62c>
mov    -0x10a4(%rbp),%esi
mov    -0x10a8(%rbp),%edx
mov    -0x10ac(%rbp),%ecx
lea    0x8cb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10ac(%rbp),%edx
mov    -0x10b8(%rbp),%rax
mov    -0x10a8(%rbp),%ecx
imul   -0xac(%rbp),%ecx
add    -0x10a4(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    17fc <rdmar+0x5cc>
mov    -0x10a0(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x1088(%rbp)
je     18ba <rdmar+0x68a>
mov    -0x48(%rbp),%esi
lea    0x76f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    18c6 <rdmar+0x696>
movl   $0xffffffff,-0x48(%rbp)
jmp    18cb <rdmar+0x69b>
cmpl   $0x0,-0x1088(%rbp)
je     18f5 <rdmar+0x6c5>
mov    -0xac(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0x849(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     1914 <rdmar+0x6e4>
lea    -0xa4(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <dskbcr_@plt>
jmp    1924 <rdmar+0x6f4>
lea    -0xa4(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1080 <dskbcr_@plt>
cmpl   $0x0,-0x1088(%rbp)
je     1942 <rdmar+0x712>
mov    -0x48(%rbp),%esi
lea    0x82e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     198b <rdmar+0x75b>
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     1966 <rdmar+0x736>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1980 <rdmar+0x750>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1992 <rdmar+0x762>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdmar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1078,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,0x38(%rsp)
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbp
movl   $0x1,0x8(%rsp)
xor    %eax,%eax
call   1040 <filec_getdebug@plt>
mov    %eax,%ebx
movq   $0x0,0x0(%r13)
movq   $0x0,(%r14)
xor    %eax,%eax
call   1140 <getbo@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %eax,0x34(%rsp)
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
je     12b6 <rdmar+0x76>
lea    0xd54(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0x8(%rsp),%rdi
lea    0x34(%rsp),%rdx
mov    %rsp,%rbx
mov    %rbp,%rsi
mov    %rbx,%rcx
call   1080 <dskbor_@plt>
mov    $0xffffffff,%eax
cmpl   $0x0,(%rsp)
jne    1935 <rdmar+0x6f5>
movl   $0x1,0x30(%rsp)
cmpl   $0x0,0xc(%rsp)
je     1385 <rdmar+0x145>
lea    0xe7c(%rip),%rdi
call   1050 <puts@plt>
lea    0x8(%rsp),%rbp
lea    0x30(%rsp),%rsi
mov    %rbp,%rdi
call   1100 <dskbwr_@plt>
movl   $0x200,0x4(%rsp)
lea    0x8a0(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbp,%rdi
call   1130 <dskbr_@plt>
mov    (%rsp),%esi
lea    0xcda(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%rsp),%ecx
mov    $0x0,%edx
test   %ecx,%ecx
jne    18ce <rdmar+0x68e>
lea    0xa0(%rsp),%rdi
lea    0x8a0(%rsp),%rsi
mov    $0x8,%edx
call   10f0 <memcpy@plt>
test   %r12d,%r12d
sete   %r12b
je     13ef <rdmar+0x1af>
lea    0xdbd(%rip),%rdi
call   1050 <puts@plt>
jmp    1412 <rdmar+0x1d2>
lea    0x8(%rsp),%rbp
lea    0x30(%rsp),%rsi
mov    %rbp,%rdi
call   1100 <dskbwr_@plt>
movl   $0x200,0x4(%rsp)
lea    0x8a0(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbp,%rdi
call   1130 <dskbr_@plt>
cmpl   $0x0,(%rsp)
je     13c7 <rdmar+0x187>
lea    0x14(%rsp),%rsi
jmp    18eb <rdmar+0x6ab>
lea    0xa0(%rsp),%rdi
lea    0x8a0(%rsp),%rsi
mov    $0x8,%edx
call   10f0 <memcpy@plt>
test   %r12d,%r12d
je     1737 <rdmar+0x4f7>
xor    %r12d,%r12d
jmp    142e <rdmar+0x1ee>
lea    0xd5e(%rip),%rdi
call   1050 <puts@plt>
lea    0xa0(%rsp),%rdx
mov    $0x1,%edi
mov    $0x8,%esi
call   10c0 <swpbyt@plt>
mov    0xa0(%rsp),%esi
mov    0xa4(%rsp),%edx
lea    0xc08(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
movslq 0xa0(%rsp),%rbp
mov    0xa4(%rsp),%eax
cmp    $0x7d0,%rbp
jne    144d <rdmar+0x20d>
cmp    $0x7d0,%eax
je     1464 <rdmar+0x224>
cmp    $0x4b0,%ebp
jne    171b <rdmar+0x4db>
cmp    $0x4b0,%eax
jne    171b <rdmar+0x4db>
mov    %eax,0x10(%rsp)
cmpl   $0x0,0xc(%rsp)
je     1483 <rdmar+0x243>
lea    0xbd7(%rip),%rdi
mov    %ebp,%esi
mov    0x10(%rsp),%edx
xor    %eax,%eax
call   10a0 <printf@plt>
lea    -0x200(%rbp,%rbp,1),%eax
mov    %eax,0x4(%rsp)
lea    0x8(%rsp),%rdi
lea    0x8a0(%rsp),%rbx
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rsi
call   1130 <dskbr_@plt>
mov    %rbx,%rdi
call   1060 <mar_getnover@plt>
mov    %eax,%ebx
cmpl   $0x0,0xc(%rsp)
je     14cc <rdmar+0x28c>
lea    0xbaa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,0x40(%rsp)
movl   $0x1000,(%r15)
mov    $0x1000,%edi
call   1110 <malloc@plt>
mov    %rax,(%r14)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10d0 <memset@plt>
mov    (%r14),%rdi
call   1160 <clrhd@plt>
mov    (%r14),%rsi
lea    0x8a0(%rsp),%rdi
call   1120 <mar_putheader@plt>
mov    0x38(%rsp),%rax
movl   $0x2,(%rax)
mov    0x18(%rsp),%rcx
mov    %ebp,(%rcx)
mov    0x10(%rsp),%eax
mov    %eax,0x4(%rcx)
mov    (%r14),%rdx
lea    0xb5c(%rip),%rdi
lea    0xb66(%rip),%rsi
call   10b0 <puthd@plt>
lea    0xb4d(%rip),%r15
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1150 <sprintf@plt>
mov    (%r14),%rdx
lea    0xb34(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <puthd@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,0x18(%rsp)
mov    %ebp,%edx
call   1150 <sprintf@plt>
mov    (%r14),%rdx
lea    0xb16(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <puthd@plt>
cmpl   $0x0,0xc(%rsp)
je     15a2 <rdmar+0x362>
mov    (%r14),%rsi
lea    0xb03(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x10b0(%rsp),%rax
mov    0x40(%rsp),%r15
test   %r15d,%r15d
jle    16b0 <rdmar+0x470>
movl   $0x5,(%rax)
mov    0x10(%rsp),%eax
mov    %eax,%ebp
imul   0x18(%rsp),%ebp
lea    0x0(,%rbp,4),%edi
call   1110 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x0(%r13)
lea    0x0(%rbp,%rbp,1),%eax
mov    %eax,0x4(%rsp)
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rsi
call   1130 <dskbr_@plt>
test   %r12b,%r12b
je     160c <rdmar+0x3cc>
mov    0x4(%rsp),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   10c0 <swpbyt@plt>
add    $0xffffffff,%ebp
mov    %ebp,0x34(%rsp)
cmp    $0x7,%ebp
jb     17b0 <rdmar+0x570>
lea    0x1(%rbp),%r8
mov    %r8,%r9
and    $0xfffffffffffffff8,%r9
lea    -0x8(%r9),%rax
mov    %rax,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
test   %rax,%rax
je     176a <rdmar+0x52a>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
lea    (%rbx,%rbp,4),%rcx
add    $0xfffffffffffffff4,%rcx
lea    (%rbx,%rbp,2),%rax
add    $0xfffffffffffffffa,%rax
xor    %esi,%esi
pxor   %xmm0,%xmm0
nopl   0x0(%rax)
movq   (%rax,%rsi,2),%xmm1
movq   -0x8(%rax,%rsi,2),%xmm2
punpcklwd %xmm0,%xmm1
movdqu %xmm1,(%rcx,%rsi,4)
punpcklwd %xmm0,%xmm2
movdqu %xmm2,-0x10(%rcx,%rsi,4)
movq   -0x10(%rax,%rsi,2),%xmm1
movq   -0x18(%rax,%rsi,2),%xmm2
punpcklwd %xmm0,%xmm1
movdqu %xmm1,-0x20(%rcx,%rsi,4)
punpcklwd %xmm0,%xmm2
movdqu %xmm2,-0x30(%rcx,%rsi,4)
add    $0xfffffffffffffff0,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1660 <rdmar+0x420>
neg    %rsi
jmp    176c <rdmar+0x52c>
movl   $0x4,(%rax)
mov    (%r14),%rdx
lea    0x9ff(%rip),%rdi
lea    0x9fd(%rip),%rsi
call   10b0 <puthd@plt>
mov    0x10(%rsp),%edi
mov    0x18(%rsp),%rbp
imul   %ebp,%edi
add    %edi,%edi
mov    %edi,0x4(%rsp)
call   1110 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x0(%r13)
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rsi
call   1130 <dskbr_@plt>
test   %r12b,%r12b
je     18ac <rdmar+0x66c>
mov    0x4(%rsp),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   10c0 <swpbyt@plt>
jmp    18ac <rdmar+0x66c>
movl   $0xffffffff,(%rsp)
cmpl   $0x0,0xc(%rsp)
je     1756 <rdmar+0x516>
xor    %ebp,%ebp
mov    $0xffffffff,%ecx
xor    %edx,%edx
jmp    18ce <rdmar+0x68e>
lea    0xa0(%rsp),%rdx
mov    $0x1,%edi
mov    $0x8,%esi
call   10c0 <swpbyt@plt>
mov    $0x1,%r12b
jmp    142e <rdmar+0x1ee>
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1090 <dskbcr_@plt>
jmp    190d <rdmar+0x6cd>
xor    %esi,%esi
test   $0x1,%dl
je     179b <rdmar+0x55b>
mov    %rbp,%rax
sub    %rsi,%rax
movq   -0x6(%rbx,%rax,2),%xmm0
movq   -0xe(%rbx,%rax,2),%xmm1
pxor   %xmm2,%xmm2
punpcklwd %xmm2,%xmm0
movdqu %xmm0,-0xc(%rbx,%rax,4)
punpcklwd %xmm2,%xmm1
movdqu %xmm1,-0x1c(%rbx,%rax,4)
cmp    %r9,%r8
je     17bd <rdmar+0x57d>
sub    %r9,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzwl (%rbx,%rbp,2),%eax
mov    %eax,(%rbx,%rbp,4)
add    $0xffffffffffffffff,%rbp
jb     17b0 <rdmar+0x570>
mov    %r13,0x48(%rsp)
mov    %r14,0x38(%rsp)
lea    0x0(,%r15,8),%edi
mov    %edi,0x4(%rsp)
call   1110 <malloc@plt>
mov    %rax,%rbp
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rsi
call   1130 <dskbr_@plt>
test   %r12b,%r12b
je     1806 <rdmar+0x5c6>
mov    0x4(%rsp),%esi
mov    $0x1,%edi
mov    %rbp,%rdx
call   10c0 <swpbyt@plt>
movl   $0x0,0x14(%rsp)
test   %r15d,%r15d
jle    1895 <rdmar+0x655>
mov    $0x1,%r14d
lea    0x2c(%rsp),%r12
lea    0x28(%rsp),%r15
lea    0x24(%rsp),%r13
jmp    185d <rdmar+0x61d>
xchg   %ax,%ax
mov    0x24(%rsp),%eax
movslq 0x28(%rsp),%rcx
imul   0x18(%rsp),%rcx
movslq 0x2c(%rsp),%rdx
add    %rcx,%rdx
mov    %eax,(%rbx,%rdx,4)
mov    %r14d,0x14(%rsp)
lea    0x1(%r14),%eax
cmp    0x40(%rsp),%r14d
mov    %eax,%r14d
jge    1895 <rdmar+0x655>
lea    -0x1(%r14),%esi
mov    %rbp,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r13,%r8
call   10e0 <mar_getover@plt>
cmpl   $0x0,0xc(%rsp)
je     1830 <rdmar+0x5f0>
mov    0x2c(%rsp),%esi
mov    0x28(%rsp),%edx
mov    0x24(%rsp),%ecx
lea    0x847(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1830 <rdmar+0x5f0>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%r14
mov    0x48(%rsp),%r13
mov    0x18(%rsp),%rbp
cmpl   $0x0,0xc(%rsp)
mov    %rsp,%rbx
je     18de <rdmar+0x69e>
mov    (%rsp),%esi
lea    0x752(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%rsp),%ecx
mov    0x10(%rsp),%edx
lea    0x815(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
cmpl   $0x0,(%rsp)
lea    0x14(%rsp),%rsi
cmove  %rbx,%rsi
lea    0x8(%rsp),%rdi
call   1090 <dskbcr_@plt>
cmpl   $0x0,0xc(%rsp)
je     190d <rdmar+0x6cd>
mov    (%rsp),%esi
lea    0x816(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
cmpl   $0x0,(%rsp)
je     1933 <rdmar+0x6f3>
mov    0x0(%r13),%rdi
test   %rdi,%rdi
je     1921 <rdmar+0x6e1>
call   1030 <free@plt>
mov    (%r14),%rdi
test   %rdi,%rdi
je     192e <rdmar+0x6ee>
call   1030 <free@plt>
mov    (%rsp),%eax
jmp    1935 <rdmar+0x6f5>
xor    %eax,%eax
add    $0x1078,%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 = [32 x i8] c"This computer is little endian\0A\00"
@.str.4 = [29 x i8] c"This computer is big endian\0A\00"
@.str.5 = [30 x i8] c"Checking if mar image %d %d \0A\00"
@.str.6 = [32 x i8] c"Read MAR Image Plate (%d x %d)\0A\00"
@.str.7 = [30 x i8] c"Number of overflow pixels %d\0A\00"
@.str.8 = [4 x i8] c"DIM\00"
@.str.9 = [2 x i8] c"2\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [6 x i8] c"SIZE1\00"
@.str.12 = [6 x i8] c"SIZE2\00"
@.str.13 = [33 x i8] c"Updated Header : \0A%s<END\0A\00"
@.str.14 = [5 x i8] c"TYPE\00"
@.str.15 = [15 x i8] c"unsigned_short\00"
@.str.16 = [23 x i8] c"Overflow (%d,%d) : %d\0A\00"
@.str.17 = [50 x i8] c"Done reading MAR image (size %d x %d) (istat %d)\0A\00"
@.str.18 = [28 x i8] c"RDMAR completion status %d\0A\00"
define i32 @rdmar(i8* %0, i8** %1, i32* %2, i8** %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8**
%11 = alloca i32*
%12 = alloca i8**
%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 [80 x i8]
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca [512 x i32]
%27 = alloca [2000 x i8]
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32*
%31 = alloca i16*
%32 = alloca i32*
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32*
store i8* %0, i8** %9
store i8** %1, i8*** %10
store i32* %2, i32** %11
store i8** %3, i8*** %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store i32* %6, i32** %15
store i32 1, i32* %22
%38 = call i32 (...) @filec_getdebug()
store i32 %38, i32* %29
%39 = load i8**, i8*** %12
store i8* null, i8** %39
%40 = load i8**, i8*** %10
store i8* null, i8** %40
store i32 0, i32* %24
store i32 0, i32* %25
%41 = call i32 (...) @getbo()
store i32 %41, i32* %20
%42 = load i8*, i8** %9
%43 = call i32 @strlen(i8* %42)
store i32 %43, i32* %18
%44 = load i32, i32* %29
%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* %22, i8* %50, i32* %18, i32* %19)
%52 = load i32, i32* %19
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 -1, i32* %8
br label %381
55: ; preds = %49
store i32 1, i32* %23
%56 = load i32, i32* %29
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %60
60: ; preds = %58, %55
%61 = call i32 @dskbwr_(i32* %22, i32* %23)
store i32 512, i32* %16
%62 = getelementptr inbounds [2000 x i8], [2000 x i8]* %27, i64 0, i64 0
%63 = call i32 @dskbr_(i32* %22, i8* %62, i32* %16, i32* %19)
%64 = load i32, i32* %29
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = load i32, i32* %19
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %66, %60
%70 = load i32, i32* %19
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %69
br label %338
73: ; preds = %69
%74 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%75 = getelementptr inbounds [2000 x i8], [2000 x i8]* %27, i64 0, i64 0
%76 = call i32 @memcpy(i32* %74, i8* %75, i32 8)
%77 = load i32, i32* %29
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %87
79: ; preds = %73
%80 = load i32, i32* %20
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %86
84: ; preds = %79
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %86
86: ; preds = %84, %82
br label %87
87: ; preds = %86, %73
%88 = load i32, i32* %20
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %87
%91 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%92 = bitcast i32* %91 to i8*
%93 = call i32 @swpbyt(i32 1, i32 8, i8* %92)
br label %94
94: ; preds = %90, %87
%95 = load i32, i32* %29
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %104
97: ; preds = %94
%98 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%99 = load i32, i32* %98
%100 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%101 = getelementptr inbounds i32, i32* %100, i64 1
%102 = load i32, i32* %101
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %99, i32 %102)
br label %104
104: ; preds = %97, %94
%105 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%106 = load i32, i32* %105
%107 = icmp eq i32 %106, 2000
br i1 %107, label %108, label %113
108: ; preds = %104
%109 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%110 = getelementptr inbounds i32, i32* %109, i64 1
%111 = load i32, i32* %110
%112 = icmp eq i32 %111, 2000
br i1 %112, label %122, label %113
113: ; preds = %108, %104
%114 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%115 = load i32, i32* %114
%116 = icmp eq i32 %115, 1200
br i1 %116, label %117, label %336
117: ; preds = %113
%118 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%119 = getelementptr inbounds i32, i32* %118, i64 1
%120 = load i32, i32* %119
%121 = icmp eq i32 %120, 1200
br i1 %121, label %122, label %336
122: ; preds = %117, %108
%123 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%124 = load i32, i32* %123
store i32 %124, i32* %24
%125 = getelementptr inbounds [512 x i32], [512 x i32]* %26, i64 0, i64 0
%126 = getelementptr inbounds i32, i32* %125, i64 1
%127 = load i32, i32* %126
store i32 %127, i32* %25
%128 = load i32, i32* %29
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %134
130: ; preds = %122
%131 = load i32, i32* %24
%132 = load i32, i32* %25
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %131, i32 %132)
br label %134
134: ; preds = %130, %122
%135 = load i32, i32* %24
%136 = mul nsw i32 %135, 2
%137 = sub nsw i32 %136, 512
store i32 %137, i32* %16
%138 = getelementptr inbounds [2000 x i8], [2000 x i8]* %27, i64 0, i64 0
%139 = call i32 @dskbr_(i32* %22, i8* %138, i32* %16, i32* %19)
%140 = getelementptr inbounds [2000 x i8], [2000 x i8]* %27, i64 0, i64 0
%141 = call i32 @mar_getnover(i8* %140)
store i32 %141, i32* %28
%142 = load i32, i32* %29
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %134
%145 = load i32, i32* %28
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %145)
br label %147
147: ; preds = %144, %134
%148 = load i32*, i32** %11
store i32 4096, i32* %148
%149 = call i8* @malloc(i32 4096)
%150 = load i8**, i8*** %10
store i8* %149, i8** %150
%151 = load i8**, i8*** %10
%152 = load i8*, i8** %151
%153 = call i32 @memset(i8* %152, i32 0, i32 4096)
%154 = load i8**, i8*** %10
%155 = load i8*, i8** %154
%156 = call i32 @clrhd(i8* %155)
%157 = getelementptr inbounds [2000 x i8], [2000 x i8]* %27, i64 0, i64 0
%158 = load i8**, i8*** %10
%159 = load i8*, i8** %158
%160 = call i32 @mar_putheader(i8* %157, i8* %159)
%161 = load i32*, i32** %13
store i32 2, i32* %161
%162 = load i32, i32* %24
%163 = load i32*, i32** %14
%164 = getelementptr inbounds i32, i32* %163, i64 0
store i32 %162, i32* %164
%165 = load i32, i32* %25
%166 = load i32*, i32** %14
%167 = getelementptr inbounds i32, i32* %166, i64 1
store i32 %165, i32* %167
%168 = load i8**, i8*** %10
%169 = load i8*, i8** %168
%170 = call i32 @puthd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* %169)
%171 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%172 = load i32, i32* %24
%173 = call i32 @sprintf(i8* %171, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %172)
%174 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%175 = load i8**, i8*** %10
%176 = load i8*, i8** %175
%177 = call i32 @puthd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %174, i8* %176)
%178 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%179 = load i32, i32* %24
%180 = call i32 @sprintf(i8* %178, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %179)
%181 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%182 = load i8**, i8*** %10
%183 = load i8*, i8** %182
%184 = call i32 @puthd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* %181, i8* %183)
%185 = load i32, i32* %29
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %191
187: ; preds = %147
%188 = load i8**, i8*** %10
%189 = load i8*, i8** %188
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0), i8* %189)
br label %191
191: ; preds = %187, %147
%192 = load i32, i32* %28
%193 = icmp sle i32 %192, 0
br i1 %193, label %194, label %222
194: ; preds = %191
%195 = load i32*, i32** %15
store i32 4, i32* %195
%196 = load i8**, i8*** %10
%197 = load i8*, i8** %196
%198 = call i32 @puthd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i8* %197)
%199 = load i32, i32* %24
%200 = load i32, i32* %25
%201 = mul nsw i32 %199, %200
%202 = sext i32 %201 to i64
%203 = mul i64 %202, 2
%204 = trunc i64 %203 to i32
store i32 %204, i32* %16
%205 = load i32, i32* %16
%206 = call i8* @malloc(i32 %205)
%207 = bitcast i8* %206 to i32*
store i32* %207, i32** %30
%208 = load i32*, i32** %30
%209 = bitcast i32* %208 to i8*
%210 = load i8**, i8*** %12
store i8* %209, i8** %210
%211 = load i32*, i32** %30
%212 = bitcast i32* %211 to i8*
%213 = call i32 @dskbr_(i32* %22, i8* %212, i32* %16, i32* %19)
%214 = load i32, i32* %20
%215 = icmp eq i32 %214, 0
br i1 %215, label %216, label %221
216: ; preds = %194
%217 = load i32, i32* %16
%218 = load i32*, i32** %30
%219 = bitcast i32* %218 to i8*
%220 = call i32 @swpbyt(i32 0, i32 %217, i8* %219)
br label %221
221: ; preds = %216, %194
br label %329
222: ; preds = %191
%223 = load i32*, i32** %15
store i32 5, i32* %223
%224 = load i32, i32* %24
%225 = load i32, i32* %25
%226 = mul nsw i32 %224, %225
%227 = sext i32 %226 to i64
%228 = mul i64 %227, 4
%229 = trunc i64 %228 to i32
store i32 %229, i32* %36
%230 = load i32, i32* %36
%231 = call i8* @malloc(i32 %230)
%232 = bitcast i8* %231 to i32*
store i32* %232, i32** %37
%233 = load i32*, i32** %37
%234 = bitcast i32* %233 to i8*
%235 = load i8**, i8*** %12
store i8* %234, i8** %235
%236 = load i32, i32* %24
%237 = load i32, i32* %25
%238 = mul nsw i32 %236, %237
%239 = sext i32 %238 to i64
%240 = mul i64 %239, 2
%241 = trunc i64 %240 to i32
store i32 %241, i32* %16
%242 = load i32*, i32** %37
%243 = bitcast i32* %242 to i16*
store i16* %243, i16** %31
%244 = load i16*, i16** %31
%245 = bitcast i16* %244 to i8*
%246 = call i32 @dskbr_(i32* %22, i8* %245, i32* %16, i32* %19)
%247 = load i32, i32* %20
%248 = icmp eq i32 %247, 0
br i1 %248, label %249, label %254
249: ; preds = %222
%250 = load i32, i32* %16
%251 = load i16*, i16** %31
%252 = bitcast i16* %251 to i8*
%253 = call i32 @swpbyt(i32 0, i32 %250, i8* %252)
br label %254
254: ; preds = %249, %222
%255 = load i32, i32* %24
%256 = load i32, i32* %25
%257 = mul nsw i32 %255, %256
%258 = sub nsw i32 %257, 1
store i32 %258, i32* %18
%259 = load i32, i32* %18
store i32 %259, i32* %17
br label %260
260: ; preds = %274, %254
%261 = load i32, i32* %17
%262 = icmp sge i32 %261, 0
br i1 %262, label %263, label %277
263: ; preds = %260
%264 = load i16*, i16** %31
%265 = load i32, i32* %17
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds i16, i16* %264, i64 %266
%268 = load i16, i16* %267
%269 = zext i16 %268 to i32
%270 = load i32*, i32** %37
%271 = load i32, i32* %17
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %270, i64 %272
store i32 %269, i32* %273
br label %274
274: ; preds = %263
%275 = load i32, i32* %17
%276 = add nsw i32 %275, -1
store i32 %276, i32* %17
br label %260
277: ; preds = %260
%278 = load i32, i32* %28
%279 = sext i32 %278 to i64
%280 = mul i64 %279, 4
%281 = mul i64 %280, 2
%282 = trunc i64 %281 to i32
store i32 %282, i32* %16
%283 = load i32, i32* %16
%284 = call i8* @malloc(i32 %283)
%285 = bitcast i8* %284 to i32*
store i32* %285, i32** %32
%286 = load i32*, i32** %32
%287 = bitcast i32* %286 to i8*
%288 = call i32 @dskbr_(i32* %22, i8* %287, i32* %16, i32* %19)
%289 = load i32, i32* %20
%290 = icmp eq i32 %289, 0
br i1 %290, label %291, label %296
291: ; preds = %277
%292 = load i32, i32* %16
%293 = load i32*, i32** %32
%294 = bitcast i32* %293 to i8*
%295 = call i32 @swpbyt(i32 1, i32 %292, i8* %294)
br label %296
296: ; preds = %291, %277
store i32 0, i32* %17
br label %297
297: ; preds = %322, %296
%298 = load i32, i32* %17
%299 = load i32, i32* %28
%300 = icmp slt i32 %298, %299
br i1 %300, label %301, label %325
301: ; preds = %297
%302 = load i32*, i32** %32
%303 = load i32, i32* %17
%304 = call i32 @mar_getover(i32* %302, i32 %303, i32* %33, i32* %34, i32* %35)
%305 = load i32, i32* %29
%306 = icmp ne i32 %305, 0
br i1 %306, label %307, label %312
307: ; preds = %301
%308 = load i32, i32* %33
%309 = load i32, i32* %34
%310 = load i32, i32* %35
%311 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 %308, i32 %309, i32 %310)
br label %312
312: ; preds = %307, %301
%313 = load i32, i32* %35
%314 = load i32*, i32** %37
%315 = load i32, i32* %34
%316 = load i32, i32* %24
%317 = mul nsw i32 %315, %316
%318 = load i32, i32* %33
%319 = add nsw i32 %317, %318
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds i32, i32* %314, i64 %320
store i32 %313, i32* %321
br label %322
322: ; preds = %312
%323 = load i32, i32* %17
%324 = add nsw i32 %323, 1
store i32 %324, i32* %17
br label %297
325: ; preds = %297
%326 = load i32*, i32** %32
%327 = bitcast i32* %326 to i8*
%328 = call i32 @free(i8* %327)
br label %329
329: ; preds = %325, %221
%330 = load i32, i32* %29
%331 = icmp ne i32 %330, 0
br i1 %331, label %332, label %335
332: ; preds = %329
%333 = load i32, i32* %19
%334 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %333)
br label %335
335: ; preds = %332, %329
br label %337
336: ; preds = %117, %113
store i32 -1, i32* %19
br label %337
337: ; preds = %336, %335
br label %338
338: ; preds = %337, %72
%339 = load i32, i32* %29
%340 = icmp ne i32 %339, 0
br i1 %340, label %341, label %346
341: ; preds = %338
%342 = load i32, i32* %24
%343 = load i32, i32* %25
%344 = load i32, i32* %19
%345 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.17, i64 0, i64 0), i32 %342, i32 %343, i32 %344)
br label %346
346: ; preds = %341, %338
%347 = load i32, i32* %19
%348 = icmp ne i32 %347, 0
br i1 %348, label %349, label %351
349: ; preds = %346
%350 = call i32 @dskbcr_(i32* %22, i32* %17)
br label %353
351: ; preds = %346
%352 = call i32 @dskbcr_(i32* %22, i32* %19)
br label %353
353: ; preds = %351, %349
%354 = load i32, i32* %29
%355 = icmp ne i32 %354, 0
br i1 %355, label %356, label %359
356: ; preds = %353
%357 = load i32, i32* %19
%358 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0), i32 %357)
br label %359
359: ; preds = %356, %353
%360 = load i32, i32* %19
%361 = icmp ne i32 %360, 0
br i1 %361, label %362, label %380
362: ; preds = %359
%363 = load i8**, i8*** %12
%364 = load i8*, i8** %363
%365 = icmp ne i8* %364, null
br i1 %365, label %366, label %370
366: ; preds = %362
%367 = load i8**, i8*** %12
%368 = load i8*, i8** %367
%369 = call i32 @free(i8* %368)
br label %370
370: ; preds = %366, %362
%371 = load i8**, i8*** %10
%372 = load i8*, i8** %371
%373 = icmp ne i8* %372, null
br i1 %373, label %374, label %378
374: ; preds = %370
%375 = load i8**, i8*** %10
%376 = load i8*, i8** %375
%377 = call i32 @free(i8* %376)
br label %378
378: ; preds = %374, %370
%379 = load i32, i32* %19
store i32 %379, i32* %8
br label %381
380: ; preds = %359
store i32 0, i32* %8
br label %381
381: ; preds = %380, %378, %54
%382 = load i32, i32* %8
ret i32 %382
}

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.5 = [30 x i8] c"Checking if mar image %d %d \0A\00"
@.str.6 = [32 x i8] c"Read MAR Image Plate (%d x %d)\0A\00"
@.str.7 = [30 x i8] c"Number of overflow pixels %d\0A\00"
@.str.8 = [4 x i8] c"DIM\00"
@.str.9 = [2 x i8] c"2\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [6 x i8] c"SIZE1\00"
@.str.12 = [6 x i8] c"SIZE2\00"
@.str.13 = [33 x i8] c"Updated Header : \0A%s<END\0A\00"
@.str.14 = [5 x i8] c"TYPE\00"
@.str.15 = [15 x i8] c"unsigned_short\00"
@.str.16 = [23 x i8] c"Overflow (%d,%d) : %d\0A\00"
@.str.17 = [50 x i8] c"Done reading MAR image (size %d x %d) (istat %d)\0A\00"
@.str.18 = [28 x i8] c"RDMAR completion status %d\0A\00"
@str = [28 x i8] c"This computer is big endian\00"
@str.19 = [31 x i8] c"This computer is little endian\00"
@str.20 = [15 x i8] c"Reading header\00"
define i32 @rdmar(i8* %0, i8** nocapture %1, i32* nocapture writeonly %2, i8** nocapture %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [80 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca [512 x i32]
%16 = alloca [2000 x i8]
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = bitcast i32* %8 to i8*
%21 = bitcast i32* %9 to i8*
%22 = bitcast i32* %10 to i8*
%23 = bitcast i32* %11 to i8*
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%25 = bitcast i32* %13 to i8*
store i32 1, i32* %13
%26 = bitcast i32* %14 to i8*
%27 = bitcast [512 x i32]* %15 to i8*
%28 = getelementptr inbounds [2000 x i8], [2000 x i8]* %16, i64 0, i64 0
%29 = tail call i32 (...) @filec_getdebug()
store i8* null, i8** %3
store i8* null, i8** %1
%30 = tail call i32 (...) @getbo()
%31 = tail call i32 @strlen(i8* %0)
store i32 %31, i32* %10
%32 = icmp eq i32 %29, 0
br i1 %32, label %35, label %33
33: ; preds = %7
%34 = 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 %35
35: ; preds = %33, %7
%36 = call i32 @dskbor_(i32* %13, i8* %0, i32* %10, i32* %11)
%37 = load i32, i32* %11
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %311
39: ; preds = %35
store i32 1, i32* %14
br i1 %32, label %48, label %40
40: ; preds = %39
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
%42 = call i32 @dskbwr_(i32* %13, i32* %14)
store i32 512, i32* %8
%43 = call i32 @dskbr_(i32* %13, i8* %28, i32* %8, i32* %11)
%44 = load i32, i32* %11
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %11
%47 = icmp eq i32 %46, 0
br i1 %47, label %53, label %279
48: ; preds = %39
%49 = call i32 @dskbwr_(i32* %13, i32* %14)
store i32 512, i32* %8
%50 = call i32 @dskbr_(i32* %13, i8* %28, i32* %8, i32* %11)
%51 = load i32, i32* %11
%52 = icmp eq i32 %51, 0
br i1 %52, label %59, label %288
53: ; preds = %40
%54 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 0
%55 = call i32 @memcpy(i32* %54, i8* %28, i32 8)
%56 = icmp eq i32 %30, 0
br i1 %56, label %65, label %57
57: ; preds = %53
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %68
59: ; preds = %48
%60 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 0
%61 = call i32 @memcpy(i32* %60, i8* %28, i32 8)
%62 = icmp eq i32 %30, 0
br i1 %62, label %63, label %74
63: ; preds = %59
%64 = call i32 @swpbyt(i32 1, i32 8, i8* %27)
br label %74
65: ; preds = %53
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.19, i64 0, i64 0))
%67 = call i32 @swpbyt(i32 1, i32 8, i8* %27)
br label %68
68: ; preds = %65, %57
%69 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 0
%70 = load i32, i32* %69
%71 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 1
%72 = load i32, i32* %71
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %70, i32 %72)
br label %74
74: ; preds = %59, %63, %68
%75 = phi i1 [ %56, %68 ], [ true, %63 ], [ false, %59 ]
%76 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 0
%77 = load i32, i32* %76
%78 = icmp eq i32 %77, 2000
%79 = getelementptr inbounds [512 x i32], [512 x i32]* %15, i64 0, i64 1
%80 = load i32, i32* %79
%81 = icmp eq i32 %80, 2000
%82 = select i1 %78, i1 %81, i1 false
br i1 %82, label %87, label %83
83: ; preds = %74
%84 = icmp eq i32 %77, 1200
%85 = icmp eq i32 %80, 1200
%86 = select i1 %84, i1 %85, i1 false
br i1 %86, label %87, label %278
87: ; preds = %83, %74
br i1 %32, label %90, label %88
88: ; preds = %87
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %77, i32 %80)
br label %90
90: ; preds = %88, %87
%91 = shl nuw nsw i32 %77, 1
%92 = add nsw i32 %91, -512
store i32 %92, i32* %8
%93 = call i32 @dskbr_(i32* %13, i8* %28, i32* %8, i32* %11)
%94 = call i32 @mar_getnover(i8* %28)
br i1 %32, label %97, label %95
95: ; preds = %90
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %94)
br label %97
97: ; preds = %95, %90
store i32 4096, i32* %2
%98 = call dereferenceable_or_null(4096) i8* @malloc(i32 4096)
store i8* %98, i8** %1
%99 = call i32 @memset(i8* %98, i32 0, i32 4096)
%100 = load i8*, i8** %1
%101 = call i32 @clrhd(i8* %100)
%102 = load i8*, i8** %1
%103 = call i32 @mar_putheader(i8* %28, i8* %102)
store i32 2, i32* %4
store i32 %77, i32* %5
%104 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %80, i32* %104
%105 = load i8*, i8** %1
%106 = call i32 @puthd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* %105)
%107 = call i32 @sprintf(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %77)
%108 = load i8*, i8** %1
%109 = call i32 @puthd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %24, i8* %108)
%110 = call i32 @sprintf(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %77)
%111 = load i8*, i8** %1
%112 = call i32 @puthd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* %24, i8* %111)
br i1 %32, label %116, label %113
113: ; preds = %97
%114 = load i8*, i8** %1
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0), i8* %114)
br label %116
116: ; preds = %113, %97
%117 = icmp slt i32 %94, 1
br i1 %117, label %118, label %128
118: ; preds = %116
store i32 4, i32* %6
%119 = load i8*, i8** %1
%120 = call i32 @puthd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i8* %119)
%121 = mul nuw nsw i32 %80, %77
%122 = shl nuw nsw i32 %121, 1
store i32 %122, i32* %8
%123 = call i8* @malloc(i32 %122)
store i8* %123, i8** %3
%124 = call i32 @dskbr_(i32* %13, i8* %123, i32* %8, i32* %11)
br i1 %75, label %125, label %273
125: ; preds = %118
%126 = load i32, i32* %8
%127 = call i32 @swpbyt(i32 0, i32 %126, i8* %123)
br label %273
128: ; preds = %116
%129 = bitcast i32* %17 to i8*
%130 = bitcast i32* %18 to i8*
%131 = bitcast i32* %19 to i8*
store i32 5, i32* %6
%132 = mul nuw nsw i32 %80, %77
%133 = shl nuw nsw i32 %132, 2
%134 = call i8* @malloc(i32 %133)
%135 = bitcast i8* %134 to i32*
store i8* %134, i8** %3
%136 = shl nuw nsw i32 %132, 1
store i32 %136, i32* %8
%137 = bitcast i8* %134 to i16*
%138 = call i32 @dskbr_(i32* %13, i8* %134, i32* %8, i32* %11)
br i1 %75, label %139, label %142
139: ; preds = %128
%140 = load i32, i32* %8
%141 = call i32 @swpbyt(i32 0, i32 %140, i8* %134)
br label %142
142: ; preds = %128, %139
%143 = add nsw i32 %132, -1
store i32 %143, i32* %10
%144 = zext i32 %143 to i64
%145 = add nuw nsw i64 %144, 1
%146 = icmp ult i32 %143, 7
br i1 %146, label %233, label %147
147: ; preds = %142
%148 = and i64 %145, 8589934584
%149 = sub nsw i64 %144, %148
%150 = add nsw i64 %148, -8
%151 = lshr exact i64 %150, 3
%152 = add nuw nsw i64 %151, 1
%153 = and i64 %152, 1
%154 = icmp eq i64 %150, 0
br i1 %154, label %206, label %155
155: ; preds = %147
%156 = and i64 %152, 4611686018427387902
br label %157
157: ; preds = %157, %155
%158 = phi i64 [ 0, %155 ], [ %203, %157 ]
%159 = phi i64 [ 0, %155 ], [ %204, %157 ]
%160 = sub i64 %144, %158
%161 = getelementptr inbounds i16, i16* %137, i64 %160
%162 = getelementptr inbounds i16, i16* %161, i64 -3
%163 = bitcast i16* %162 to <4 x i16>*
%164 = load <4 x i16>, <4 x i16>* %163
%165 = shufflevector <4 x i16> %164, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%166 = getelementptr inbounds i16, i16* %161, i64 -4
%167 = getelementptr inbounds i16, i16* %166, i64 -3
%168 = bitcast i16* %167 to <4 x i16>*
%169 = load <4 x i16>, <4 x i16>* %168
%170 = shufflevector <4 x i16> %169, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%171 = zext <4 x i16> %165 to <4 x i32>
%172 = zext <4 x i16> %170 to <4 x i32>
%173 = getelementptr inbounds i32, i32* %135, i64 %160
%174 = shufflevector <4 x i32> %171, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%175 = getelementptr inbounds i32, i32* %173, i64 -3
%176 = bitcast i32* %175 to <4 x i32>*
store <4 x i32> %174, <4 x i32>* %176
%177 = shufflevector <4 x i32> %172, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%178 = getelementptr inbounds i32, i32* %173, i64 -4
%179 = getelementptr inbounds i32, i32* %178, i64 -3
%180 = bitcast i32* %179 to <4 x i32>*
store <4 x i32> %177, <4 x i32>* %180
%181 = or i64 %158, 8
%182 = sub i64 %144, %181
%183 = getelementptr inbounds i16, i16* %137, i64 %182
%184 = getelementptr inbounds i16, i16* %183, i64 -3
%185 = bitcast i16* %184 to <4 x i16>*
%186 = load <4 x i16>, <4 x i16>* %185
%187 = shufflevector <4 x i16> %186, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%188 = getelementptr inbounds i16, i16* %183, i64 -4
%189 = getelementptr inbounds i16, i16* %188, i64 -3
%190 = bitcast i16* %189 to <4 x i16>*
%191 = load <4 x i16>, <4 x i16>* %190
%192 = shufflevector <4 x i16> %191, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%193 = zext <4 x i16> %187 to <4 x i32>
%194 = zext <4 x i16> %192 to <4 x i32>
%195 = getelementptr inbounds i32, i32* %135, i64 %182
%196 = shufflevector <4 x i32> %193, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%197 = getelementptr inbounds i32, i32* %195, i64 -3
%198 = bitcast i32* %197 to <4 x i32>*
store <4 x i32> %196, <4 x i32>* %198
%199 = shufflevector <4 x i32> %194, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%200 = getelementptr inbounds i32, i32* %195, i64 -4
%201 = getelementptr inbounds i32, i32* %200, i64 -3
%202 = bitcast i32* %201 to <4 x i32>*
store <4 x i32> %199, <4 x i32>* %202
%203 = add nuw i64 %158, 16
%204 = add i64 %159, 2
%205 = icmp eq i64 %204, %156
br i1 %205, label %206, label %157
206: ; preds = %157, %147
%207 = phi i64 [ 0, %147 ], [ %203, %157 ]
%208 = icmp eq i64 %153, 0
br i1 %208, label %231, label %209
209: ; preds = %206
%210 = sub i64 %144, %207
%211 = getelementptr inbounds i16, i16* %137, i64 %210
%212 = getelementptr inbounds i16, i16* %211, i64 -3
%213 = bitcast i16* %212 to <4 x i16>*
%214 = load <4 x i16>, <4 x i16>* %213
%215 = shufflevector <4 x i16> %214, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%216 = getelementptr inbounds i16, i16* %211, i64 -4
%217 = getelementptr inbounds i16, i16* %216, i64 -3
%218 = bitcast i16* %217 to <4 x i16>*
%219 = load <4 x i16>, <4 x i16>* %218
%220 = shufflevector <4 x i16> %219, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%221 = zext <4 x i16> %215 to <4 x i32>
%222 = zext <4 x i16> %220 to <4 x i32>
%223 = getelementptr inbounds i32, i32* %135, i64 %210
%224 = shufflevector <4 x i32> %221, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%225 = getelementptr inbounds i32, i32* %223, i64 -3
%226 = bitcast i32* %225 to <4 x i32>*
store <4 x i32> %224, <4 x i32>* %226
%227 = shufflevector <4 x i32> %222, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%228 = getelementptr inbounds i32, i32* %223, i64 -4
%229 = getelementptr inbounds i32, i32* %228, i64 -3
%230 = bitcast i32* %229 to <4 x i32>*
store <4 x i32> %227, <4 x i32>* %230
br label %231
231: ; preds = %206, %209
%232 = icmp eq i64 %145, %148
br i1 %232, label %243, label %233
233: ; preds = %142, %231
%234 = phi i64 [ %144, %142 ], [ %149, %231 ]
br label %235
235: ; preds = %233, %235
%236 = phi i64 [ %241, %235 ], [ %234, %233 ]
%237 = getelementptr inbounds i16, i16* %137, i64 %236
%238 = load i16, i16* %237
%239 = zext i16 %238 to i32
%240 = getelementptr inbounds i32, i32* %135, i64 %236
store i32 %239, i32* %240
%241 = add nsw i64 %236, -1
%242 = icmp eq i64 %236, 0
br i1 %242, label %243, label %235
243: ; preds = %235, %231
%244 = shl i32 %94, 3
store i32 %244, i32* %8
%245 = call i8* @malloc(i32 %244)
%246 = bitcast i8* %245 to i32*
%247 = call i32 @dskbr_(i32* %13, i8* %245, i32* %8, i32* %11)
br i1 %75, label %248, label %251
248: ; preds = %243
%249 = load i32, i32* %8
%250 = call i32 @swpbyt(i32 1, i32 %249, i8* %245)
br label %251
251: ; preds = %248, %243
store i32 0, i32* %9
%252 = icmp sgt i32 %94, 0
br i1 %252, label %253, label %271
253: ; preds = %251, %261
%254 = phi i32 [ %269, %261 ], [ 0, %251 ]
%255 = call i32 @mar_getover(i32* %246, i32 %254, i32* %17, i32* %18, i32* %19)
br i1 %32, label %261, label %256
256: ; preds = %253
%257 = load i32, i32* %17
%258 = load i32, i32* %18
%259 = load i32, i32* %19
%260 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 %257, i32 %258, i32 %259)
br label %261
261: ; preds = %256, %253
%262 = load i32, i32* %19
%263 = load i32, i32* %18
%264 = mul nsw i32 %263, %77
%265 = load i32, i32* %17
%266 = add nsw i32 %264, %265
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds i32, i32* %135, i64 %267
store i32 %262, i32* %268
%269 = add nuw nsw i32 %254, 1
store i32 %269, i32* %9
%270 = icmp slt i32 %269, %94
br i1 %270, label %253, label %271
271: ; preds = %261, %251
%272 = call i32 @free(i8* %245)
br label %273
273: ; preds = %118, %125, %271
br i1 %32, label %284, label %274
274: ; preds = %273
%275 = load i32, i32* %11
%276 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %275)
%277 = load i32, i32* %11
br label %279
278: ; preds = %83
store i32 -1, i32* %11
br i1 %32, label %294, label %279
279: ; preds = %274, %40, %278
%280 = phi i32 [ -1, %278 ], [ %46, %40 ], [ %277, %274 ]
%281 = phi i32 [ 0, %278 ], [ 0, %40 ], [ %77, %274 ]
%282 = phi i32 [ 0, %278 ], [ 0, %40 ], [ %80, %274 ]
%283 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.17, i64 0, i64 0), i32 %281, i32 %282, i32 %280)
br label %284
284: ; preds = %273, %279
%285 = load i32, i32* %11
%286 = icmp eq i32 %285, 0
%287 = select i1 %286, i32* %11, i32* %9
br label %288
288: ; preds = %284, %48
%289 = phi i32* [ %9, %48 ], [ %287, %284 ]
%290 = call i32 @dskbcr_(i32* %13, i32* %289)
br i1 %32, label %296, label %291
291: ; preds = %288
%292 = load i32, i32* %11
%293 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0), i32 %292)
br label %296
294: ; preds = %278
%295 = call i32 @dskbcr_(i32* %13, i32* %9)
br label %296
296: ; preds = %294, %291, %288
%297 = load i32, i32* %11
%298 = icmp eq i32 %297, 0
br i1 %298, label %311, label %299
299: ; preds = %296
%300 = load i8*, i8** %3
%301 = icmp eq i8* %300, null
br i1 %301, label %304, label %302
302: ; preds = %299
%303 = call i32 @free(i8* %300)
br label %304
304: ; preds = %302, %299
%305 = load i8*, i8** %1
%306 = icmp eq i8* %305, null
br i1 %306, label %309, label %307
307: ; preds = %304
%308 = call i32 @free(i8* %305)
br label %309
309: ; preds = %307, %304
%310 = load i32, i32* %11
br label %311
311: ; preds = %296, %35, %309
%312 = phi i32 [ %310, %309 ], [ -1, %35 ], [ 0, %296 ]
ret i32 %312
}