#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*/ fatal_error(char *, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fwrite(void *, int, unsigned long, int /*<<< orphan*/ *);
unsigned char *rd_grib2_msg_seq(int /*<<< orphan*/ *, long *, unsigned long *,
                                int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *in, *p[32];
  int i, n, done;
  unsigned char *grib2;
  long int pos;
  unsigned long int len;
  int num_submsgs, err;
  int last_wrt;
  if (argc < 4) {
    fprintf(stderr,
            "grib_split: input-grib2 (list of grib2 output files/pipes)\n");
    fprintf(stderr, " takes a grib2 file and splits in into N pieces\n");
    exit(8);
  }
  if ((in = fopen(argv[1], "rb")) == NULL) {
    fprintf(stderr, "bad arg: input grib file=%s\n", argv[1]);
    exit(8);
  }
  n = argc - 2;
  if (n > 32) {
    fprintf(stderr, "Too many output files (max=%d), change N and recompile\n",
            32);
    exit(8);
  }
  for (i = 0; i < n; i++) {
    p[i] = fopen(argv[i + 2], "wb");
    if (p[i] == NULL) {
      fprintf(stderr, "bad file: output file=%s\n", argv[i + 2]);
      exit(8);
    }
  }
  pos = i = 0;
  last_wrt = -1;
  while ((grib2 = rd_grib2_msg_seq(in, &pos, &len, &num_submsgs)) != NULL) {
    err = (int)fwrite((void *)grib2, 1, len, p[i]);
    if (err != len) {
      fatal_error("problem writing to file/pipe %s", argv[i + 2]);
    }
    if (last_wrt != -1)
      fflush(p[last_wrt]);
    last_wrt = i;
    i = (i == n - 1) ? 0 : i + 1;
    pos += len;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11cb <main+0x5b>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe93(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1216 <main+0xa6>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x128(%rbp)
cmpl   $0x20,-0x128(%rbp)
jle    1255 <main+0xe5>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
mov    $0x20,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    1307 <main+0x197>
mov    -0x10(%rbp),%rax
mov    -0x124(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe39(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rcx
movslq -0x124(%rbp),%rax
mov    %rcx,-0x120(%rbp,%rax,8)
ff
movslq -0x124(%rbp),%rax
cmpq   $0x0,-0x120(%rbp,%rax,8)
jne    12ee <main+0x17e>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x124(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
jmp    12f3 <main+0x183>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    125f <main+0xef>
movl   $0x0,-0x124(%rbp)
movq   $0x0,-0x140(%rbp)
movl   $0xffffffff,-0x154(%rbp)
ff ff ff
mov    -0x18(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0x148(%rbp),%rdx
lea    -0x14c(%rbp),%rcx
call   1030 <rd_grib2_msg_seq@plt>
mov    %rax,-0x138(%rbp)
cmp    $0x0,%rax
je     143c <main+0x2cc>
mov    -0x138(%rbp),%rdi
mov    -0x148(%rbp),%rdx
movslq -0x124(%rbp),%rax
mov    -0x120(%rbp,%rax,8),%rcx
ff
mov    $0x1,%esi
call   1090 <fwrite@plt>
mov    %eax,-0x150(%rbp)
movslq -0x150(%rbp),%rax
cmp    -0x148(%rbp),%rax
je     13b6 <main+0x246>
mov    -0x10(%rbp),%rax
mov    -0x124(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd31(%rip),%rdi
call   1050 <fatal_error@plt>
cmpl   $0xffffffff,-0x154(%rbp)
je     13d7 <main+0x267>
movslq -0x154(%rbp),%rax
mov    -0x120(%rbp,%rax,8),%rdi
ff
call   1060 <fflush@plt>
mov    -0x124(%rbp),%eax
mov    %eax,-0x154(%rbp)
mov    -0x124(%rbp),%eax
mov    -0x128(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1407 <main+0x297>
xor    %eax,%eax
mov    %eax,-0x158(%rbp)
jmp    1416 <main+0x2a6>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
mov    -0x158(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    -0x148(%rbp),%rax
add    -0x140(%rbp),%rax
mov    %rax,-0x140(%rbp)
jmp    1326 <main+0x1b6>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
cmp    $0x3,%edi
jg     11b7 <main+0x47>
mov    0x2e53(%rip),%rbx
mov    (%rbx),%edi
lea    0xe6a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe96(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
mov    %rsi,%r14
mov    %edi,%r13d
mov    0x8(%rsi),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11eb <main+0x7b>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xe8a(%rip),%rsi
jmp    1294 <main+0x124>
cmp    $0x22,%r13d
jbe    1217 <main+0xa7>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
mov    %rax,%r15
lea    -0x2(%r13),%ebp
xor    %ebx,%ebx
lea    0xe9e(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    0x10(%r14,%rbx,8),%rdi
mov    %r12,%rsi
call   1070 <fopen@plt>
mov    %rax,0x20(%rsp,%rbx,8)
test   %rax,%rax
je     127f <main+0x10f>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1230 <main+0xc0>
mov    %r13,%rbp
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x1c(%rsp),%rcx
mov    %r15,%rdi
call   1030 <rd_grib2_msg_seq@plt>
test   %rax,%rax
jne    12a5 <main+0x135>
xor    %edi,%edi
call   1080 <exit@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14,%rbx,8),%rdx
lea    0xe34(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
add    $0xfffffffd,%ebp
mov    $0xffffffff,%r13d
xor    %r12d,%r12d
jmp    1300 <main+0x190>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r12),%ebx
cmp    %ebp,%r12d
mov    $0x0,%eax
cmove  %eax,%ebx
mov    0x8(%rsp),%rax
add    %rax,0x10(%rsp)
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x1c(%rsp),%rcx
call   1030 <rd_grib2_msg_seq@plt>
mov    %r12d,%r13d
mov    %ebx,%r12d
test   %rax,%rax
je     1278 <main+0x108>
mov    0x8(%rsp),%rdx
movslq %r12d,%rbx
mov    0x20(%rsp,%rbx,8),%rcx
mov    %rax,%rdi
mov    $0x1,%esi
call   1090 <fwrite@plt>
cltq
cmp    0x8(%rsp),%rax
je     1334 <main+0x1c4>
mov    0x10(%r14,%rbx,8),%rsi
lea    0xdb3(%rip),%rdi
call   1050 <fatal_error@plt>
cmp    $0xffffffff,%r13d
je     12c0 <main+0x150>
movslq %r13d,%rax
mov    0x20(%rsp,%rax,8),%rdi
call   1060 <fflush@plt>
jmp    12c0 <main+0x150>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"grib_split: input-grib2 (list of grib2 output files/pipes)\0A\00"
@.str.1 = [49 x i8] c" takes a grib2 file and splits in into N pieces\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [29 x i8] c"bad arg: input grib file=%s\0A\00"
@.str.4 = [56 x i8] c"Too many output files (max=%d), change N and recompile\0A\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [26 x i8] c"bad file: output file=%s\0A\00"
@.str.7 = [32 x i8] c"problem writing to file/pipe %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [32 x i32*]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 4
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 8)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %6
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 8)
unreachable
38: ; preds = %25
%39 = load i32, i32* %4
%40 = sub nsw i32 %39, 2
store i32 %40, i32* %9
%41 = load i32, i32* %9
%42 = icmp sgt i32 %41, 32
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 32)
%46 = call i32 @exit(i32 8)
unreachable
47: ; preds = %38
store i32 0, i32* %8
br label %48
48: ; preds = %79, %47
%49 = load i32, i32* %8
%50 = load i32, i32* %9
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %82
52: ; preds = %48
%53 = load i8**, i8*** %5
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %53, i64 %56
%58 = load i8*, i8** %57
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [32 x i32*], [32 x i32*]* %7, i64 0, i64 %61
store i32* %59, i32** %62
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [32 x i32*], [32 x i32*]* %7, i64 0, i64 %64
%66 = load i32*, i32** %65
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %78
68: ; preds = %52
%69 = load i32, i32* @stderr
%70 = load i8**, i8*** %5
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %70, i64 %73
%75 = load i8*, i8** %74
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 8)
unreachable
78: ; preds = %52
br label %79
79: ; preds = %78
%80 = load i32, i32* %8
%81 = add nsw i32 %80, 1
store i32 %81, i32* %8
br label %48
82: ; preds = %48
store i32 0, i32* %8
store i64 0, i64* %12
store i32 -1, i32* %16
br label %83
83: ; preds = %127, %82
%84 = load i32*, i32** %6
%85 = call i8* @rd_grib2_msg_seq(i32* %84, i64* %12, i64* %13, i32* %14)
store i8* %85, i8** %11
%86 = icmp ne i8* %85, null
br i1 %86, label %87, label %132
87: ; preds = %83
%88 = load i8*, i8** %11
%89 = load i64, i64* %13
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [32 x i32*], [32 x i32*]* %7, i64 0, i64 %91
%93 = load i32*, i32** %92
%94 = call i64 @fwrite(i8* %88, i32 1, i64 %89, i32* %93)
%95 = trunc i64 %94 to i32
store i32 %95, i32* %15
%96 = load i32, i32* %15
%97 = sext i32 %96 to i64
%98 = load i64, i64* %13
%99 = icmp ne i64 %97, %98
br i1 %99, label %100, label %108
100: ; preds = %87
%101 = load i8**, i8*** %5
%102 = load i32, i32* %8
%103 = add nsw i32 %102, 2
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8*, i8** %101, i64 %104
%106 = load i8*, i8** %105
%107 = call i32 @fatal_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %106)
br label %108
108: ; preds = %100, %87
%109 = load i32, i32* %16
%110 = icmp ne i32 %109, -1
br i1 %110, label %111, label %117
111: ; preds = %108
%112 = load i32, i32* %16
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [32 x i32*], [32 x i32*]* %7, i64 0, i64 %113
%115 = load i32*, i32** %114
%116 = call i32 @fflush(i32* %115)
br label %117
117: ; preds = %111, %108
%118 = load i32, i32* %8
store i32 %118, i32* %16
%119 = load i32, i32* %8
%120 = load i32, i32* %9
%121 = sub nsw i32 %120, 1
%122 = icmp eq i32 %119, %121
br i1 %122, label %123, label %124
123: ; preds = %117
br label %127
124: ; preds = %117
%125 = load i32, i32* %8
%126 = add nsw i32 %125, 1
br label %127
127: ; preds = %124, %123
%128 = phi i32 [ 0, %123 ], [ %126, %124 ]
store i32 %128, i32* %8
%129 = load i64, i64* %13
%130 = load i64, i64* %12
%131 = add i64 %130, %129
store i64 %131, i64* %12
br label %83
132: ; preds = %83
%133 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"grib_split: input-grib2 (list of grib2 output files/pipes)\0A\00"
@.str.1 = [49 x i8] c" takes a grib2 file and splits in into N pieces\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [29 x i8] c"bad arg: input grib file=%s\0A\00"
@.str.4 = [56 x i8] c"Too many output files (max=%d), change N and recompile\0A\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [26 x i8] c"bad file: output file=%s\0A\00"
@.str.7 = [32 x i8] c"problem writing to file/pipe %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i32*]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = bitcast [32 x i32*]* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp slt i32 %0, 4
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @exit(i32 8)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %19
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = tail call i32 @exit(i32 8)
unreachable
28: ; preds = %18
%29 = icmp ugt i32 %0, 34
br i1 %29, label %33, label %30
30: ; preds = %28
%31 = add nsw i32 %0, -2
%32 = zext i32 %31 to i64
br label %44
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 32)
%36 = tail call i32 @exit(i32 8)
unreachable
37: ; preds = %44
%38 = icmp eq i64 %52, %32
br i1 %38, label %39, label %44
39: ; preds = %37
store i64 0, i64* %4
%40 = call i8* @rd_grib2_msg_seq(i32* %21, i64* %4, i64* %5, i32* %6)
%41 = icmp eq i8* %40, null
br i1 %41, label %95, label %42
42: ; preds = %39
%43 = add nsw i32 %0, -3
br label %60
44: ; preds = %30, %37
%45 = phi i64 [ 0, %30 ], [ %52, %37 ]
%46 = add nuw nsw i64 %45, 2
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
%49 = tail call i32* @fopen(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%50 = getelementptr inbounds [32 x i32*], [32 x i32*]* %3, i64 0, i64 %45
store i32* %49, i32** %50
%51 = icmp eq i32* %49, null
%52 = add nuw nsw i64 %45, 1
br i1 %51, label %53, label %37
53: ; preds = %44
%54 = and i64 %46, 4294967295
%55 = getelementptr inbounds i8*, i8** %1, i64 %54
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %55
%58 = tail call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %57)
%59 = tail call i32 @exit(i32 8)
unreachable
60: ; preds = %42, %86
%61 = phi i8* [ %40, %42 ], [ %93, %86 ]
%62 = phi i32 [ -1, %42 ], [ %63, %86 ]
%63 = phi i32 [ 0, %42 ], [ %89, %86 ]
%64 = load i64, i64* %5
%65 = sext i32 %63 to i64
%66 = getelementptr inbounds [32 x i32*], [32 x i32*]* %3, i64 0, i64 %65
%67 = load i32*, i32** %66
%68 = call i64 @fwrite(i8* %61, i32 1, i64 %64, i32* %67)
%69 = shl i64 %68, 32
%70 = ashr exact i64 %69, 32
%71 = load i64, i64* %5
%72 = icmp eq i64 %70, %71
br i1 %72, label %79, label %73
73: ; preds = %60
%74 = add nsw i32 %63, 2
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %1, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @fatal_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %77)
br label %79
79: ; preds = %73, %60
%80 = icmp eq i32 %62, -1
br i1 %80, label %86, label %81
81: ; preds = %79
%82 = sext i32 %62 to i64
%83 = getelementptr inbounds [32 x i32*], [32 x i32*]* %3, i64 0, i64 %82
%84 = load i32*, i32** %83
%85 = call i32 @fflush(i32* %84)
br label %86
86: ; preds = %81, %79
%87 = icmp eq i32 %63, %43
%88 = add nsw i32 %63, 1
%89 = select i1 %87, i32 0, i32 %88
%90 = load i64, i64* %5
%91 = load i64, i64* %4
%92 = add i64 %91, %90
store i64 %92, i64* %4
%93 = call i8* @rd_grib2_msg_seq(i32* %21, i64* %4, i64* %5, i32* %6)
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %60
95: ; preds = %86, %39
%96 = call i32 @exit(i32 0)
unreachable
}