#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 */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
char *malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
size_t read(int, int **, int);
void cpu_meminfo_test(int fildes, size_t size) {
  size_t sz;
  uint64_t meminfo[6];
  char *buf;
  size_t i = 0;
  printf("==MEMINFO TEST==\n");
  lseek(fildes, 0x00ff000000000000, 0);
  sz = read(fildes, &meminfo, 6 * sizeof(uint64_t));
  if (sz < 0) {
    printf("Error Code: %d \n", (int)sz);
  }
  printf("Total RAM: \t %8lu MiB\n", meminfo[0] >> 10);
  printf("Free RAM: \t %8lu MiB\n", meminfo[1] >> 10);
  printf("Used RAM: \t %8lu MiB\n", meminfo[2] >> 10);
  printf("Total Swap: \t %8lu MiB\n", meminfo[3] >> 10);
  printf("Free Swap: \t %8lu MiB\n", meminfo[4] >> 10);
  printf("Used Swap: \t %8lu MiB\n", meminfo[5] >> 10);
  buf = malloc(size << 20);
  printf("\nAllocated %zd MiB. \n\n", size);
  if (NULL == buf) {
    printf("Couldn't allocate memory!");
    return;
  }
  for (i = 0; i < (size << 20); i += (1 << 12)) {
    buf[i] = 42;
  }
  lseek(fildes, 0x00ff000000000000, 0);
  sz = read(fildes, &meminfo, 6 * sizeof(uint64_t));
  if (sz < 0) {
    printf("Error Code: %d \n", (int)sz);
  }
  printf("Total RAM: \t %8lu MiB\n", meminfo[0] >> 10);
  printf("Free RAM: \t %8lu MiB\n", meminfo[1] >> 10);
  printf("Used RAM: \t %8lu MiB\n", meminfo[2] >> 10);
  printf("Total Swap: \t %8lu MiB\n", meminfo[3] >> 10);
  printf("Free Swap: \t %8lu MiB\n", meminfo[4] >> 10);
  printf("Used Swap: \t %8lu MiB\n", meminfo[5] >> 10);
  free(buf);
  printf("\nFreed %zd MiB. \n\n", size);
  lseek(fildes, 0x00ff000000000000, 0);
  sz = read(fildes, &meminfo, 6 * sizeof(uint64_t));
  if (sz < 0) {
    printf("Error Code: %d \n", (int)sz);
  }
  printf("Total RAM: \t %8lu MiB\n", meminfo[0] >> 10);
  printf("Free RAM: \t %8lu MiB\n", meminfo[1] >> 10);
  printf("Used RAM: \t %8lu MiB\n", meminfo[2] >> 10);
  printf("Total Swap: \t %8lu MiB\n", meminfo[3] >> 10);
  printf("Free Swap: \t %8lu MiB\n", meminfo[4] >> 10);
  printf("Used Swap: \t %8lu MiB\n", meminfo[5] >> 10);
}


x86 assembly (clang, -O0):
<cpu_meminfo_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x40(%rbp)
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <lseek@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1060 <read@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jae    11b5 <cpu_meminfo_test+0x65>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
sar    $0xa,%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
sar    $0xa,%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
sar    $0xa,%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
sar    $0xa,%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
sar    $0xa,%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
sar    $0xa,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
shl    $0x14,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
cmp    -0x38(%rbp),%rax
jne    126f <cpu_meminfo_test+0x11f>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1436 <cpu_meminfo_test+0x2e6>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x14,%rcx
cmp    %rcx,%rax
jae    12ab <cpu_meminfo_test+0x15b>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movb   $0x2a,(%rax,%rcx,1)
mov    -0x40(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x40(%rbp)
jmp    1277 <cpu_meminfo_test+0x127>
mov    -0x4(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <lseek@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1060 <read@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jae    12eb <cpu_meminfo_test+0x19b>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
sar    $0xa,%esi
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
sar    $0xa,%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
sar    $0xa,%esi
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
sar    $0xa,%esi
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
sar    $0xa,%esi
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
sar    $0xa,%esi
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rsi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <lseek@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1060 <read@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jae    13be <cpu_meminfo_test+0x26e>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
sar    $0xa,%esi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
sar    $0xa,%esi
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
sar    $0xa,%esi
lea    0xc5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
sar    $0xa,%esi
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
sar    $0xa,%esi
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
sar    $0xa,%esi
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_meminfo_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xf53(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <lseek@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x18,%edx
call   1070 <read@plt>
mov    (%rsp),%esi
sar    $0xa,%esi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
sar    $0xa,%esi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
sar    $0xa,%esi
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
sar    $0xa,%esi
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
sar    $0xa,%esi
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
sar    $0xa,%esi
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rbp
shl    $0x14,%rbp
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,%r15
lea    0xe5a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15,%r15
je     13f2 <cpu_meminfo_test+0x292>
test   %rbp,%rbp
je     12a0 <cpu_meminfo_test+0x140>
add    $0xffffffffffffffff,%rbp
shr    $0xc,%rbp
mov    %r15,%rax
add    $0x7000,%rax
add    $0x1,%rbp
nopl   0x0(%rax)
movb   $0x2a,-0x7000(%rax)
movb   $0x2a,-0x6000(%rax)
movb   $0x2a,-0x5000(%rax)
movb   $0x2a,-0x4000(%rax)
movb   $0x2a,-0x3000(%rax)
movb   $0x2a,-0x2000(%rax)
movb   $0x2a,-0x1000(%rax)
movb   $0x2a,(%rax)
add    $0x8000,%rax
add    $0xfffffffffffffff8,%rbp
jne    1260 <cpu_meminfo_test+0x100>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <lseek@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x18,%edx
call   1070 <read@plt>
mov    (%rsp),%esi
sar    $0xa,%esi
lea    0xd39(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
sar    $0xa,%esi
lea    0xd3b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
sar    $0xa,%esi
lea    0xd3c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
sar    $0xa,%esi
lea    0xd3d(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
sar    $0xa,%esi
lea    0xd3d(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
sar    $0xa,%esi
lea    0xd3c(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xd6b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <lseek@plt>
mov    %ebx,%edi
mov    %rsp,%rsi
mov    $0x18,%edx
call   1070 <read@plt>
mov    (%rsp),%esi
sar    $0xa,%esi
lea    0xc80(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
sar    $0xa,%esi
lea    0xc82(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
sar    $0xa,%esi
lea    0xc83(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
sar    $0xa,%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
sar    $0xa,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
sar    $0xa,%esi
mov    %r12,%rdi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
lea    0xca7(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"==MEMINFO TEST==\0A\00"
@.str.1 = [17 x i8] c"Error Code: %d \0A\00"
@.str.2 = [23 x i8] c"Total RAM: \09 %8lu MiB\0A\00"
@.str.3 = [22 x i8] c"Free RAM: \09 %8lu MiB\0A\00"
@.str.4 = [22 x i8] c"Used RAM: \09 %8lu MiB\0A\00"
@.str.5 = [24 x i8] c"Total Swap: \09 %8lu MiB\0A\00"
@.str.6 = [23 x i8] c"Free Swap: \09 %8lu MiB\0A\00"
@.str.7 = [23 x i8] c"Used Swap: \09 %8lu MiB\0A\00"
@.str.8 = [23 x i8] c"\0AAllocated %zd MiB. \0A\0A\00"
@.str.9 = [26 x i8] c"Couldn't allocate memory!\00"
@.str.10 = [19 x i8] c"\0AFreed %zd MiB. \0A\0A\00"
define void @cpu_meminfo_test(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca [6 x i32]
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
store i64 0, i64* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = call i32 @lseek(i32 %10, i32 0, i32 0)
%12 = load i32, i32* %3
%13 = bitcast [6 x i32]* %6 to i32**
%14 = call i64 @read(i32 %12, i32** %13, i32 24)
store i64 %14, i64* %5
%15 = load i64, i64* %5
%16 = icmp ult i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i64, i64* %5
%19 = trunc i64 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %2
%22 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%23 = load i32, i32* %22
%24 = ashr i32 %23, 10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
%27 = load i32, i32* %26
%28 = ashr i32 %27, 10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
%31 = load i32, i32* %30
%32 = ashr i32 %31, 10
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
%35 = load i32, i32* %34
%36 = ashr i32 %35, 10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
%39 = load i32, i32* %38
%40 = ashr i32 %39, 10
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
%43 = load i32, i32* %42
%44 = ashr i32 %43, 10
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %44)
%46 = load i64, i64* %4
%47 = shl i64 %46, 20
%48 = call i8* @malloc(i64 %47)
store i8* %48, i8** %7
%49 = load i64, i64* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i64 %49)
%51 = load i8*, i8** %7
%52 = icmp eq i8* null, %51
br i1 %52, label %53, label %55
53: ; preds = %21
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
br label %145
55: ; preds = %21
store i64 0, i64* %8
br label %56
56: ; preds = %65, %55
%57 = load i64, i64* %8
%58 = load i64, i64* %4
%59 = shl i64 %58, 20
%60 = icmp ult i64 %57, %59
br i1 %60, label %61, label %68
61: ; preds = %56
%62 = load i8*, i8** %7
%63 = load i64, i64* %8
%64 = getelementptr inbounds i8, i8* %62, i64 %63
store i8 42, i8* %64
br label %65
65: ; preds = %61
%66 = load i64, i64* %8
%67 = add i64 %66, 4096
store i64 %67, i64* %8
br label %56
68: ; preds = %56
%69 = load i32, i32* %3
%70 = call i32 @lseek(i32 %69, i32 0, i32 0)
%71 = load i32, i32* %3
%72 = bitcast [6 x i32]* %6 to i32**
%73 = call i64 @read(i32 %71, i32** %72, i32 24)
store i64 %73, i64* %5
%74 = load i64, i64* %5
%75 = icmp ult i64 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %68
%77 = load i64, i64* %5
%78 = trunc i64 %77 to i32
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %76, %68
%81 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%82 = load i32, i32* %81
%83 = ashr i32 %82, 10
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
%86 = load i32, i32* %85
%87 = ashr i32 %86, 10
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %87)
%89 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
%90 = load i32, i32* %89
%91 = ashr i32 %90, 10
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %91)
%93 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
%94 = load i32, i32* %93
%95 = ashr i32 %94, 10
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %95)
%97 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
%98 = load i32, i32* %97
%99 = ashr i32 %98, 10
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %99)
%101 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
%102 = load i32, i32* %101
%103 = ashr i32 %102, 10
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %103)
%105 = load i8*, i8** %7
%106 = call i32 @free(i8* %105)
%107 = load i64, i64* %4
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i64 %107)
%109 = load i32, i32* %3
%110 = call i32 @lseek(i32 %109, i32 0, i32 0)
%111 = load i32, i32* %3
%112 = bitcast [6 x i32]* %6 to i32**
%113 = call i64 @read(i32 %111, i32** %112, i32 24)
store i64 %113, i64* %5
%114 = load i64, i64* %5
%115 = icmp ult i64 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %80
%117 = load i64, i64* %5
%118 = trunc i64 %117 to i32
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %118)
br label %120
120: ; preds = %116, %80
%121 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%122 = load i32, i32* %121
%123 = ashr i32 %122, 10
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %123)
%125 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
%126 = load i32, i32* %125
%127 = ashr i32 %126, 10
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %127)
%129 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
%130 = load i32, i32* %129
%131 = ashr i32 %130, 10
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %131)
%133 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
%134 = load i32, i32* %133
%135 = ashr i32 %134, 10
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %135)
%137 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
%138 = load i32, i32* %137
%139 = ashr i32 %138, 10
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %139)
%141 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
%142 = load i32, i32* %141
%143 = ashr i32 %142, 10
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %143)
br label %145
145: ; preds = %120, %53
ret void
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"Total RAM: \09 %8lu MiB\0A\00"
@.str.3 = [22 x i8] c"Free RAM: \09 %8lu MiB\0A\00"
@.str.4 = [22 x i8] c"Used RAM: \09 %8lu MiB\0A\00"
@.str.5 = [24 x i8] c"Total Swap: \09 %8lu MiB\0A\00"
@.str.6 = [23 x i8] c"Free Swap: \09 %8lu MiB\0A\00"
@.str.7 = [23 x i8] c"Used Swap: \09 %8lu MiB\0A\00"
@.str.8 = [23 x i8] c"\0AAllocated %zd MiB. \0A\0A\00"
@.str.9 = [26 x i8] c"Couldn't allocate memory!\00"
@.str.10 = [19 x i8] c"\0AFreed %zd MiB. \0A\0A\00"
@str = [17 x i8] c"==MEMINFO TEST==\00"
define void @cpu_meminfo_test(i32 %0, i64 %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @lseek(i32 %0, i32 0, i32 0)
%7 = bitcast [6 x i32]* %3 to i32**
%8 = call i64 @read(i32 %0, i32** %7, i32 24)
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %9
%11 = ashr i32 %10, 10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%14 = load i32, i32* %13
%15 = ashr i32 %14, 10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%18 = load i32, i32* %17
%19 = ashr i32 %18, 10
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%22 = load i32, i32* %21
%23 = ashr i32 %22, 10
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
%26 = load i32, i32* %25
%27 = ashr i32 %26, 10
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 5
%30 = load i32, i32* %29
%31 = ashr i32 %30, 10
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = shl i64 %1, 20
%34 = tail call i8* @malloc(i64 %33)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i64 %1)
%36 = icmp eq i8* %34, null
br i1 %36, label %42, label %37
37: ; preds = %2
%38 = icmp eq i64 %33, 0
br i1 %38, label %66, label %39
39: ; preds = %37
%40 = add i64 %33, -1
%41 = lshr i64 %40, 12
br label %44
42: ; preds = %2
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
br label %109
44: ; preds = %44, %39
%45 = phi i64 [ 0, %39 ], [ %62, %44 ]
%46 = phi i64 [ 0, %39 ], [ %63, %44 ]
%47 = getelementptr inbounds i8, i8* %34, i64 %45
store i8 42, i8* %47
%48 = or i64 %45, 4096
%49 = getelementptr inbounds i8, i8* %34, i64 %48
store i8 42, i8* %49
%50 = or i64 %45, 8192
%51 = getelementptr inbounds i8, i8* %34, i64 %50
store i8 42, i8* %51
%52 = or i64 %45, 12288
%53 = getelementptr inbounds i8, i8* %34, i64 %52
store i8 42, i8* %53
%54 = or i64 %45, 16384
%55 = getelementptr inbounds i8, i8* %34, i64 %54
store i8 42, i8* %55
%56 = or i64 %45, 20480
%57 = getelementptr inbounds i8, i8* %34, i64 %56
store i8 42, i8* %57
%58 = or i64 %45, 24576
%59 = getelementptr inbounds i8, i8* %34, i64 %58
store i8 42, i8* %59
%60 = or i64 %45, 28672
%61 = getelementptr inbounds i8, i8* %34, i64 %60
store i8 42, i8* %61
%62 = add nuw i64 %45, 32768
%63 = add i64 %46, 8
%64 = or i64 %46, 7
%65 = icmp eq i64 %64, %41
br i1 %65, label %66, label %44
66: ; preds = %44, %37
%67 = tail call i32 @lseek(i32 %0, i32 0, i32 0)
%68 = call i64 @read(i32 %0, i32** %7, i32 24)
%69 = load i32, i32* %9
%70 = ashr i32 %69, 10
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %13
%73 = ashr i32 %72, 10
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %17
%76 = ashr i32 %75, 10
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %21
%79 = ashr i32 %78, 10
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %79)
%81 = load i32, i32* %25
%82 = ashr i32 %81, 10
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %82)
%84 = load i32, i32* %29
%85 = ashr i32 %84, 10
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %85)
%87 = tail call i32 @free(i8* %34)
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i64 %1)
%89 = tail call i32 @lseek(i32 %0, i32 0, i32 0)
%90 = call i64 @read(i32 %0, i32** %7, i32 24)
%91 = load i32, i32* %9
%92 = ashr i32 %91, 10
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %13
%95 = ashr i32 %94, 10
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %95)
%97 = load i32, i32* %17
%98 = ashr i32 %97, 10
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %98)
%100 = load i32, i32* %21
%101 = ashr i32 %100, 10
%102 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %101)
%103 = load i32, i32* %25
%104 = ashr i32 %103, 10
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %104)
%106 = load i32, i32* %29
%107 = ashr i32 %106, 10
%108 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %66, %42
ret void
}