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

/* Forward declarations */

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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
unsigned int get_InitYYYYMMDDHH(unsigned char *);
int /*<<< orphan*/ get_TimeRange(unsigned char *, int *, int *, int *, int *,
                                 int *, int *);
int get_nxny(unsigned char *, unsigned char *, unsigned char *,
             unsigned char *);
scalar_t__ malloc(int);
unsigned char *mk_BDS(unsigned char *, float *, int);
unsigned char *mk_BMS(unsigned char *, float *, int *, double, double);
int /*<<< orphan*/ printf(char *, unsigned int);
long rd_grib_msg(int /*<<< orphan*/ *, long, unsigned char **, unsigned char **,
                 unsigned char **, unsigned char **);
int /*<<< orphan*/ set_InitYYYYMMDDHH(unsigned char *, unsigned int);
int /*<<< orphan*/ set_TimeRange(unsigned char *, int, int, int, int, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ unpk_bds(float *, unsigned char *, unsigned char *,
                            unsigned char *, unsigned char *, int);
int /*<<< orphan*/ wrt_grib_msg(int /*<<< orphan*/ *, unsigned char *,
                                unsigned char *, unsigned char *,
                                unsigned char *);
int main(int argc, char **argv) {
  long int len_grib, pos = 0;
  unsigned char *pds, *gds, *bms, *bds;
  FILE *input, *output;
  int i, nxny;
  float *array, *sum;
  int *count;
  int array_size, hr;
  int tr, p1, p2, units, nave, nmissing, expected_count;
  unsigned int field;
  unsigned int time0, time;
  if (argc != 3) {
    fprintf(stderr, "%s [in gribfile] [out gribfile]\n", argv[0]);
    exit(8);
  }
  if ((input = fopen(argv[1], "rb")) == NULL) {
    fprintf(stderr, "could not open file: %s\n", argv[1]);
    exit(7);
  }
  if ((output = fopen(argv[2], "wb")) == NULL) {
    fprintf(stderr, "could not open file: %s\n", argv[2]);
    exit(7);
  }
  count = (int *)malloc(200000 * sizeof(int));
  sum = (float *)malloc(200000 * sizeof(float));
  array = (float *)malloc(200000 * sizeof(float));
  array_size = 200000;
  if (count == NULL || sum == NULL || array == NULL) {
    fprintf(stderr, "memeory allocation failed\n");
    exit(8);
  }
  pos = 0;
  for (;;) {
    hr = 0;
    while (hr < 24) {
      len_grib = rd_grib_msg(input, pos, &pds, &gds, &bms, &bds);
      if (len_grib <= 0)
        break;
      time = get_InitYYYYMMDDHH(pds);
      if (hr == 0) {
        if (time % 100 != 0) {
          fprintf(stderr, "expecting 00Z not %d\n", time);
          pos += len_grib;
          continue;
        }
      } else {
        if (time != time0 + hr) {
          fprintf(stderr, "missing time %d %d\n", time, time0 + hr);
          hr = 0;
          continue;
        }
      }
      if (hr == 0) {
        time0 = time;
        nxny = get_nxny(pds, gds, bms, bds);
        if (nxny > 200000) {
          fprintf(stderr, "recompile with bigger N\n");
          exit(8);
        }
        for (i = 0; i < nxny; i++) {
          count[i] = 0;
          sum[i] = 0.0;
        }
        field = ((pds[8] << 24) + (pds[9] << 16) + (pds[10] << 8) + pds[11]);
      } else {
        if (field !=
            ((pds[8] << 24) + (pds[9] << 16) + (pds[10] << 8) + pds[11])) {
          fprintf(stderr, "changed field parameter\n");
          hr = 0;
          continue;
        }
        if (nxny != get_nxny(pds, gds, bms, bds)) {
          fprintf(stderr, "resolution change?\n");
          exit(8);
        }
      }
      unpk_bds(array, pds, gds, bms, bds, nxny);
      if ((pds[8]) == 15) {
        for (i = 0; i < nxny; i++) {
          if (!((array[i]) >= 9.9989e20 && (array[i]) <= 9.9991e20)) {
            if (count[i] == 0) {
              sum[i] = array[i];
              count[i] = 1;
            } else {
              if (sum[i] < array[i])
                sum[i] = array[i];
            }
          }
        }
      } else if ((pds[8]) == 16) {
        for (i = 0; i < nxny; i++) {
          if (!((array[i]) >= 9.9989e20 && (array[i]) <= 9.9991e20)) {
            if (count[i] == 0) {
              sum[i] = array[i];
              count[i] = 1;
            } else {
              if (sum[i] > array[i])
                sum[i] = array[i];
            }
          }
        }
      } else {
        for (i = 0; i < nxny; i++) {
          if (!((array[i]) >= 9.9989e20 && (array[i]) <= 9.9991e20)) {
            sum[i] += array[i];
            count[i]++;
          }
        }
      }
      pos += len_grib;
      hr += 6;
    }
    if (len_grib <= 0)
      break;
    expected_count = 24 / 6;
    if ((pds[8]) == 16 || (pds[8]) == 15)
      expected_count = 1;
    for (i = 0; i < nxny; i++) {
      if (count[i] == expected_count) {
        sum[i] /= (double)expected_count;
      } else {
        sum[i] = 9.999e20;
      }
    }
    printf("processing %d\n", time0);
    set_InitYYYYMMDDHH(pds, time0);
    get_TimeRange(pds, &tr, &p1, &p2, &units, &nave, &nmissing);
    if (tr == 3) {
      p1 = 0;
      p2 = 24;
      units = 1;
      nave = (24 / 6);
      nmissing = 0;
    } else if (tr == 10) {
      tr = 113;
      p1 = p2;
      p2 = 6;
      units = 1;
      nave = (24 / 6);
      nmissing = 0;
    } else if (tr == 2 && p1 == 0 && p2 == 6 && units == 1) {
      tr = 2;
      p1 = 0;
      p2 = 24;
      units = 1;
      nave = 0;
      nmissing = 0;
    } else {
      fprintf(stderr, "unexpected time range %d p=(%d,%d) units=%d\n", tr, p1,
              p2, units);
      continue;
    }
    set_TimeRange(pds, tr, p1, p2, units, nave, nmissing);
    bms = mk_BMS(pds, sum, &nxny, 9.9989e20, 9.9991e20);
    bds = mk_BDS(pds, sum, nxny);
    wrt_grib_msg(output, pds, gds, bms, bds);
    free(bds);
    if (bms)
      free(bms);
  }
  fclose(output);
  fclose(input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1263 <main+0x53>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc3(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    12ae <main+0x9e>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x7,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd94(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    12f9 <main+0xe9>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x7,%edi
call   1110 <exit@plt>
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x60(%rbp)
movl   $0x30d40,-0x74(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     134b <main+0x13b>
cmpq   $0x0,-0x68(%rbp)
je     134b <main+0x13b>
cmpq   $0x0,-0x60(%rbp)
jne    136c <main+0x15c>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
lea    0xcf9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x18,-0x78(%rbp)
jge    18dd <main+0x6cd>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x40(%rbp),%r9
call   10e0 <rd_grib_msg@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jg     13b6 <main+0x1a6>
jmp    18dd <main+0x6cd>
mov    -0x28(%rbp),%rdi
call   1130 <get_InitYYYYMMDDHH@plt>
mov    %eax,-0xa0(%rbp)
cmpl   $0x0,-0x78(%rbp)
jne    141a <main+0x20a>
mov    -0xa0(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
je     1415 <main+0x205>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
mov    -0xa0(%rbp),%edx
lea    0xc72(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    137b <main+0x16b>
jmp    1468 <main+0x258>
mov    -0xa0(%rbp),%eax
mov    -0x9c(%rbp),%ecx
add    -0x78(%rbp),%ecx
cmp    %ecx,%eax
je     1463 <main+0x253>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
mov    -0xa0(%rbp),%edx
mov    -0x9c(%rbp),%ecx
add    -0x78(%rbp),%ecx
lea    0xc35(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x0,-0x78(%rbp)
jmp    137b <main+0x16b>
jmp    1468 <main+0x258>
cmpl   $0x0,-0x78(%rbp)
jne    153e <main+0x32e>
mov    -0xa0(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   10f0 <get_nxny@plt>
mov    %eax,-0x58(%rbp)
cmpl   $0x30d40,-0x58(%rbp)
jle    14c4 <main+0x2b4>
mov    0x2b36(%rip),%rax
mov    (%rax),%edi
lea    0xbe6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    1504 <main+0x2f4>
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    14cb <main+0x2bb>
mov    -0x28(%rbp),%rax
movzbl 0x8(%rax),%eax
shl    $0x18,%eax
mov    -0x28(%rbp),%rcx
movzbl 0x9(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x28(%rbp),%rcx
movzbl 0xa(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x28(%rbp),%rcx
movzbl 0xb(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x98(%rbp)
jmp    15f2 <main+0x3e2>
mov    -0x98(%rbp),%eax
mov    -0x28(%rbp),%rcx
movzbl 0x8(%rcx),%ecx
shl    $0x18,%ecx
mov    -0x28(%rbp),%rdx
movzbl 0x9(%rdx),%edx
shl    $0x10,%edx
add    %edx,%ecx
mov    -0x28(%rbp),%rdx
movzbl 0xa(%rdx),%edx
shl    $0x8,%edx
add    %edx,%ecx
mov    -0x28(%rbp),%rdx
movzbl 0xb(%rdx),%edx
add    %edx,%ecx
cmp    %ecx,%eax
je     159e <main+0x38e>
mov    0x2a5e(%rip),%rax
mov    (%rax),%edi
lea    0xb27(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x0,-0x78(%rbp)
jmp    137b <main+0x16b>
mov    -0x58(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   10f0 <get_nxny@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
cmp    %ecx,%eax
je     15ed <main+0x3dd>
mov    0x2a0d(%rip),%rax
mov    (%rax),%edi
lea    0xaef(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
jmp    15f2 <main+0x3e2>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x58(%rbp),%r9d
call   1070 <unpk_bds@plt>
mov    -0x28(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0xf,%eax
jne    1718 <main+0x508>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    1713 <main+0x503>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x9b4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1679 <main+0x469>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x999(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    1700 <main+0x4f0>
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    16b9 <main+0x4a9>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    16fb <main+0x4eb>
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    16f6 <main+0x4e6>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    16fb <main+0x4eb>
jmp    1700 <main+0x4f0>
jmp    1705 <main+0x4f5>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1627 <main+0x417>
jmp    18c3 <main+0x6b3>
mov    -0x28(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0x10,%eax
jne    181d <main+0x60d>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    1818 <main+0x608>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x8ab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1782 <main+0x572>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x890(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    1805 <main+0x5f5>
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    17c2 <main+0x5b2>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    1800 <main+0x5f0>
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
ucomiss (%rax,%rcx,4),%xmm0
jbe    17fb <main+0x5eb>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1800 <main+0x5f0>
jmp    1805 <main+0x5f5>
jmp    180a <main+0x5fa>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1730 <main+0x520>
jmp    18be <main+0x6ae>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    18b9 <main+0x6a9>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x7b7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1876 <main+0x666>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x79c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    18a6 <main+0x696>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    18ab <main+0x69b>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1824 <main+0x614>
jmp    18be <main+0x6ae>
jmp    18c3 <main+0x6b3>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x78(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x78(%rbp)
jmp    137b <main+0x16b>
cmpq   $0x0,-0x18(%rbp)
jg     18ed <main+0x6dd>
jmp    1bba <main+0x9aa>
movl   $0x4,-0x94(%rbp)
mov    -0x28(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0x10,%eax
je     1919 <main+0x709>
mov    -0x28(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0xf,%eax
jne    1923 <main+0x713>
movl   $0x1,-0x94(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    19a0 <main+0x790>
mov    -0x70(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x94(%rbp),%eax
jne    1978 <main+0x768>
cvtsi2sdl -0x94(%rbp),%xmm1
ff
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    198d <main+0x77d>
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  0x688(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1992 <main+0x782>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    192a <main+0x71a>
mov    -0x9c(%rbp),%esi
lea    0x732(%rip),%rdi
call   1080 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x9c(%rbp),%esi
call   1040 <set_InitYYYYMMDDHH@plt>
mov    -0x28(%rbp),%rdi
lea    -0x7c(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x84(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x8c(%rbp),%r9
lea    -0x90(%rbp),%rax
mov    %rax,(%rsp)
call   10d0 <get_TimeRange@plt>
cmpl   $0x3,-0x7c(%rbp)
jne    1a30 <main+0x820>
movl   $0x0,-0x80(%rbp)
movl   $0x18,-0x84(%rbp)
movl   $0x1,-0x88(%rbp)
movl   $0x4,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
jmp    1b1a <main+0x90a>
cmpl   $0xa,-0x7c(%rbp)
jne    1a77 <main+0x867>
movl   $0x71,-0x7c(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x80(%rbp)
movl   $0x6,-0x84(%rbp)
movl   $0x1,-0x88(%rbp)
movl   $0x4,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
jmp    1b15 <main+0x905>
cmpl   $0x2,-0x7c(%rbp)
jne    1ae0 <main+0x8d0>
cmpl   $0x0,-0x80(%rbp)
jne    1ae0 <main+0x8d0>
cmpl   $0x6,-0x84(%rbp)
jne    1ae0 <main+0x8d0>
cmpl   $0x1,-0x88(%rbp)
jne    1ae0 <main+0x8d0>
movl   $0x2,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
movl   $0x18,-0x84(%rbp)
movl   $0x1,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
jmp    1b10 <main+0x900>
mov    0x24f9(%rip),%rax
mov    (%rax),%edi
mov    -0x7c(%rbp),%edx
mov    -0x80(%rbp),%ecx
mov    -0x84(%rbp),%r8d
mov    -0x88(%rbp),%r9d
lea    0x5ea(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1374 <main+0x164>
jmp    1b15 <main+0x905>
jmp    1b1a <main+0x90a>
mov    -0x28(%rbp),%rdi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
mov    -0x90(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <set_TimeRange@plt>
mov    -0x28(%rbp),%rdi
mov    -0x68(%rbp),%rsi
lea    -0x58(%rbp),%rdx
movsd  0x4a6(%rip),%xmm0
movsd  0x4a6(%rip),%xmm1
call   1120 <mk_BMS@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x58(%rbp),%edx
call   10b0 <mk_BDS@plt>
mov    %rax,-0x40(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   1090 <wrt_grib_msg@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x38(%rbp)
je     1bb5 <main+0x9a5>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    1374 <main+0x164>
mov    -0x50(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    18cd <main+0x6bd>
mov    0x8(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     18f2 <main+0x6e2>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,0x70(%rsp)
test   %rax,%rax
je     1901 <main+0x6f1>
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
mov    %rax,%r15
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    $0xc3500,%edi
call   10c0 <malloc@plt>
test   %r15,%r15
je     1926 <main+0x716>
cmpq   $0x0,0x30(%rsp)
je     1926 <main+0x716>
test   %rax,%rax
je     1926 <main+0x716>
mov    %rax,0x58(%rsp)
xor    %r12d,%r12d
xor    %r14d,%r14d
mov    %r15,0x60(%rsp)
mov    %r14,%r13
mov    %rbx,%rdi
mov    %r14,%rsi
lea    0x10(%rsp),%rdx
lea    0x50(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x38(%rsp),%r9
call   10e0 <rd_grib_msg@plt>
test   %rax,%rax
jle    18aa <main+0x69a>
mov    %rax,%r14
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdi
call   1130 <get_InitYYYYMMDDHH@plt>
mov    %eax,%r15d
test   %r12d,%r12d
je     138d <main+0x17d>
lea    (%r12,%rbp,1),%ecx
cmp    %ecx,%r15d
jne    1340 <main+0x130>
mov    0x10(%rsp),%rdi
mov    0x8(%rdi),%eax
bswap  %eax
cmp    %eax,0x6c(%rsp)
je     1400 <main+0x1f0>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
lea    0xd7f(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    135a <main+0x14a>
nopl   0x0(%rax)
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
lea    0xd35(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x10(%rsp),%rdx
lea    0x50(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x38(%rsp),%r9
call   10e0 <rd_grib_msg@plt>
mov    %rax,%r14
xor    %r12d,%r12d
test   %rax,%rax
jg     12f0 <main+0xe0>
jmp    18aa <main+0x69a>
imul   $0xc28f5c29,%r15d,%eax
ror    $0x2,%eax
cmp    $0x28f5c29,%eax
jb     182e <main+0x61e>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
xor    %r12d,%r12d
lea    0xcba(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    %r14,%r13
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x10(%rsp),%rdx
lea    0x50(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x38(%rsp),%r9
call   10e0 <rd_grib_msg@plt>
mov    %rax,%r14
test   %rax,%rax
jg     12f0 <main+0xe0>
jmp    18aa <main+0x69a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%r15d
mov    0x50(%rsp),%rsi
mov    0x28(%rsp),%rdx
mov    0x38(%rsp),%rcx
call   10f0 <get_nxny@plt>
cmp    %eax,%r15d
jne    1938 <main+0x728>
mov    0x10(%rsp),%rsi
mov    0xc(%rsp),%r9d
mov    0x60(%rsp),%r15
mov    0x58(%rsp),%rdi
mov    0x50(%rsp),%rdx
mov    0x28(%rsp),%rcx
mov    0x38(%rsp),%r8
call   1070 <unpk_bds@plt>
mov    0x10(%rsp),%r8
mov    0x8(%r8),%cl
cmp    $0xf,%cl
je     14e0 <main+0x2d0>
cmp    $0x10,%cl
movsd  0xb99(%rip),%xmm2
movsd  0xb99(%rip),%xmm3
jne    155c <main+0x34c>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
mov    0x30(%rsp),%rdi
mov    0x58(%rsp),%rax
jle    15c0 <main+0x3b0>
xor    %edx,%edx
jmp    14b0 <main+0x2a0>
movss  %xmm0,(%rdi,%rdx,4)
movl   $0x1,(%r15,%rdx,4)
mov    0xc(%rsp),%ecx
add    $0x1,%rdx
movslq %ecx,%rsi
cmp    %rsi,%rdx
jge    15c0 <main+0x3b0>
movss  (%rax,%rdx,4),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jb     14c8 <main+0x2b8>
ucomisd %xmm1,%xmm3
jae    14a0 <main+0x290>
cmpl   $0x0,(%r15,%rdx,4)
je     148f <main+0x27f>
movss  (%rdi,%rdx,4),%xmm1
ucomiss %xmm0,%xmm1
jbe    14a0 <main+0x290>
movss  %xmm0,(%rdi,%rdx,4)
jmp    14a0 <main+0x290>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
mov    0x30(%rsp),%rdi
movsd  0xb0d(%rip),%xmm2
movsd  0xb0d(%rip),%xmm3
jle    15c0 <main+0x3b0>
xor    %edx,%edx
mov    0x58(%rsp),%rax
jmp    1530 <main+0x320>
movss  %xmm0,(%rdi,%rdx,4)
movl   $0x1,(%r15,%rdx,4)
mov    0xc(%rsp),%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdx
movslq %ecx,%rsi
cmp    %rsi,%rdx
jge    15c0 <main+0x3b0>
movss  (%rax,%rdx,4),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jb     1548 <main+0x338>
ucomisd %xmm1,%xmm3
jae    1520 <main+0x310>
cmpl   $0x0,(%r15,%rdx,4)
je     150a <main+0x2fa>
ucomiss (%rdi,%rdx,4),%xmm0
jbe    1520 <main+0x310>
movss  %xmm0,(%rdi,%rdx,4)
jmp    1520 <main+0x310>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
mov    0x30(%rsp),%rdi
mov    0x58(%rsp),%rax
jle    15c0 <main+0x3b0>
xor    %edx,%edx
jmp    159f <main+0x38f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addss  (%rdi,%rdx,4),%xmm0
movss  %xmm0,(%rdi,%rdx,4)
addl   $0x1,(%r15,%rdx,4)
mov    0xc(%rsp),%ecx
add    $0x1,%rdx
movslq %ecx,%rsi
cmp    %rsi,%rdx
jge    15c0 <main+0x3b0>
movss  (%rax,%rdx,4),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jb     1580 <main+0x370>
ucomisd %xmm1,%xmm3
jae    1593 <main+0x383>
jmp    1580 <main+0x370>
nopl   0x0(%rax)
add    %r13,%r14
lea    0x6(%r12),%edx
cmp    $0x12,%r12d
mov    %edx,%r12d
jl     12b8 <main+0xa8>
mov    0x8(%r8),%dl
add    $0xf1,%dl
xor    %eax,%eax
cmp    $0x2,%dl
setae  %dl
test   %ecx,%ecx
mov    0x30(%rsp),%rsi
movss  0xa1d(%rip),%xmm2
jle    163a <main+0x42a>
mov    %dl,%al
lea    (%rax,%rax,2),%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %ecx,%ecx
xor    %edx,%edx
jmp    161e <main+0x40e>
nopw   0x0(%rax,%rax,1)
movss  %xmm1,(%rsi,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     163a <main+0x42a>
movaps %xmm2,%xmm1
cmp    %eax,(%r15,%rdx,4)
jne    1610 <main+0x400>
movss  (%rsi,%rdx,4),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
jmp    1610 <main+0x400>
lea    0xa9e(%rip),%rdi
mov    %ebp,%esi
call   1080 <printf@plt>
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
call   1040 <set_InitYYYYMMDDHH@plt>
mov    0x10(%rsp),%rdi
lea    0x44(%rsp),%rax
mov    %rax,(%rsp)
lea    0x4c(%rsp),%rsi
lea    0x24(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x48(%rsp),%r9
call   10d0 <get_TimeRange@plt>
mov    0x4c(%rsp),%edx
cmp    $0xa,%edx
je     16c8 <main+0x4b8>
cmp    $0x3,%edx
jne    17a8 <main+0x598>
movl   $0x0,0x24(%rsp)
movl   $0x18,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
movl   $0x4,0x48(%rsp)
movl   $0x0,0x44(%rsp)
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x18,%ecx
jmp    1702 <main+0x4f2>
movl   $0x71,0x4c(%rsp)
mov    0x1c(%rsp),%edx
mov    %edx,0x24(%rsp)
movl   $0x6,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
movl   $0x4,0x48(%rsp)
movl   $0x0,0x44(%rsp)
mov    $0x71,%esi
mov    $0x6,%ecx
mov    $0x4,%r9d
mov    0x10(%rsp),%rdi
movl   $0x0,(%rsp)
mov    $0x1,%r8d
call   1050 <set_TimeRange@plt>
mov    0x10(%rsp),%rdi
mov    0x30(%rsp),%r12
mov    %r12,%rsi
lea    0xc(%rsp),%rdx
movsd  0x8c7(%rip),%xmm0
movsd  0x8c7(%rip),%xmm1
call   1120 <mk_BMS@plt>
mov    %rax,0x28(%rsp)
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%edx
mov    %r12,%rsi
call   10b0 <mk_BDS@plt>
mov    %rax,0x38(%rsp)
mov    0x10(%rsp),%rsi
mov    0x50(%rsp),%rdx
mov    0x28(%rsp),%rcx
mov    0x70(%rsp),%rdi
mov    %rax,%r8
call   1090 <wrt_grib_msg@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
mov    $0x0,%r12d
test   %rdi,%rdi
je     12b8 <main+0xa8>
call   1030 <free@plt>
xor    %r12d,%r12d
jmp    12b8 <main+0xa8>
mov    0x24(%rsp),%ecx
mov    0x1c(%rsp),%r8d
mov    0x20(%rsp),%r9d
cmp    $0x2,%edx
jne    180f <main+0x5ff>
test   %ecx,%ecx
jne    180f <main+0x5ff>
cmp    $0x6,%r8d
jne    180f <main+0x5ff>
cmp    $0x1,%r9d
jne    180f <main+0x5ff>
movl   $0x2,0x4c(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x18,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
movl   $0x0,0x48(%rsp)
movl   $0x0,0x44(%rsp)
mov    $0x2,%esi
mov    $0x18,%ecx
xor    %r9d,%r9d
xor    %edx,%edx
jmp    1708 <main+0x4f8>
mov    0x27ca(%rip),%rax
mov    (%rax),%edi
xor    %r12d,%r12d
lea    0x8cc(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    12b8 <main+0xa8>
mov    0x10(%rsp),%rdi
mov    0x50(%rsp),%rsi
mov    0x28(%rsp),%rdx
mov    0x38(%rsp),%rcx
call   10f0 <get_nxny@plt>
mov    %eax,0xc(%rsp)
cmp    $0x30d40,%eax
jg     1959 <main+0x749>
mov    %eax,%r9d
test   %eax,%eax
mov    0x30(%rsp),%rdx
mov    0x58(%rsp),%rdi
jle    188c <main+0x67c>
xor    %eax,%eax
mov    0x60(%rsp),%rcx
xchg   %ax,%ax
movl   $0x0,(%rcx,%rax,4)
movl   $0x0,(%rdx,%rax,4)
add    $0x1,%rax
movslq 0xc(%rsp),%r9
cmp    %r9,%rax
jl     1870 <main+0x660>
mov    0x10(%rsp),%rsi
mov    0x8(%rsi),%eax
bswap  %eax
mov    %eax,0x6c(%rsp)
xor    %r12d,%r12d
mov    %r15d,%ebp
mov    0x60(%rsp),%r15
jmp    1436 <main+0x226>
mov    0x70(%rsp),%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x270c(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0x733(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
mov    0x26e7(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
jmp    190e <main+0x6fe>
mov    0x26d8(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rdx
lea    0x723(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x7,%edi
call   1110 <exit@plt>
mov    0x26b3(%rip),%rax
mov    (%rax),%edi
lea    0x71e(%rip),%rsi
jmp    1948 <main+0x738>
mov    0x26a1(%rip),%rax
mov    (%rax),%edi
lea    0x783(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x8,%edi
call   1110 <exit@plt>
mov    0x2680(%rip),%rax
mov    (%rax),%edi
lea    0x730(%rip),%rsi
jmp    1948 <main+0x738>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"%s [in gribfile] [out gribfile]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [25 x i8] c"could not open file: %s\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [27 x i8] c"memeory allocation failed\0A\00"
@.str.5 = [22 x i8] c"expecting 00Z not %d\0A\00"
@.str.6 = [20 x i8] c"missing time %d %d\0A\00"
@.str.7 = [25 x i8] c"recompile with bigger N\0A\00"
@.str.8 = [25 x i8] c"changed field parameter\0A\00"
@.str.9 = [20 x i8] c"resolution change?\0A\00"
@.str.10 = [15 x i8] c"processing %d\0A\00"
@.str.11 = [45 x i8] c"unexpected time range %d p=(%d,%d) units=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca float*
%17 = alloca float*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
%31 = load i32, i32* %4
%32 = icmp ne i32 %31, 3
br i1 %32, label %33, label %40
33: ; preds = %2
%34 = load i32, i32* @stderr
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 8)
unreachable
40: ; preds = %2
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %44, i32** %12
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %53
46: ; preds = %40
%47 = load i32, i32* @stderr
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %50)
%52 = call i32 @exit(i32 7)
unreachable
53: ; preds = %40
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %57, i32** %13
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %66
59: ; preds = %53
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %63)
%65 = call i32 @exit(i32 7)
unreachable
66: ; preds = %53
%67 = call i64 @malloc(i32 800000)
%68 = inttoptr i64 %67 to i32*
store i32* %68, i32** %18
%69 = call i64 @malloc(i32 800000)
%70 = inttoptr i64 %69 to float*
store float* %70, float** %17
%71 = call i64 @malloc(i32 800000)
%72 = inttoptr i64 %71 to float*
store float* %72, float** %16
store i32 200000, i32* %19
%73 = load i32*, i32** %18
%74 = icmp eq i32* %73, null
br i1 %74, label %81, label %75
75: ; preds = %66
%76 = load float*, float** %17
%77 = icmp eq float* %76, null
br i1 %77, label %81, label %78
78: ; preds = %75
%79 = load float*, float** %16
%80 = icmp eq float* %79, null
br i1 %80, label %81, label %85
81: ; preds = %78, %75, %66
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%84 = call i32 @exit(i32 8)
unreachable
85: ; preds = %78
store i64 0, i64* %7
br label %86
86: ; preds = %554, %516, %85
store i32 0, i32* %20
br label %87
87: ; preds = %431, %209, %120, %106, %86
%88 = load i32, i32* %20
%89 = icmp slt i32 %88, 24
br i1 %89, label %90, label %437
90: ; preds = %87
%91 = load i32*, i32** %12
%92 = load i64, i64* %7
%93 = call i64 @rd_grib_msg(i32* %91, i64 %92, i8** %8, i8** %9, i8** %10, i8** %11)
store i64 %93, i64* %6
%94 = load i64, i64* %6
%95 = icmp sle i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %90
br label %437
97: ; preds = %90
%98 = load i8*, i8** %8
%99 = call i32 @get_InitYYYYMMDDHH(i8* %98)
store i32 %99, i32* %30
%100 = load i32, i32* %20
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %114
102: ; preds = %97
%103 = load i32, i32* %30
%104 = urem i32 %103, 100
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %113
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = load i32, i32* %30
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %108)
%110 = load i64, i64* %6
%111 = load i64, i64* %7
%112 = add nsw i64 %111, %110
store i64 %112, i64* %7
br label %87
113: ; preds = %102
br label %128
114: ; preds = %97
%115 = load i32, i32* %30
%116 = load i32, i32* %29
%117 = load i32, i32* %20
%118 = add i32 %116, %117
%119 = icmp ne i32 %115, %118
br i1 %119, label %120, label %127
120: ; preds = %114
%121 = load i32, i32* @stderr
%122 = load i32, i32* %30
%123 = load i32, i32* %29
%124 = load i32, i32* %20
%125 = add i32 %123, %124
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %122, i32 %125)
store i32 0, i32* %20
br label %87
127: ; preds = %114
br label %128
128: ; preds = %127, %113
%129 = load i32, i32* %20
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %184
131: ; preds = %128
%132 = load i32, i32* %30
store i32 %132, i32* %29
%133 = load i8*, i8** %8
%134 = load i8*, i8** %9
%135 = load i8*, i8** %10
%136 = load i8*, i8** %11
%137 = call i32 @get_nxny(i8* %133, i8* %134, i8* %135, i8* %136)
store i32 %137, i32* %15
%138 = load i32, i32* %15
%139 = icmp sgt i32 %138, 200000
br i1 %139, label %140, label %144
140: ; preds = %131
%141 = load i32, i32* @stderr
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%143 = call i32 @exit(i32 8)
unreachable
144: ; preds = %131
store i32 0, i32* %14
br label %145
145: ; preds = %158, %144
%146 = load i32, i32* %14
%147 = load i32, i32* %15
%148 = icmp slt i32 %146, %147
br i1 %148, label %149, label %161
149: ; preds = %145
%150 = load i32*, i32** %18
%151 = load i32, i32* %14
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %150, i64 %152
store i32 0, i32* %153
%154 = load float*, float** %17
%155 = load i32, i32* %14
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds float, float* %154, i64 %156
store float 0.000000e+00, float* %157
br label %158
158: ; preds = %149
%159 = load i32, i32* %14
%160 = add nsw i32 %159, 1
store i32 %160, i32* %14
br label %145
161: ; preds = %145
%162 = load i8*, i8** %8
%163 = getelementptr inbounds i8, i8* %162, i64 8
%164 = load i8, i8* %163
%165 = zext i8 %164 to i32
%166 = shl i32 %165, 24
%167 = load i8*, i8** %8
%168 = getelementptr inbounds i8, i8* %167, i64 9
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = shl i32 %170, 16
%172 = add nsw i32 %166, %171
%173 = load i8*, i8** %8
%174 = getelementptr inbounds i8, i8* %173, i64 10
%175 = load i8, i8* %174
%176 = zext i8 %175 to i32
%177 = shl i32 %176, 8
%178 = add nsw i32 %172, %177
%179 = load i8*, i8** %8
%180 = getelementptr inbounds i8, i8* %179, i64 11
%181 = load i8, i8* %180
%182 = zext i8 %181 to i32
%183 = add nsw i32 %178, %182
store i32 %183, i32* %28
br label %225
184: ; preds = %128
%185 = load i32, i32* %28
%186 = load i8*, i8** %8
%187 = getelementptr inbounds i8, i8* %186, i64 8
%188 = load i8, i8* %187
%189 = zext i8 %188 to i32
%190 = shl i32 %189, 24
%191 = load i8*, i8** %8
%192 = getelementptr inbounds i8, i8* %191, i64 9
%193 = load i8, i8* %192
%194 = zext i8 %193 to i32
%195 = shl i32 %194, 16
%196 = add nsw i32 %190, %195
%197 = load i8*, i8** %8
%198 = getelementptr inbounds i8, i8* %197, i64 10
%199 = load i8, i8* %198
%200 = zext i8 %199 to i32
%201 = shl i32 %200, 8
%202 = add nsw i32 %196, %201
%203 = load i8*, i8** %8
%204 = getelementptr inbounds i8, i8* %203, i64 11
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = add nsw i32 %202, %206
%208 = icmp ne i32 %185, %207
br i1 %208, label %209, label %212
209: ; preds = %184
%210 = load i32, i32* @stderr
%211 = call i32 (i32, i8*, ...) @fprintf(i32 %210, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %20
br label %87
212: ; preds = %184
%213 = load i32, i32* %15
%214 = load i8*, i8** %8
%215 = load i8*, i8** %9
%216 = load i8*, i8** %10
%217 = load i8*, i8** %11
%218 = call i32 @get_nxny(i8* %214, i8* %215, i8* %216, i8* %217)
%219 = icmp ne i32 %213, %218
br i1 %219, label %220, label %224
220: ; preds = %212
%221 = load i32, i32* @stderr
%222 = call i32 (i32, i8*, ...) @fprintf(i32 %221, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%223 = call i32 @exit(i32 8)
unreachable
224: ; preds = %212
br label %225
225: ; preds = %224, %161
%226 = load float*, float** %16
%227 = load i8*, i8** %8
%228 = load i8*, i8** %9
%229 = load i8*, i8** %10
%230 = load i8*, i8** %11
%231 = load i32, i32* %15
%232 = call i32 @unpk_bds(float* %226, i8* %227, i8* %228, i8* %229, i8* %230, i32 %231)
%233 = load i8*, i8** %8
%234 = getelementptr inbounds i8, i8* %233, i64 8
%235 = load i8, i8* %234
%236 = zext i8 %235 to i32
%237 = icmp eq i32 %236, 15
br i1 %237, label %238, label %309
238: ; preds = %225
store i32 0, i32* %14
br label %239
239: ; preds = %305, %238
%240 = load i32, i32* %14
%241 = load i32, i32* %15
%242 = icmp slt i32 %240, %241
br i1 %242, label %243, label %308
243: ; preds = %239
%244 = load float*, float** %16
%245 = load i32, i32* %14
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds float, float* %244, i64 %246
%248 = load float, float* %247
%249 = fpext float %248 to double
%250 = fcmp oge double %249, 0x444B1A2170AD88AA
br i1 %250, label %251, label %259
251: ; preds = %243
%252 = load float*, float** %16
%253 = load i32, i32* %14
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds float, float* %252, i64 %254
%256 = load float, float* %255
%257 = fpext float %256 to double
%258 = fcmp ole double %257, 9.999100e+20
br i1 %258, label %304, label %259
259: ; preds = %251, %243
%260 = load i32*, i32** %18
%261 = load i32, i32* %14
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds i32, i32* %260, i64 %262
%264 = load i32, i32* %263
%265 = icmp eq i32 %264, 0
br i1 %265, label %266, label %280
266: ; preds = %259
%267 = load float*, float** %16
%268 = load i32, i32* %14
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds float, float* %267, i64 %269
%271 = load float, float* %270
%272 = load float*, float** %17
%273 = load i32, i32* %14
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds float, float* %272, i64 %274
store float %271, float* %275
%276 = load i32*, i32** %18
%277 = load i32, i32* %14
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds i32, i32* %276, i64 %278
store i32 1, i32* %279
br label %303
280: ; preds = %259
%281 = load float*, float** %17
%282 = load i32, i32* %14
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds float, float* %281, i64 %283
%285 = load float, float* %284
%286 = load float*, float** %16
%287 = load i32, i32* %14
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds float, float* %286, i64 %288
%290 = load float, float* %289
%291 = fcmp olt float %285, %290
br i1 %291, label %292, label %302
292: ; preds = %280
%293 = load float*, float** %16
%294 = load i32, i32* %14
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds float, float* %293, i64 %295
%297 = load float, float* %296
%298 = load float*, float** %17
%299 = load i32, i32* %14
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds float, float* %298, i64 %300
store float %297, float* %301
br label %302
302: ; preds = %292, %280
br label %303
303: ; preds = %302, %266
br label %304
304: ; preds = %303, %251
br label %305
305: ; preds = %304
%306 = load i32, i32* %14
%307 = add nsw i32 %306, 1
store i32 %307, i32* %14
br label %239
308: ; preds = %239
br label %431
309: ; preds = %225
%310 = load i8*, i8** %8
%311 = getelementptr inbounds i8, i8* %310, i64 8
%312 = load i8, i8* %311
%313 = zext i8 %312 to i32
%314 = icmp eq i32 %313, 16
br i1 %314, label %315, label %386
315: ; preds = %309
store i32 0, i32* %14
br label %316
316: ; preds = %382, %315
%317 = load i32, i32* %14
%318 = load i32, i32* %15
%319 = icmp slt i32 %317, %318
br i1 %319, label %320, label %385
320: ; preds = %316
%321 = load float*, float** %16
%322 = load i32, i32* %14
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds float, float* %321, i64 %323
%325 = load float, float* %324
%326 = fpext float %325 to double
%327 = fcmp oge double %326, 0x444B1A2170AD88AA
br i1 %327, label %328, label %336
328: ; preds = %320
%329 = load float*, float** %16
%330 = load i32, i32* %14
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds float, float* %329, i64 %331
%333 = load float, float* %332
%334 = fpext float %333 to double
%335 = fcmp ole double %334, 9.999100e+20
br i1 %335, label %381, label %336
336: ; preds = %328, %320
%337 = load i32*, i32** %18
%338 = load i32, i32* %14
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds i32, i32* %337, i64 %339
%341 = load i32, i32* %340
%342 = icmp eq i32 %341, 0
br i1 %342, label %343, label %357
343: ; preds = %336
%344 = load float*, float** %16
%345 = load i32, i32* %14
%346 = sext i32 %345 to i64
%347 = getelementptr inbounds float, float* %344, i64 %346
%348 = load float, float* %347
%349 = load float*, float** %17
%350 = load i32, i32* %14
%351 = sext i32 %350 to i64
%352 = getelementptr inbounds float, float* %349, i64 %351
store float %348, float* %352
%353 = load i32*, i32** %18
%354 = load i32, i32* %14
%355 = sext i32 %354 to i64
%356 = getelementptr inbounds i32, i32* %353, i64 %355
store i32 1, i32* %356
br label %380
357: ; preds = %336
%358 = load float*, float** %17
%359 = load i32, i32* %14
%360 = sext i32 %359 to i64
%361 = getelementptr inbounds float, float* %358, i64 %360
%362 = load float, float* %361
%363 = load float*, float** %16
%364 = load i32, i32* %14
%365 = sext i32 %364 to i64
%366 = getelementptr inbounds float, float* %363, i64 %365
%367 = load float, float* %366
%368 = fcmp ogt float %362, %367
br i1 %368, label %369, label %379
369: ; preds = %357
%370 = load float*, float** %16
%371 = load i32, i32* %14
%372 = sext i32 %371 to i64
%373 = getelementptr inbounds float, float* %370, i64 %372
%374 = load float, float* %373
%375 = load float*, float** %17
%376 = load i32, i32* %14
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds float, float* %375, i64 %377
store float %374, float* %378
br label %379
379: ; preds = %369, %357
br label %380
380: ; preds = %379, %343
br label %381
381: ; preds = %380, %328
br label %382
382: ; preds = %381
%383 = load i32, i32* %14
%384 = add nsw i32 %383, 1
store i32 %384, i32* %14
br label %316
385: ; preds = %316
br label %430
386: ; preds = %309
store i32 0, i32* %14
br label %387
387: ; preds = %426, %386
%388 = load i32, i32* %14
%389 = load i32, i32* %15
%390 = icmp slt i32 %388, %389
br i1 %390, label %391, label %429
391: ; preds = %387
%392 = load float*, float** %16
%393 = load i32, i32* %14
%394 = sext i32 %393 to i64
%395 = getelementptr inbounds float, float* %392, i64 %394
%396 = load float, float* %395
%397 = fpext float %396 to double
%398 = fcmp oge double %397, 0x444B1A2170AD88AA
br i1 %398, label %399, label %407
399: ; preds = %391
%400 = load float*, float** %16
%401 = load i32, i32* %14
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds float, float* %400, i64 %402
%404 = load float, float* %403
%405 = fpext float %404 to double
%406 = fcmp ole double %405, 9.999100e+20
br i1 %406, label %425, label %407
407: ; preds = %399, %391
%408 = load float*, float** %16
%409 = load i32, i32* %14
%410 = sext i32 %409 to i64
%411 = getelementptr inbounds float, float* %408, i64 %410
%412 = load float, float* %411
%413 = load float*, float** %17
%414 = load i32, i32* %14
%415 = sext i32 %414 to i64
%416 = getelementptr inbounds float, float* %413, i64 %415
%417 = load float, float* %416
%418 = fadd float %417, %412
store float %418, float* %416
%419 = load i32*, i32** %18
%420 = load i32, i32* %14
%421 = sext i32 %420 to i64
%422 = getelementptr inbounds i32, i32* %419, i64 %421
%423 = load i32, i32* %422
%424 = add nsw i32 %423, 1
store i32 %424, i32* %422
br label %425
425: ; preds = %407, %399
br label %426
426: ; preds = %425
%427 = load i32, i32* %14
%428 = add nsw i32 %427, 1
store i32 %428, i32* %14
br label %387
429: ; preds = %387
br label %430
430: ; preds = %429, %385
br label %431
431: ; preds = %430, %308
%432 = load i64, i64* %6
%433 = load i64, i64* %7
%434 = add nsw i64 %433, %432
store i64 %434, i64* %7
%435 = load i32, i32* %20
%436 = add nsw i32 %435, 6
store i32 %436, i32* %20
br label %87
437: ; preds = %96, %87
%438 = load i64, i64* %6
%439 = icmp sle i64 %438, 0
br i1 %439, label %440, label %441
440: ; preds = %437
br label %555
441: ; preds = %437
store i32 4, i32* %27
%442 = load i8*, i8** %8
%443 = getelementptr inbounds i8, i8* %442, i64 8
%444 = load i8, i8* %443
%445 = zext i8 %444 to i32
%446 = icmp eq i32 %445, 16
br i1 %446, label %453, label %447
447: ; preds = %441
%448 = load i8*, i8** %8
%449 = getelementptr inbounds i8, i8* %448, i64 8
%450 = load i8, i8* %449
%451 = zext i8 %450 to i32
%452 = icmp eq i32 %451, 15
br i1 %452, label %453, label %454
453: ; preds = %447, %441
store i32 1, i32* %27
br label %454
454: ; preds = %453, %447
store i32 0, i32* %14
br label %455
455: ; preds = %484, %454
%456 = load i32, i32* %14
%457 = load i32, i32* %15
%458 = icmp slt i32 %456, %457
br i1 %458, label %459, label %487
459: ; preds = %455
%460 = load i32*, i32** %18
%461 = load i32, i32* %14
%462 = sext i32 %461 to i64
%463 = getelementptr inbounds i32, i32* %460, i64 %462
%464 = load i32, i32* %463
%465 = load i32, i32* %27
%466 = icmp eq i32 %464, %465
br i1 %466, label %467, label %478
467: ; preds = %459
%468 = load i32, i32* %27
%469 = sitofp i32 %468 to double
%470 = load float*, float** %17
%471 = load i32, i32* %14
%472 = sext i32 %471 to i64
%473 = getelementptr inbounds float, float* %470, i64 %472
%474 = load float, float* %473
%475 = fpext float %474 to double
%476 = fdiv double %475, %469
%477 = fptrunc double %476 to float
store float %477, float* %473
br label %483
478: ; preds = %459
%479 = load float*, float** %17
%480 = load i32, i32* %14
%481 = sext i32 %480 to i64
%482 = getelementptr inbounds float, float* %479, i64 %481
store float 0x444B1A3340000000, float* %482
br label %483
483: ; preds = %478, %467
br label %484
484: ; preds = %483
%485 = load i32, i32* %14
%486 = add nsw i32 %485, 1
store i32 %486, i32* %14
br label %455
487: ; preds = %455
%488 = load i32, i32* %29
%489 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %488)
%490 = load i8*, i8** %8
%491 = load i32, i32* %29
%492 = call i32 @set_InitYYYYMMDDHH(i8* %490, i32 %491)
%493 = load i8*, i8** %8
%494 = call i32 @get_TimeRange(i8* %493, i32* %21, i32* %22, i32* %23, i32* %24, i32* %25, i32* %26)
%495 = load i32, i32* %21
%496 = icmp eq i32 %495, 3
br i1 %496, label %497, label %498
497: ; preds = %487
store i32 0, i32* %22
store i32 24, i32* %23
store i32 1, i32* %24
store i32 4, i32* %25
store i32 0, i32* %26
br label %525
498: ; preds = %487
%499 = load i32, i32* %21
%500 = icmp eq i32 %499, 10
br i1 %500, label %501, label %503
501: ; preds = %498
store i32 113, i32* %21
%502 = load i32, i32* %23
store i32 %502, i32* %22
store i32 6, i32* %23
store i32 1, i32* %24
store i32 4, i32* %25
store i32 0, i32* %26
br label %524
503: ; preds = %498
%504 = load i32, i32* %21
%505 = icmp eq i32 %504, 2
br i1 %505, label %506, label %516
506: ; preds = %503
%507 = load i32, i32* %22
%508 = icmp eq i32 %507, 0
br i1 %508, label %509, label %516
509: ; preds = %506
%510 = load i32, i32* %23
%511 = icmp eq i32 %510, 6
br i1 %511, label %512, label %516
512: ; preds = %509
%513 = load i32, i32* %24
%514 = icmp eq i32 %513, 1
br i1 %514, label %515, label %516
515: ; preds = %512
store i32 2, i32* %21
store i32 0, i32* %22
store i32 24, i32* %23
store i32 1, i32* %24
store i32 0, i32* %25
store i32 0, i32* %26
br label %523
516: ; preds = %512, %509, %506, %503
%517 = load i32, i32* @stderr
%518 = load i32, i32* %21
%519 = load i32, i32* %22
%520 = load i32, i32* %23
%521 = load i32, i32* %24
%522 = call i32 (i32, i8*, ...) @fprintf(i32 %517, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i32 %518, i32 %519, i32 %520, i32 %521)
br label %86
523: ; preds = %515
br label %524
524: ; preds = %523, %501
br label %525
525: ; preds = %524, %497
%526 = load i8*, i8** %8
%527 = load i32, i32* %21
%528 = load i32, i32* %22
%529 = load i32, i32* %23
%530 = load i32, i32* %24
%531 = load i32, i32* %25
%532 = load i32, i32* %26
%533 = call i32 @set_TimeRange(i8* %526, i32 %527, i32 %528, i32 %529, i32 %530, i32 %531, i32 %532)
%534 = load i8*, i8** %8
%535 = load float*, float** %17
%536 = call i8* @mk_BMS(i8* %534, float* %535, i32* %15, double 0x444B1A2170AD88AA, double 9.999100e+20)
store i8* %536, i8** %10
%537 = load i8*, i8** %8
%538 = load float*, float** %17
%539 = load i32, i32* %15
%540 = call i8* @mk_BDS(i8* %537, float* %538, i32 %539)
store i8* %540, i8** %11
%541 = load i32*, i32** %13
%542 = load i8*, i8** %8
%543 = load i8*, i8** %9
%544 = load i8*, i8** %10
%545 = load i8*, i8** %11
%546 = call i32 @wrt_grib_msg(i32* %541, i8* %542, i8* %543, i8* %544, i8* %545)
%547 = load i8*, i8** %11
%548 = call i32 @free(i8* %547)
%549 = load i8*, i8** %10
%550 = icmp ne i8* %549, null
br i1 %550, label %551, label %554
551: ; preds = %525
%552 = load i8*, i8** %10
%553 = call i32 @free(i8* %552)
br label %554
554: ; preds = %551, %525
br label %86
555: ; preds = %440
%556 = load i32*, i32** %13
%557 = call i32 @fclose(i32* %556)
%558 = load i32*, i32** %12
%559 = call i32 @fclose(i32* %558)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"%s [in gribfile] [out gribfile]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [25 x i8] c"could not open file: %s\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [27 x i8] c"memeory allocation failed\0A\00"
@.str.5 = [22 x i8] c"expecting 00Z not %d\0A\00"
@.str.6 = [20 x i8] c"missing time %d %d\0A\00"
@.str.7 = [25 x i8] c"recompile with bigger N\0A\00"
@.str.8 = [25 x i8] c"changed field parameter\0A\00"
@.str.9 = [20 x i8] c"resolution change?\0A\00"
@.str.10 = [15 x i8] c"processing %d\0A\00"
@.str.11 = [45 x i8] c"unexpected time range %d p=(%d,%d) units=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = bitcast i8** %3 to i8*
%15 = bitcast i8** %4 to i8*
%16 = bitcast i8** %5 to i8*
%17 = bitcast i8** %6 to i8*
%18 = bitcast i32* %7 to i8*
%19 = bitcast i32* %8 to i8*
%20 = bitcast i32* %9 to i8*
%21 = bitcast i32* %10 to i8*
%22 = bitcast i32* %11 to i8*
%23 = bitcast i32* %12 to i8*
%24 = bitcast i32* %13 to i8*
%25 = icmp eq i32 %0, 3
br i1 %25, label %31, label %26
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %1
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = tail call i32 @exit(i32 8)
unreachable
31: ; preds = %2
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = load i8*, i8** %32
%34 = tail call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %32
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = tail call i32 @exit(i32 7)
unreachable
41: ; preds = %31
%42 = getelementptr inbounds i8*, i8** %1, i64 2
%43 = load i8*, i8** %42
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %51
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = load i8*, i8** %42
%49 = tail call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %48)
%50 = tail call i32 @exit(i32 7)
unreachable
51: ; preds = %41
%52 = tail call i64 @malloc(i32 800000)
%53 = inttoptr i64 %52 to i32*
%54 = tail call i64 @malloc(i32 800000)
%55 = inttoptr i64 %54 to float*
%56 = tail call i64 @malloc(i32 800000)
%57 = inttoptr i64 %56 to float*
%58 = icmp eq i64 %52, 0
%59 = icmp eq i64 %54, 0
%60 = select i1 %58, i1 true, i1 %59
%61 = icmp eq i64 %56, 0
%62 = select i1 %60, i1 true, i1 %61
br i1 %62, label %63, label %67
63: ; preds = %51
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%66 = tail call i32 @exit(i32 8)
unreachable
67: ; preds = %51, %281
%68 = phi i32 [ %187, %281 ], [ undef, %51 ]
%69 = phi i32 [ %186, %281 ], [ undef, %51 ]
%70 = phi i32 [ %282, %281 ], [ 0, %51 ]
%71 = phi i64 [ %278, %281 ], [ 0, %51 ]
%72 = call i64 @rd_grib_msg(i32* %34, i64 %71, i8** %3, i8** %4, i8** %5, i8** %6)
%73 = icmp slt i64 %72, 1
br i1 %73, label %355, label %74
74: ; preds = %67, %87
%75 = phi i64 [ %91, %87 ], [ %72, %67 ]
%76 = phi i64 [ %90, %87 ], [ %71, %67 ]
%77 = phi i32 [ 0, %87 ], [ %70, %67 ]
br label %78
78: ; preds = %74, %99
%79 = phi i64 [ %75, %74 ], [ %100, %99 ]
%80 = phi i32 [ %77, %74 ], [ 0, %99 ]
%81 = load i8*, i8** %3
%82 = call i32 @get_InitYYYYMMDDHH(i8* %81)
%83 = icmp eq i32 %80, 0
br i1 %83, label %84, label %93
84: ; preds = %78
%85 = urem i32 %82, 100
%86 = icmp eq i32 %85, 0
br i1 %86, label %102, label %87
87: ; preds = %84
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %82)
%90 = add nsw i64 %79, %76
%91 = call i64 @rd_grib_msg(i32* %34, i64 %90, i8** %3, i8** %4, i8** %5, i8** %6)
%92 = icmp slt i64 %91, 1
br i1 %92, label %355, label %74
93: ; preds = %78
%94 = add i32 %68, %80
%95 = icmp eq i32 %82, %94
br i1 %95, label %144, label %96
96: ; preds = %93
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %82, i32 %94)
br label %99
99: ; preds = %96, %165
%100 = call i64 @rd_grib_msg(i32* %34, i64 %76, i8** %3, i8** %4, i8** %5, i8** %6)
%101 = icmp slt i64 %100, 1
br i1 %101, label %355, label %78
102: ; preds = %84
%103 = load i8*, i8** %3
%104 = load i8*, i8** %4
%105 = load i8*, i8** %5
%106 = load i8*, i8** %6
%107 = call i32 @get_nxny(i8* %103, i8* %104, i8* %105, i8* %106)
store i32 %107, i32* %7
%108 = icmp sgt i32 %107, 200000
br i1 %108, label %111, label %109
109: ; preds = %102
%110 = icmp sgt i32 %107, 0
br i1 %110, label %115, label %123
111: ; preds = %102
%112 = load i32, i32* @stderr
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%114 = call i32 @exit(i32 8)
unreachable
115: ; preds = %109, %115
%116 = phi i64 [ %119, %115 ], [ 0, %109 ]
%117 = getelementptr inbounds i32, i32* %53, i64 %116
store i32 0, i32* %117
%118 = getelementptr inbounds float, float* %55, i64 %116
store float 0.000000e+00, float* %118
%119 = add nuw nsw i64 %116, 1
%120 = load i32, i32* %7
%121 = sext i32 %120 to i64
%122 = icmp slt i64 %119, %121
br i1 %122, label %115, label %123
123: ; preds = %115, %109
%124 = phi i32 [ %107, %109 ], [ %120, %115 ]
%125 = load i8*, i8** %3
%126 = getelementptr inbounds i8, i8* %125, i64 8
%127 = load i8, i8* %126
%128 = zext i8 %127 to i32
%129 = shl nuw i32 %128, 24
%130 = getelementptr inbounds i8, i8* %125, i64 9
%131 = load i8, i8* %130
%132 = zext i8 %131 to i32
%133 = shl nuw nsw i32 %132, 16
%134 = or i32 %133, %129
%135 = getelementptr inbounds i8, i8* %125, i64 10
%136 = load i8, i8* %135
%137 = zext i8 %136 to i32
%138 = shl nuw nsw i32 %137, 8
%139 = or i32 %134, %138
%140 = getelementptr inbounds i8, i8* %125, i64 11
%141 = load i8, i8* %140
%142 = zext i8 %141 to i32
%143 = or i32 %139, %142
br label %182
144: ; preds = %93
%145 = load i8*, i8** %3
%146 = getelementptr inbounds i8, i8* %145, i64 8
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = shl nuw i32 %148, 24
%150 = getelementptr inbounds i8, i8* %145, i64 9
%151 = load i8, i8* %150
%152 = zext i8 %151 to i32
%153 = shl nuw nsw i32 %152, 16
%154 = or i32 %153, %149
%155 = getelementptr inbounds i8, i8* %145, i64 10
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = shl nuw nsw i32 %157, 8
%159 = or i32 %154, %158
%160 = getelementptr inbounds i8, i8* %145, i64 11
%161 = load i8, i8* %160
%162 = zext i8 %161 to i32
%163 = or i32 %159, %162
%164 = icmp eq i32 %69, %163
br i1 %164, label %168, label %165
165: ; preds = %144
%166 = load i32, i32* @stderr
%167 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %99
168: ; preds = %144
%169 = load i32, i32* %7
%170 = load i8*, i8** %4
%171 = load i8*, i8** %5
%172 = load i8*, i8** %6
%173 = call i32 @get_nxny(i8* %145, i8* %170, i8* %171, i8* %172)
%174 = icmp eq i32 %169, %173
br i1 %174, label %175, label %178
175: ; preds = %168
%176 = load i8*, i8** %3
%177 = load i32, i32* %7
br label %182
178: ; preds = %168
%179 = load i32, i32* @stderr
%180 = call i32 (i32, i8*, ...) @fprintf(i32 %179, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%181 = call i32 @exit(i32 8)
unreachable
182: ; preds = %175, %123
%183 = phi i32 [ %124, %123 ], [ %177, %175 ]
%184 = phi i8* [ %125, %123 ], [ %176, %175 ]
%185 = phi i32 [ 0, %123 ], [ %80, %175 ]
%186 = phi i32 [ %143, %123 ], [ %69, %175 ]
%187 = phi i32 [ %82, %123 ], [ %68, %175 ]
%188 = load i8*, i8** %4
%189 = load i8*, i8** %5
%190 = load i8*, i8** %6
%191 = call i32 @unpk_bds(float* %57, i8* %184, i8* %188, i8* %189, i8* %190, i32 %183)
%192 = load i8*, i8** %3
%193 = getelementptr inbounds i8, i8* %192, i64 8
%194 = load i8, i8* %193
switch i8 %194, label %201 [
i8 15, label %198
i8 16, label %195
]
195: ; preds = %182
%196 = load i32, i32* %7
%197 = icmp sgt i32 %196, 0
br i1 %197, label %229, label %276
198: ; preds = %182
%199 = load i32, i32* %7
%200 = icmp sgt i32 %199, 0
br i1 %200, label %204, label %276
201: ; preds = %182
%202 = load i32, i32* %7
%203 = icmp sgt i32 %202, 0
br i1 %203, label %254, label %276
204: ; preds = %198, %224
%205 = phi i32 [ %225, %224 ], [ %199, %198 ]
%206 = phi i64 [ %226, %224 ], [ 0, %198 ]
%207 = getelementptr inbounds float, float* %57, i64 %206
%208 = load float, float* %207
%209 = fpext float %208 to double
%210 = fcmp ult double %209, 0x444B1A2170AD88AA
%211 = fcmp ugt double %209, 9.999100e+20
%212 = or i1 %210, %211
br i1 %212, label %213, label %224
213: ; preds = %204
%214 = getelementptr inbounds i32, i32* %53, i64 %206
%215 = load i32, i32* %214
%216 = icmp eq i32 %215, 0
%217 = getelementptr inbounds float, float* %55, i64 %206
br i1 %216, label %218, label %220
218: ; preds = %213
store float %208, float* %217
store i32 1, i32* %214
%219 = load i32, i32* %7
br label %224
220: ; preds = %213
%221 = load float, float* %217
%222 = fcmp olt float %221, %208
br i1 %222, label %223, label %224
223: ; preds = %220
store float %208, float* %217
br label %224
224: ; preds = %204, %220, %223, %218
%225 = phi i32 [ %205, %204 ], [ %205, %220 ], [ %205, %223 ], [ %219, %218 ]
%226 = add nuw nsw i64 %206, 1
%227 = sext i32 %225 to i64
%228 = icmp slt i64 %226, %227
br i1 %228, label %204, label %276
229: ; preds = %195, %249
%230 = phi i32 [ %250, %249 ], [ %196, %195 ]
%231 = phi i64 [ %251, %249 ], [ 0, %195 ]
%232 = getelementptr inbounds float, float* %57, i64 %231
%233 = load float, float* %232
%234 = fpext float %233 to double
%235 = fcmp ult double %234, 0x444B1A2170AD88AA
%236 = fcmp ugt double %234, 9.999100e+20
%237 = or i1 %235, %236
br i1 %237, label %238, label %249
238: ; preds = %229
%239 = getelementptr inbounds i32, i32* %53, i64 %231
%240 = load i32, i32* %239
%241 = icmp eq i32 %240, 0
%242 = getelementptr inbounds float, float* %55, i64 %231
br i1 %241, label %243, label %245
243: ; preds = %238
store float %233, float* %242
store i32 1, i32* %239
%244 = load i32, i32* %7
br label %249
245: ; preds = %238
%246 = load float, float* %242
%247 = fcmp ogt float %246, %233
br i1 %247, label %248, label %249
248: ; preds = %245
store float %233, float* %242
br label %249
249: ; preds = %229, %245, %248, %243
%250 = phi i32 [ %230, %229 ], [ %230, %245 ], [ %230, %248 ], [ %244, %243 ]
%251 = add nuw nsw i64 %231, 1
%252 = sext i32 %250 to i64
%253 = icmp slt i64 %251, %252
br i1 %253, label %229, label %276
254: ; preds = %201, %271
%255 = phi i32 [ %272, %271 ], [ %202, %201 ]
%256 = phi i64 [ %273, %271 ], [ 0, %201 ]
%257 = getelementptr inbounds float, float* %57, i64 %256
%258 = load float, float* %257
%259 = fpext float %258 to double
%260 = fcmp ult double %259, 0x444B1A2170AD88AA
%261 = fcmp ugt double %259, 9.999100e+20
%262 = or i1 %260, %261
br i1 %262, label %263, label %271
263: ; preds = %254
%264 = getelementptr inbounds float, float* %55, i64 %256
%265 = load float, float* %264
%266 = fadd float %258, %265
store float %266, float* %264
%267 = getelementptr inbounds i32, i32* %53, i64 %256
%268 = load i32, i32* %267
%269 = add nsw i32 %268, 1
store i32 %269, i32* %267
%270 = load i32, i32* %7
br label %271
271: ; preds = %254, %263
%272 = phi i32 [ %255, %254 ], [ %270, %263 ]
%273 = add nuw nsw i64 %256, 1
%274 = sext i32 %272 to i64
%275 = icmp slt i64 %273, %274
br i1 %275, label %254, label %276
276: ; preds = %249, %224, %271, %195, %198, %201
%277 = phi i32 [ %196, %195 ], [ %199, %198 ], [ %202, %201 ], [ %272, %271 ], [ %225, %224 ], [ %250, %249 ]
%278 = add nsw i64 %79, %76
%279 = add nsw i32 %185, 6
%280 = icmp slt i32 %185, 18
br i1 %280, label %281, label %283
281: ; preds = %276, %333, %353, %330
%282 = phi i32 [ %279, %276 ], [ 0, %333 ], [ 0, %353 ], [ 0, %330 ]
br label %67
283: ; preds = %276
%284 = getelementptr inbounds i8, i8* %192, i64 8
%285 = load i8, i8* %284
%286 = add i8 %285, -15
%287 = icmp ult i8 %286, 2
%288 = select i1 %287, i32 1, i32 4
%289 = icmp sgt i32 %277, 0
br i1 %289, label %290, label %308
290: ; preds = %283
%291 = sitofp i32 %288 to double
%292 = zext i32 %277 to i64
br label %293
293: ; preds = %290, %304
%294 = phi i64 [ 0, %290 ], [ %306, %304 ]
%295 = getelementptr inbounds i32, i32* %53, i64 %294
%296 = load i32, i32* %295
%297 = icmp eq i32 %296, %288
%298 = getelementptr inbounds float, float* %55, i64 %294
br i1 %297, label %299, label %304
299: ; preds = %293
%300 = load float, float* %298
%301 = fpext float %300 to double
%302 = fdiv double %301, %291
%303 = fptrunc double %302 to float
br label %304
304: ; preds = %293, %299
%305 = phi float [ %303, %299 ], [ 0x444B1A3340000000, %293 ]
store float %305, float* %298
%306 = add nuw nsw i64 %294, 1
%307 = icmp eq i64 %306, %292
br i1 %307, label %308, label %293
308: ; preds = %304, %283
%309 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %187)
%310 = load i8*, i8** %3
%311 = call i32 @set_InitYYYYMMDDHH(i8* %310, i32 %187)
%312 = load i8*, i8** %3
%313 = call i32 @get_TimeRange(i8* %312, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12, i32* %13)
%314 = load i32, i32* %8
switch i32 %314, label %318 [
i32 3, label %315
i32 10, label %316
]
315: ; preds = %308
store i32 0, i32* %9
store i32 24, i32* %10
store i32 1, i32* %11
store i32 4, i32* %12
store i32 0, i32* %13
br label %333
316: ; preds = %308
store i32 113, i32* %8
%317 = load i32, i32* %10
store i32 %317, i32* %9
store i32 6, i32* %10
store i32 1, i32* %11
store i32 4, i32* %12
store i32 0, i32* %13
br label %333
318: ; preds = %308
%319 = icmp eq i32 %314, 2
%320 = load i32, i32* %9
%321 = icmp eq i32 %320, 0
%322 = select i1 %319, i1 %321, i1 false
%323 = load i32, i32* %10
%324 = icmp eq i32 %323, 6
%325 = select i1 %322, i1 %324, i1 false
%326 = load i32, i32* %11
%327 = icmp eq i32 %326, 1
%328 = select i1 %325, i1 %327, i1 false
br i1 %328, label %329, label %330
329: ; preds = %318
store i32 2, i32* %8
store i32 0, i32* %9
store i32 24, i32* %10
store i32 1, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %333
330: ; preds = %318
%331 = load i32, i32* @stderr
%332 = call i32 (i32, i8*, ...) @fprintf(i32 %331, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i32 %314, i32 %320, i32 %323, i32 %326)
br label %281
333: ; preds = %316, %329, %315
%334 = phi i32 [ 4, %316 ], [ 0, %329 ], [ 4, %315 ]
%335 = phi i32 [ 6, %316 ], [ 24, %329 ], [ 24, %315 ]
%336 = phi i32 [ %317, %316 ], [ 0, %329 ], [ 0, %315 ]
%337 = phi i32 [ 113, %316 ], [ 2, %329 ], [ 3, %315 ]
%338 = load i8*, i8** %3
%339 = call i32 @set_TimeRange(i8* %338, i32 %337, i32 %336, i32 %335, i32 1, i32 %334, i32 0)
%340 = load i8*, i8** %3
%341 = call i8* @mk_BMS(i8* %340, float* %55, i32* %7, double 0x444B1A2170AD88AA, double 9.999100e+20)
store i8* %341, i8** %5
%342 = load i8*, i8** %3
%343 = load i32, i32* %7
%344 = call i8* @mk_BDS(i8* %342, float* %55, i32 %343)
store i8* %344, i8** %6
%345 = load i8*, i8** %3
%346 = load i8*, i8** %4
%347 = load i8*, i8** %5
%348 = call i32 @wrt_grib_msg(i32* %44, i8* %345, i8* %346, i8* %347, i8* %344)
%349 = load i8*, i8** %6
%350 = call i32 @free(i8* %349)
%351 = load i8*, i8** %5
%352 = icmp eq i8* %351, null
br i1 %352, label %281, label %353
353: ; preds = %333
%354 = call i32 @free(i8* %351)
br label %281
355: ; preds = %67, %87, %99
%356 = call i32 @fclose(i32* %44)
%357 = call i32 @fclose(i32* %34)
ret i32 0
}