#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 */
long long get_entry_fatal(char *, char const *);
long long available_guesstimate(const char *buf) {
  long long Cached = get_entry_fatal("Cached:", buf);
  long long MemFree = get_entry_fatal("MemFree:", buf);
  long long Buffers = get_entry_fatal("Buffers:", buf);
  long long Shmem = get_entry_fatal("Shmem:", buf);
  return MemFree + Cached + Buffers - Shmem;
}


x86 assembly (clang, -O0):
<available_guesstimate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <get_entry_fatal@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1030 <get_entry_fatal@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <get_entry_fatal@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <get_entry_fatal@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
sub    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<available_guesstimate>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xede(%rip),%rdi
mov    %r15,%rsi
call   1030 <get_entry_fatal@plt>
mov    %rax,%r14
lea    0xed4(%rip),%rdi
mov    %r15,%rsi
call   1030 <get_entry_fatal@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdi
mov    %r15,%rsi
call   1030 <get_entry_fatal@plt>
mov    %rax,%r12
lea    0xec2(%rip),%rdi
mov    %r15,%rsi
call   1030 <get_entry_fatal@plt>
add    %r14,%rbx
add    %r12,%rbx
sub    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Cached:\00"
@.str.1 = [9 x i8] c"MemFree:\00"
@.str.2 = [9 x i8] c"Buffers:\00"
@.str.3 = [7 x i8] c"Shmem:\00"
define i64 @available_guesstimate(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @get_entry_fatal(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %7)
store i64 %8, i64* %3
%9 = load i8*, i8** %2
%10 = call i64 @get_entry_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9)
store i64 %10, i64* %4
%11 = load i8*, i8** %2
%12 = call i64 @get_entry_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %11)
store i64 %12, i64* %5
%13 = load i8*, i8** %2
%14 = call i64 @get_entry_fatal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %13)
store i64 %14, i64* %6
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = add nsw i64 %15, %16
%18 = load i64, i64* %5
%19 = add nsw i64 %17, %18
%20 = load i64, i64* %6
%21 = sub nsw i64 %19, %20
ret i64 %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"Cached:\00"
@.str.1 = [9 x i8] c"MemFree:\00"
@.str.2 = [9 x i8] c"Buffers:\00"
@.str.3 = [7 x i8] c"Shmem:\00"
define i64 @available_guesstimate(i8* %0) {
%2 = tail call i64 @get_entry_fatal(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i64 @get_entry_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i64 @get_entry_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i64 @get_entry_fatal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%6 = add nsw i64 %3, %2
%7 = add nsw i64 %6, %4
%8 = sub i64 %7, %5
ret i64 %8
}