#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*/ con1x1(float *, float *);
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 char *mk_BDS(unsigned char *, float *, int);
unsigned char *rd_GDS(int /*<<< orphan*/ *, char *, int);
long rd_grib_msg(int /*<<< orphan*/ *, long, unsigned char **, unsigned char **,
                 unsigned char **, unsigned char **);
int /*<<< orphan*/ set_PDSGridType(unsigned char *, int);
int /*<<< orphan*/ stderr;
int 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, *gds2;
  FILE *input, *output;
  int count, cnvt, i, nxny;
  float array[100000];
  float array25[144 * 73];
  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);
  }
  gds2 = rd_GDS(NULL, "gds.2", 2);
  pos = count = cnvt = 0;
  for (;;) {
    len_grib = rd_grib_msg(input, pos, &pds, &gds, &bms, &bds);
    if (len_grib <= 0)
      break;
    if ((pds[6]) == 3 && ((pds[7] & 64) != 0) == 0) {
      nxny = unpk_bds(array, pds, gds, bms, bds, 100000);
      con1x1(array, array25);
      set_PDSGridType(pds, 2);
      bds = mk_BDS(pds, array25, 144 * 73);
      wrt_grib_msg(output, pds, gds2, bms, bds);
      cnvt++;
      free(bds);
    } else {
      wrt_grib_msg(output, pds, gds, bms, bds);
    }
    pos += len_grib;
    count++;
  }
  fclose(output);
  fclose(input);
  fprintf(stderr, "converted %d records out of %d to 144x73\n", cnvt, count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6bf30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1213 <main+0x53>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x8,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdff(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    125e <main+0x9e>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdd7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x7,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdd0(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
jne    12a9 <main+0xe9>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x7,%edi
call   10d0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd8c(%rip),%rsi
mov    $0x2,%edx
call   1040 <rd_GDS@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x5c(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x40(%rbp),%r9
call   10a0 <rd_grib_msg@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jg     1309 <main+0x149>
jmp    13fb <main+0x23b>
mov    -0x28(%rbp),%rax
movzbl 0x6(%rax),%eax
cmp    $0x3,%eax
jne    13c8 <main+0x208>
mov    -0x28(%rbp),%rax
movzbl 0x7(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    13c8 <main+0x208>
lea    -0x61af0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    $0x186a0,%r9d
call   1060 <unpk_bds@plt>
mov    %eax,-0x68(%rbp)
lea    -0x61af0(%rbp),%rdi
lea    -0x6bf30(%rbp),%rsi
call   10c0 <con1x1@plt>
mov    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   10e0 <set_PDSGridType@plt>
mov    -0x28(%rbp),%rdi
lea    -0x6bf30(%rbp),%rsi
mov    $0x2910,%edx
call   1090 <mk_BDS@plt>
mov    %rax,-0x40(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   1070 <wrt_grib_msg@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
jmp    13e1 <main+0x221>
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   1070 <wrt_grib_msg@plt>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12d8 <main+0x118>
mov    -0x58(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2bcc(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
mov    -0x5c(%rbp),%ecx
lea    0xc23(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0x6bf30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6bf08,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    13bb <main+0x1fb>
mov    0x8(%rbx),%rdi
lea    0xe39(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13df <main+0x21f>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe39(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13ee <main+0x22e>
mov    %rax,%r13
lea    0xe24(%rip),%rsi
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %edi,%edi
mov    $0x2,%edx
call   1040 <rd_GDS@plt>
mov    %rax,0x38(%rsp)
lea    0x10(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <rd_grib_msg@plt>
mov    $0x0,%ebp
test   %rax,%rax
jle    1379 <main+0x1b9>
mov    %rax,%r12
xor    %ebx,%ebx
lea    0x10(%rsp),%r15
xor    %ebp,%ebp
xor    %eax,%eax
mov    %rax,0x18(%rsp)
mov    %r13,0x30(%rsp)
jmp    12c6 <main+0x106>
nopw   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    %r13,%rdi
call   1070 <wrt_grib_msg@plt>
add    %r12,%rbx
add    $0x1,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
lea    0x28(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x8(%rsp),%r9
call   10a0 <rd_grib_msg@plt>
mov    %rax,%r12
test   %rax,%rax
jle    1379 <main+0x1b9>
mov    0x10(%rsp),%rsi
cmpb   $0x3,0x6(%rsi)
jne    1280 <main+0xc0>
testb  $0x40,0x7(%rsi)
jne    1280 <main+0xc0>
mov    0x28(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    %r14,%r13
mov    %r15,%r14
lea    0xa480(%rsp),%r15
mov    %r15,%rdi
mov    $0x186a0,%r9d
call   1060 <unpk_bds@plt>
mov    %r15,%rdi
lea    0x40(%rsp),%r15
mov    %r15,%rsi
call   10c0 <con1x1@plt>
mov    0x10(%rsp),%rdi
mov    $0x2,%esi
call   10e0 <set_PDSGridType@plt>
mov    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %r14,%r15
mov    %r13,%r14
mov    0x30(%rsp),%r13
mov    $0x2910,%edx
call   1090 <mk_BDS@plt>
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rsi
mov    0x20(%rsp),%rcx
mov    %r13,%rdi
mov    0x38(%rsp),%rdx
mov    %rax,%r8
call   1070 <wrt_grib_msg@plt>
mov    0x18(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
jmp    1297 <main+0xd7>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
lea    0xcad(%rip),%rsi
mov    0x18(%rsp),%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0x6bf08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc32(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x8,%edi
call   10d0 <exit@plt>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
jmp    13fb <main+0x23b>
mov    0x2beb(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xc22(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x7,%edi
call   10d0 <exit@plt>

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 = [6 x i8] c"gds.2\00"
@.str.5 = [42 x i8] c"converted %d records out of %d to 144x73\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 i8*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [100000 x float]
%20 = alloca [10512 x float]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 3
br i1 %22, label %23, label %30
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 8)
unreachable
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %34, i32** %13
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %43
36: ; preds = %30
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 7)
unreachable
43: ; preds = %30
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %47, i32** %14
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %56
49: ; preds = %43
%50 = load i32, i32* @stderr
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %53)
%55 = call i32 @exit(i32 7)
unreachable
56: ; preds = %43
%57 = call i8* @rd_GDS(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 2)
store i8* %57, i8** %12
store i32 0, i32* %16
store i32 0, i32* %15
store i64 0, i64* %7
br label %58
58: ; preds = %112, %56
%59 = load i32*, i32** %13
%60 = load i64, i64* %7
%61 = call i64 @rd_grib_msg(i32* %59, i64 %60, i8** %8, i8** %9, i8** %10, i8** %11)
store i64 %61, i64* %6
%62 = load i64, i64* %6
%63 = icmp sle i64 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %58
br label %118
65: ; preds = %58
%66 = load i8*, i8** %8
%67 = getelementptr inbounds i8, i8* %66, i64 6
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = icmp eq i32 %69, 3
br i1 %70, label %71, label %105
71: ; preds = %65
%72 = load i8*, i8** %8
%73 = getelementptr inbounds i8, i8* %72, i64 7
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = and i32 %75, 64
%77 = icmp ne i32 %76, 0
%78 = zext i1 %77 to i32
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %105
80: ; preds = %71
%81 = getelementptr inbounds [100000 x float], [100000 x float]* %19, i64 0, i64 0
%82 = load i8*, i8** %8
%83 = load i8*, i8** %9
%84 = load i8*, i8** %10
%85 = load i8*, i8** %11
%86 = call i32 @unpk_bds(float* %81, i8* %82, i8* %83, i8* %84, i8* %85, i32 100000)
store i32 %86, i32* %18
%87 = getelementptr inbounds [100000 x float], [100000 x float]* %19, i64 0, i64 0
%88 = getelementptr inbounds [10512 x float], [10512 x float]* %20, i64 0, i64 0
%89 = call i32 @con1x1(float* %87, float* %88)
%90 = load i8*, i8** %8
%91 = call i32 @set_PDSGridType(i8* %90, i32 2)
%92 = load i8*, i8** %8
%93 = getelementptr inbounds [10512 x float], [10512 x float]* %20, i64 0, i64 0
%94 = call i8* @mk_BDS(i8* %92, float* %93, i32 10512)
store i8* %94, i8** %11
%95 = load i32*, i32** %14
%96 = load i8*, i8** %8
%97 = load i8*, i8** %12
%98 = load i8*, i8** %10
%99 = load i8*, i8** %11
%100 = call i32 @wrt_grib_msg(i32* %95, i8* %96, i8* %97, i8* %98, i8* %99)
%101 = load i32, i32* %16
%102 = add nsw i32 %101, 1
store i32 %102, i32* %16
%103 = load i8*, i8** %11
%104 = call i32 @free(i8* %103)
br label %112
105: ; preds = %71, %65
%106 = load i32*, i32** %14
%107 = load i8*, i8** %8
%108 = load i8*, i8** %9
%109 = load i8*, i8** %10
%110 = load i8*, i8** %11
%111 = call i32 @wrt_grib_msg(i32* %106, i8* %107, i8* %108, i8* %109, i8* %110)
br label %112
112: ; preds = %105, %80
%113 = load i64, i64* %6
%114 = load i64, i64* %7
%115 = add nsw i64 %114, %113
store i64 %115, i64* %7
%116 = load i32, i32* %15
%117 = add nsw i32 %116, 1
store i32 %117, i32* %15
br label %58
118: ; preds = %64
%119 = load i32*, i32** %14
%120 = call i32 @fclose(i32* %119)
%121 = load i32*, i32** %13
%122 = call i32 @fclose(i32* %121)
%123 = load i32, i32* @stderr
%124 = load i32, i32* %16
%125 = load i32, i32* %15
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %124, i32 %125)
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 = [6 x i8] c"gds.2\00"
@.str.5 = [42 x i8] c"converted %d records out of %d to 144x73\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [100000 x float]
%8 = alloca [10512 x float]
%9 = bitcast i8** %3 to i8*
%10 = bitcast i8** %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = bitcast i8** %6 to i8*
%13 = bitcast [100000 x float]* %7 to i8*
%14 = bitcast [10512 x float]* %8 to i8*
%15 = icmp eq i32 %0, 3
br i1 %15, label %21, label %16
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = tail call i32 @exit(i32 8)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %22
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = tail call i32 @exit(i32 7)
unreachable
31: ; preds = %21
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = tail call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, 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 = tail call i8* @rd_GDS(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 2)
%43 = call i64 @rd_grib_msg(i32* %24, i64 0, i8** %3, i8** %4, i8** %5, i8** %6)
%44 = icmp slt i64 %43, 1
br i1 %44, label %89, label %45
45: ; preds = %41
%46 = getelementptr inbounds [100000 x float], [100000 x float]* %7, i64 0, i64 0
%47 = getelementptr inbounds [10512 x float], [10512 x float]* %8, i64 0, i64 0
br label %48
48: ; preds = %45, %83
%49 = phi i64 [ %43, %45 ], [ %87, %83 ]
%50 = phi i64 [ 0, %45 ], [ %85, %83 ]
%51 = phi i32 [ 0, %45 ], [ %86, %83 ]
%52 = phi i32 [ 0, %45 ], [ %84, %83 ]
%53 = load i8*, i8** %3
%54 = getelementptr inbounds i8, i8* %53, i64 6
%55 = load i8, i8* %54
%56 = icmp eq i8 %55, 3
br i1 %56, label %57, label %78
57: ; preds = %48
%58 = getelementptr inbounds i8, i8* %53, i64 7
%59 = load i8, i8* %58
%60 = and i8 %59, 64
%61 = icmp eq i8 %60, 0
br i1 %61, label %62, label %78
62: ; preds = %57
%63 = load i8*, i8** %4
%64 = load i8*, i8** %5
%65 = load i8*, i8** %6
%66 = call i32 @unpk_bds(float* %46, i8* %53, i8* %63, i8* %64, i8* %65, i32 100000)
%67 = call i32 @con1x1(float* %46, float* %47)
%68 = load i8*, i8** %3
%69 = call i32 @set_PDSGridType(i8* %68, i32 2)
%70 = load i8*, i8** %3
%71 = call i8* @mk_BDS(i8* %70, float* %47, i32 10512)
store i8* %71, i8** %6
%72 = load i8*, i8** %3
%73 = load i8*, i8** %5
%74 = call i32 @wrt_grib_msg(i32* %34, i8* %72, i8* %42, i8* %73, i8* %71)
%75 = add nsw i32 %52, 1
%76 = load i8*, i8** %6
%77 = call i32 @free(i8* %76)
br label %83
78: ; preds = %57, %48
%79 = load i8*, i8** %4
%80 = load i8*, i8** %5
%81 = load i8*, i8** %6
%82 = call i32 @wrt_grib_msg(i32* %34, i8* %53, i8* %79, i8* %80, i8* %81)
br label %83
83: ; preds = %78, %62
%84 = phi i32 [ %75, %62 ], [ %52, %78 ]
%85 = add nsw i64 %49, %50
%86 = add nuw nsw i32 %51, 1
%87 = call i64 @rd_grib_msg(i32* %24, i64 %85, i8** %3, i8** %4, i8** %5, i8** %6)
%88 = icmp slt i64 %87, 1
br i1 %88, label %89, label %48
89: ; preds = %83, %41
%90 = phi i32 [ 0, %41 ], [ %84, %83 ]
%91 = phi i32 [ 0, %41 ], [ %86, %83 ]
%92 = call i32 @fclose(i32* %34)
%93 = call i32 @fclose(i32* %24)
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %90, i32 %91)
ret i32 0
}