int mgeti4(hstring, mkey, keyword, ival) const char *hstring;
const char *mkey;
const char *keyword;
int *ival;
{
  char *mstring;
  mstring = malloc(2000);
  if (hgetm(hstring, mkey, 2000, mstring)) {
    if (igeti4(mstring, keyword, ival)) {
      free(mstring);
      return (1);
    } else {
      free(mstring);
      return (0);
    }
  } else {
    free(mstring);
    return (0);
  }
}


x86 assembly (clang, -O0):
<mgeti4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0x7d0,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rcx
mov    $0x7d0,%edx
mov    $0x0,%al
call   1040 <hgetm@plt>
cmp    $0x0,%eax
je     11cd <mgeti4+0x8d>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1050 <igeti4@plt>
cmp    $0x0,%eax
je     11b8 <mgeti4+0x78>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11dd <mgeti4+0x9d>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11dd <mgeti4+0x9d>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgeti4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
mov    $0x7d0,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x7d0,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <hgetm@plt>
test   %eax,%eax
je     1197 <mgeti4+0x57>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <igeti4@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mgeti4(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32* %3, i32** %9
%11 = call i8* @malloc(i64 2000)
store i8* %11, i8** %10
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %10
%15 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @hgetm to i32 (i8*, i8*, i32, i8*, ...)*)(i8* %12, i8* %13, i32 2000, i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %4
%18 = load i8*, i8** %10
%19 = load i8*, i8** %8
%20 = load i32*, i32** %9
%21 = call i32 (i8*, i8*, i32*, ...) bitcast (i32 (...)* @igeti4 to i32 (i8*, i8*, i32*, ...)*)(i8* %18, i8* %19, i32* %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = load i8*, i8** %10
store i32 1, i32* %5
br label %29
25: ; preds = %17
%26 = load i8*, i8** %10
store i32 0, i32* %5
br label %29
27: ; preds = %4
%28 = load i8*, i8** %10
store i32 0, i32* %5
br label %29
29: ; preds = %27, %25, %23
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @mgeti4(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = tail call dereferenceable_or_null(2000) i8* @malloc(i64 2000)
%6 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @hgetm to i32 (i8*, i8*, i32, i8*, ...)*)(i8* %0, i8* %1, i32 2000, i8* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = tail call i32 (i8*, i8*, i32*, ...) bitcast (i32 (...)* @igeti4 to i32 (i8*, i8*, i32*, ...)*)(i8* %5, i8* %2, i32* %3)
%10 = icmp ne i32 %9, 0
tail call void @free(i8* %5)
%11 = zext i1 %10 to i32
br label %13
12: ; preds = %4
tail call void @free(i8* %5)
br label %13
13: ; preds = %8, %12
%14 = phi i32 [ 0, %12 ], [ %11, %8 ]
ret i32 %14
}