#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 */
struct sysinfo {
  scalar_t__ *loads;
  scalar_t__ uptime;
  int /*<<< orphan*/ mem_unit;
  scalar_t__ freehigh;
  scalar_t__ totalhigh;
  scalar_t__ procs;
  scalar_t__ freeswap;
  scalar_t__ totalswap;
  scalar_t__ bufferram;
  scalar_t__ sharedram;
  scalar_t__ freeram;
  scalar_t__ totalram;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long, unsigned long long,
                          unsigned long long, unsigned long long,
                          unsigned long long, unsigned long long,
                          unsigned long long, unsigned long long,
                          unsigned long long, unsigned long long, unsigned int,
                          unsigned long long, unsigned long long,
                          int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int sysinfo(struct sysinfo *);
int main(void) {
  struct sysinfo si;
  if (sysinfo(&si) == -1)
    return 77;
  printf("sysinfo({uptime=%llu"
         ", loads=[%llu, %llu, %llu]"
         ", totalram=%llu"
         ", freeram=%llu"
         ", sharedram=%llu"
         ", bufferram=%llu"
         ", totalswap=%llu"
         ", freeswap=%llu"
         ", procs=%u"
         ", totalhigh=%llu"
         ", freehigh=%llu"
         ", mem_unit=%u"
         "}) = 0\n",
         (unsigned long long)si.uptime, (unsigned long long)si.loads[0],
         (unsigned long long)si.loads[1], (unsigned long long)si.loads[2],
         (unsigned long long)si.totalram, (unsigned long long)si.freeram,
         (unsigned long long)si.sharedram, (unsigned long long)si.bufferram,
         (unsigned long long)si.totalswap, (unsigned long long)si.freeswap,
         (unsigned)si.procs, (unsigned long long)si.totalhigh,
         (unsigned long long)si.freehigh, si.mem_unit);
  puts("+++ exited with 0 +++");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,-0x2c(%rbp)
lea    -0x90(%rbp),%rdi
call   1050 <sysinfo@plt>
cmp    $0xffffffff,%eax
jne    116c <main+0x3c>
movl   $0x4d,-0x2c(%rbp)
jmp    1211 <main+0xe1>
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rax
mov    (%rax),%rdx
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x90(%rbp),%rax
mov    0x10(%rax),%r8
mov    -0x38(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%r13
mov    -0x50(%rbp),%r12
mov    -0x58(%rbp),%r15
mov    -0x60(%rbp),%r14
mov    -0x68(%rbp),%rdi
mov    %edi,%ebx
mov    -0x70(%rbp),%r11
mov    -0x78(%rbp),%r10
mov    -0x80(%rbp),%edi
mov    %edi,-0x94(%rbp)
lea    0xe37(%rip),%rdi
mov    %rax,(%rsp)
mov    -0x94(%rbp),%eax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %ebx,0x28(%rsp)
mov    %r11,0x30(%rsp)
mov    %r10,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0x8(%rsp),%rdi
call   1050 <sysinfo@plt>
cmp    $0xffffffff,%eax
je     11b5 <main+0x85>
mov    0x8(%rsp),%rax
mov    0x10(%rsp),%rsi
mov    (%rax),%rdx
mov    0x8(%rax),%rcx
mov    0x10(%rax),%r8
mov    0x60(%rsp),%r9
mov    0x30(%rsp),%r10d
mov    0x18(%rsp),%eax
sub    $0x8,%rsp
lea    0xe8f(%rip),%rdi
push   %rax
push   0x30(%rsp)
push   0x40(%rsp)
push   %r10
push   0x60(%rsp)
push   0x70(%rsp)
push   0x80(%rsp)
push   0x90(%rsp)
push   0xa0(%rsp)
call   1040 <printf@plt>
add    $0x50,%rsp
lea    0xf1f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret
mov    $0x4d,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64*, i64, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [200 x i8] c"sysinfo({uptime=%llu, loads=[%llu, %llu, %llu], totalram=%llu, freeram=%llu, sharedram=%llu, bufferram=%llu, totalswap=%llu, freeswap=%llu, procs=%u, totalhigh=%llu, freehigh=%llu, mem_unit=%u}) = 0\0A\00"
@.str.1 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sysinfo
store i32 0, i32* %1
%3 = call i32 @sysinfo(%struct.sysinfo* %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 77, i32* %1
br label %44
6: ; preds = %0
%7 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 1
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%10 = load i64*, i64** %9
%11 = getelementptr inbounds i64, i64* %10, i64 0
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%14 = load i64*, i64** %13
%15 = getelementptr inbounds i64, i64* %14, i64 1
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%18 = load i64*, i64** %17
%19 = getelementptr inbounds i64, i64* %18, i64 2
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 11
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 10
%24 = load i64, i64* %23
%25 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 9
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 8
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 7
%30 = load i64, i64* %29
%31 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 6
%32 = load i64, i64* %31
%33 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 5
%34 = load i64, i64* %33
%35 = trunc i64 %34 to i32
%36 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 4
%37 = load i64, i64* %36
%38 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 3
%39 = load i64, i64* %38
%40 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 2
%41 = load i32, i32* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %12, i64 %16, i64 %20, i64 %22, i64 %24, i64 %26, i64 %28, i64 %30, i64 %32, i32 %35, i64 %37, i64 %39, i32 %41)
%43 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %44
44: ; preds = %6, %5
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
%struct.sysinfo = type { i64*, i64, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [200 x i8] c"sysinfo({uptime=%llu, loads=[%llu, %llu, %llu], totalram=%llu, freeram=%llu, sharedram=%llu, bufferram=%llu, totalswap=%llu, freeswap=%llu, procs=%u, totalhigh=%llu, freehigh=%llu, mem_unit=%u}) = 0\0A\00"
@.str.1 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %38, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%9 = load i64*, i64** %8
%10 = load i64, i64* %9
%11 = getelementptr inbounds i64, i64* %9, i64 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds i64, i64* %9, i64 2
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 11
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 10
%18 = load i64, i64* %17
%19 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 9
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 8
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 7
%24 = load i64, i64* %23
%25 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 6
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 5
%28 = load i64, i64* %27
%29 = trunc i64 %28 to i32
%30 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 4
%31 = load i64, i64* %30
%32 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 3
%33 = load i64, i64* %32
%34 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 2
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str, i64 0, i64 0), i64 %7, i64 %10, i64 %12, i64 %14, i64 %16, i64 %18, i64 %20, i64 %22, i64 %24, i64 %26, i32 %29, i64 %31, i64 %33, i32 %35)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %0, %5
%39 = phi i32 [ 0, %5 ], [ 77, %0 ]
ret i32 %39
}