#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 mallinfo {
  int arena;
  int ordblks;
  int smblks;
  int hblks;
  int hblkhd;
  int usmblks;
  int fsmblks;
  int uordblks;
  int fordblks;
  int keepcost;
};

/* Variables and functions */
struct mallinfo mallinfo();
int /*<<< orphan*/ printf(char *, int);
void display_mallinfo(void) {
  struct mallinfo mi;
  mi = mallinfo();
  printf("\nTotal non-mmapped bytes (arena):       %d\n", mi.arena);
  printf("# of free chunks (ordblks):            %d\n", mi.ordblks);
  printf("# of free fastbin blocks (smblks):     %d\n", mi.smblks);
  printf("# of mapped regions (hblks):           %d\n", mi.hblks);
  printf("Bytes in mapped regions (hblkhd):      %d\n", mi.hblkhd);
  printf("Max. total allocated space (usmblks):  %d\n", mi.usmblks);
  printf("Free bytes held in fastbins (fsmblks): %d\n", mi.fsmblks);
  printf("Total allocated space (uordblks):      %d\n", mi.uordblks);
  printf("Total free space (fordblks):           %d\n", mi.fordblks);
  printf("Topmost releasable block (keepcost):   %d\n", mi.keepcost);
}


x86 assembly (clang, -O0):
<display_mallinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1040 <mallinfo@plt>
lea    -0x28(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    -0x28(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xf2e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xf4a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xf66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xf9e(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_mallinfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1040 <mallinfo@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%r14d
mov    0x18(%rsp),%r15d
mov    0x1c(%rsp),%r12d
mov    0x20(%rsp),%ebp
mov    0x24(%rsp),%ebx
mov    0x28(%rsp),%r13d
mov    0x2c(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    0x30(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
mov    0x4(%rsp),%esi
call   1030 <printf@plt>
lea    0xf6c(%rip),%rdi
mov    0x8(%rsp),%esi
call   1030 <printf@plt>
lea    0xf87(%rip),%rdi
mov    0xc(%rsp),%esi
call   1030 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mallinfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [44 x i8] c"\0ATotal non-mmapped bytes (arena): %d\0A\00"
@.str.1 = [43 x i8] c"# of free chunks (ordblks): %d\0A\00"
@.str.2 = [43 x i8] c"# of free fastbin blocks (smblks): %d\0A\00"
@.str.3 = [43 x i8] c"# of mapped regions (hblks): %d\0A\00"
@.str.4 = [43 x i8] c"Bytes in mapped regions (hblkhd): %d\0A\00"
@.str.5 = [43 x i8] c"Max. total allocated space (usmblks): %d\0A\00"
@.str.6 = [43 x i8] c"Free bytes held in fastbins (fsmblks): %d\0A\00"
@.str.7 = [43 x i8] c"Total allocated space (uordblks): %d\0A\00"
@.str.8 = [43 x i8] c"Total free space (fordblks): %d\0A\00"
@.str.9 = [43 x i8] c"Topmost releasable block (keepcost): %d\0A\00"
define void @display_mallinfo() {
%1 = alloca %struct.mallinfo
%2 = alloca %struct.mallinfo
%3 = bitcast %struct.mallinfo* %1 to i8*
%4 = bitcast %struct.mallinfo* %2 to i8*
%5 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 2
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 3
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 6
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 7
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 8
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 9
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %33)
ret void
}

LLVM IR (-O2):
%struct.mallinfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [44 x i8] c"\0ATotal non-mmapped bytes (arena): %d\0A\00"
@.str.1 = [43 x i8] c"# of free chunks (ordblks): %d\0A\00"
@.str.2 = [43 x i8] c"# of free fastbin blocks (smblks): %d\0A\00"
@.str.3 = [43 x i8] c"# of mapped regions (hblks): %d\0A\00"
@.str.4 = [43 x i8] c"Bytes in mapped regions (hblkhd): %d\0A\00"
@.str.5 = [43 x i8] c"Max. total allocated space (usmblks): %d\0A\00"
@.str.6 = [43 x i8] c"Free bytes held in fastbins (fsmblks): %d\0A\00"
@.str.7 = [43 x i8] c"Total allocated space (uordblks): %d\0A\00"
@.str.8 = [43 x i8] c"Total free space (fordblks): %d\0A\00"
@.str.9 = [43 x i8] c"Topmost releasable block (keepcost): %d\0A\00"
define void @display_mallinfo() {
%1 = alloca %struct.mallinfo
%2 = bitcast %struct.mallinfo* %1 to i8*
%3 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 6
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 7
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 8
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 9
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %4)
%24 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%25 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%26 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%27 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%28 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%29 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %16)
%30 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %20)
%32 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %22)
ret void
}