#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 wgrib2(int, char **);
int grb2_mk_inv(char *grb, char *inv) {
  char *argv[7];
  argv[0] = "wgrib2_C_api";
  argv[1] = grb;
  argv[2] = "-rewind_init";
  argv[3] = grb;
  argv[4] = "-inv";
  argv[5] = inv;
  argv[6] = "-Match_inv";
  return wgrib2(7, argv);
}


x86 assembly (clang, -O0):
<grb2_mk_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x50(%rbp),%rsi
mov    $0x7,%edi
call   1030 <wgrib2@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grb2_mk_inv>:
sub    $0x38,%rsp
lea    0xee5(%rip),%rax
mov    %rax,(%rsp)
mov    %rdi,0x8(%rsp)
lea    0xee2(%rip),%rax
mov    %rax,0x10(%rsp)
mov    %rdi,0x18(%rsp)
lea    0xede(%rip),%rax
mov    %rax,0x20(%rsp)
mov    %rsi,0x28(%rsp)
lea    0xed2(%rip),%rax
mov    %rax,0x30(%rsp)
mov    %rsp,%rsi
mov    $0x7,%edi
call   1030 <wgrib2@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"wgrib2_C_api\00"
@.str.1 = [13 x i8] c"-rewind_init\00"
@.str.2 = [5 x i8] c"-inv\00"
@.str.3 = [11 x i8] c"-Match_inv\00"
define i32 @grb2_mk_inv(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [7 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %3
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 1
store i8* %7, i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 3
store i8* %10, i8** %11
%12 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %12
%13 = load i8*, i8** %4
%14 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 5
store i8* %13, i8** %14
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 6
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 0
%17 = call i32 @wgrib2(i32 7, i8** %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [13 x i8] c"wgrib2_C_api\00"
@.str.1 = [13 x i8] c"-rewind_init\00"
@.str.2 = [5 x i8] c"-inv\00"
@.str.3 = [11 x i8] c"-Match_inv\00"
define i32 @grb2_mk_inv(i8* %0, i8* %1) {
%3 = alloca [7 x i8*]
%4 = bitcast [7 x i8*]* %3 to i8*
%5 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 1
store i8* %0, i8** %6
%7 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 3
store i8* %0, i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 5
store i8* %1, i8** %10
%11 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 6
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %11
%12 = call i32 @wgrib2(i32 7, i8** %5)
ret i32 %12
}