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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int grb2_wrtVA(char *, char *, int, float *, int, char *, char *, char *,
               char *, char *, char *, char *, char *, char *, int, char *,
               long long, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  float data[1679];
  char *template;
  int i;
  for (i = 0; i < 1679; i++)
    data[i] = 10.0;
  data[0] = 0.0;
  template = "merc.g2";
  i = grb2_wrtVA("new.grb", template, 2, data, 1679, "lev", "201 mb",
                 "grib_type", "s", "ftime", "0-1 hour ave fcst", "var", "UFLX",
                 "bin_prec", 7, "date", 20880112010259LL, NULL);
  printf("writing new.grb err=%d\n", i);
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1ad8,%rsp
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x1a7c(%rbp)
cmpl   $0x68f,-0x1a7c(%rbp)
jge    1181 <main+0x61>
movslq -0x1a7c(%rbp),%rax
movss  0xe9c(%rip),%xmm0
movss  %xmm0,-0x1a70(%rbp,%rax,4)
ff ff
mov    -0x1a7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a7c(%rbp)
jmp    1145 <main+0x25>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1a70(%rbp)
ff
lea    0xe71(%rip),%rax
mov    %rax,-0x1a78(%rbp)
mov    -0x1a78(%rbp),%rsi
lea    -0x1a70(%rbp),%rcx
lea    0xe5d(%rip),%rdi
mov    $0x2,%edx
mov    $0x68f,%r8d
lea    0xe53(%rip),%r9
lea    0xe50(%rip),%rax
mov    %rax,-0x1a98(%rbp)
lea    0xe49(%rip),%rax
mov    %rax,-0x1a90(%rbp)
lea    0xe45(%rip),%r13
lea    0xe40(%rip),%r12
lea    0xe3f(%rip),%r15
lea    0xe4a(%rip),%r14
lea    0xe47(%rip),%rbx
lea    0xe45(%rip),%r11
lea    0xe47(%rip),%r10
movabs $0x12fd87a8c413,%rax
mov    %rax,-0x1a88(%rbp)
xor    %eax,%eax
mov    -0x1a98(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x1a90(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x1a88(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
movl   $0x7,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
movq   $0x0,0x58(%rsp)
call   1030 <grb2_wrtVA@plt>
mov    %eax,-0x1a7c(%rbp)
mov    -0x1a7c(%rbp),%esi
lea    0xdca(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1a7c(%rbp),%eax
add    $0x1ad8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a48,%rsp
mov    $0x3c,%eax
movaps 0xec3(%rip),%xmm0
nopl   (%rax)
movaps %xmm0,-0xf0(%rsp,%rax,4)
ff
movaps %xmm0,-0xe0(%rsp,%rax,4)
ff
cmp    $0x6bc,%rax
je     11b2 <main+0x92>
movaps %xmm0,-0xd0(%rsp,%rax,4)
ff
movaps %xmm0,-0xc0(%rsp,%rax,4)
ff
movaps %xmm0,-0xb0(%rsp,%rax,4)
ff
movaps %xmm0,-0xa0(%rsp,%rax,4)
ff
movaps %xmm0,-0x90(%rsp,%rax,4)
ff
movaps %xmm0,-0x80(%rsp,%rax,4)
movaps %xmm0,-0x70(%rsp,%rax,4)
movaps %xmm0,-0x60(%rsp,%rax,4)
movaps %xmm0,-0x50(%rsp,%rax,4)
movaps %xmm0,-0x40(%rsp,%rax,4)
movaps %xmm0,-0x30(%rsp,%rax,4)
movaps %xmm0,-0x20(%rsp,%rax,4)
movaps %xmm0,-0x10(%rsp,%rax,4)
movaps %xmm0,(%rsp,%rax,4)
add    $0x40,%rax
jmp    1140 <main+0x20>
movaps %xmm0,0x1a20(%rsp)
movabs $0x4120000041200000,%rax
mov    %rax,0x1a30(%rsp)
movl   $0x41200000,0x1a38(%rsp)
movl   $0x0,(%rsp)
movabs $0x12fd87a8c413,%rbx
lea    0xe72(%rip),%rax
lea    0xe62(%rip),%r13
lea    0xe56(%rip),%rbp
lea    0xe4b(%rip),%r10
lea    0xe32(%rip),%r12
lea    0xe25(%rip),%r15
lea    0xe1c(%rip),%r14
lea    0xe0b(%rip),%r11
lea    0xdf1(%rip),%rdi
lea    0xde2(%rip),%rsi
lea    0xdeb(%rip),%r9
mov    %rsp,%rcx
mov    $0x2,%edx
mov    $0x68f,%r8d
push   $0x0
push   %rbx
push   %rax
push   $0x7
push   %r13
push   %rbp
push   %r10
push   %r12
push   %r15
push   %r14
push   %r11
lea    0xdc7(%rip),%rax
push   %rax
call   1030 <grb2_wrtVA@plt>
add    $0x60,%rsp
mov    %eax,%ebx
lea    0xdf6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x1a48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"merc.g2\00"
@.str.1 = [8 x i8] c"new.grb\00"
@.str.2 = [4 x i8] c"lev\00"
@.str.3 = [7 x i8] c"201 mb\00"
@.str.4 = [10 x i8] c"grib_type\00"
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [6 x i8] c"ftime\00"
@.str.7 = [18 x i8] c"0-1 hour ave fcst\00"
@.str.8 = [4 x i8] c"var\00"
@.str.9 = [5 x i8] c"UFLX\00"
@.str.10 = [9 x i8] c"bin_prec\00"
@.str.11 = [5 x i8] c"date\00"
@.str.12 = [24 x i8] c"writing new.grb err=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1679 x float]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1679
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [1679 x float], [1679 x float]* %2, i64 0, i64 %10
store float 1.000000e+01, float* %11
br label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %5
15: ; preds = %5
%16 = getelementptr inbounds [1679 x float], [1679 x float]* %2, i64 0, i64 0
store float 0.000000e+00, float* %16
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [1679 x float], [1679 x float]* %2, i64 0, i64 0
%19 = call i32 @grb2_wrtVA(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 2, float* %18, i32 1679, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i64 20880112010259, i32* null)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@.str = [8 x i8] c"merc.g2\00"
@.str.1 = [8 x i8] c"new.grb\00"
@.str.2 = [4 x i8] c"lev\00"
@.str.3 = [7 x i8] c"201 mb\00"
@.str.4 = [10 x i8] c"grib_type\00"
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [6 x i8] c"ftime\00"
@.str.7 = [18 x i8] c"0-1 hour ave fcst\00"
@.str.8 = [4 x i8] c"var\00"
@.str.9 = [5 x i8] c"UFLX\00"
@.str.10 = [9 x i8] c"bin_prec\00"
@.str.11 = [5 x i8] c"date\00"
@.str.12 = [24 x i8] c"writing new.grb err=%d\0A\00"
define i32 @main() {
%1 = alloca [1679 x float]
%2 = bitcast [1679 x float]* %1 to i8*
br label %3
3: ; preds = %11, %0
%4 = phi i64 [ 0, %0 ], [ %46, %11 ]
%5 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %4
%6 = bitcast float* %5 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %6
%7 = getelementptr inbounds float, float* %5, i64 4
%8 = bitcast float* %7 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %8
%9 = or i64 %4, 8
%10 = icmp eq i64 %9, 1672
br i1 %10, label %47, label %11
11: ; preds = %3
%12 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %9
%13 = bitcast float* %12 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %13
%14 = getelementptr inbounds float, float* %12, i64 4
%15 = bitcast float* %14 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %15
%16 = or i64 %4, 16
%17 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %16
%18 = bitcast float* %17 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %18
%19 = getelementptr inbounds float, float* %17, i64 4
%20 = bitcast float* %19 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %20
%21 = or i64 %4, 24
%22 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %21
%23 = bitcast float* %22 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %23
%24 = getelementptr inbounds float, float* %22, i64 4
%25 = bitcast float* %24 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %25
%26 = or i64 %4, 32
%27 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %26
%28 = bitcast float* %27 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %28
%29 = getelementptr inbounds float, float* %27, i64 4
%30 = bitcast float* %29 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %30
%31 = or i64 %4, 40
%32 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %31
%33 = bitcast float* %32 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %33
%34 = getelementptr inbounds float, float* %32, i64 4
%35 = bitcast float* %34 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %35
%36 = or i64 %4, 48
%37 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %36
%38 = bitcast float* %37 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %38
%39 = getelementptr inbounds float, float* %37, i64 4
%40 = bitcast float* %39 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %40
%41 = or i64 %4, 56
%42 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 %41
%43 = bitcast float* %42 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %43
%44 = getelementptr inbounds float, float* %42, i64 4
%45 = bitcast float* %44 to <4 x float>*
store <4 x float> <float 1.000000e+01, float 1.000000e+01, float 1.000000e+01, float 1.000000e+01>, <4 x float>* %45
%46 = add nuw nsw i64 %4, 64
br label %3
47: ; preds = %3
%48 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1672
store float 1.000000e+01, float* %48
%49 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1673
store float 1.000000e+01, float* %49
%50 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1674
store float 1.000000e+01, float* %50
%51 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1675
store float 1.000000e+01, float* %51
%52 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1676
store float 1.000000e+01, float* %52
%53 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1677
store float 1.000000e+01, float* %53
%54 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 1678
store float 1.000000e+01, float* %54
%55 = getelementptr inbounds [1679 x float], [1679 x float]* %1, i64 0, i64 0
store float 0.000000e+00, float* %55
%56 = call i32 @grb2_wrtVA(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2, float* %55, i32 1679, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i64 20880112010259, i32* null)
%57 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i32 %56)
ret i32 %56
}