#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*/ my_init();
int /*<<< orphan*/ my_restore();
int /*<<< orphan*/ printf(char *, ...);
void show_mallinfo() {
  my_restore();
  struct mallinfo mi = mallinfo();
  printf("-----------------------------------------------------\n");
  printf("/* non-mmapped space allocated from system */, arena: %d\n",
         mi.arena);
  printf("/* number of free chunks */, ordblks: %d\n", mi.ordblks);
  printf("/* number of fastbin blocks */, smblks: %d\n", mi.smblks);
  printf("/* number of mmapped regions */, hblks: %d\n", mi.hblks);
  printf("/* space in mmapped regions */, hblks: %d\n", mi.hblkhd);
  printf("/* maximum total allocated space */, usmblks: %d\n", mi.usmblks);
  printf("/* space available in freed fastbin blocks */, fsmblks: %d\n",
         mi.fsmblks);
  printf("/* total allocated space */, uordblks: %d\n", mi.uordblks);
  printf("/* total free space */, fordblks: %d\n", mi.fordblks);
  printf("/* top-most, releasable (via malloc_trim) space */, keepcost: %d\n",
         mi.keepcost);
  printf("-----------------------------------------------------\n");
  my_init();
}


x86 assembly (clang, -O0):
<show_mallinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1040 <my_restore@plt>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1060 <mallinfo@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xf22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xf57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xf78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xfa3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xfbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xfd2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <my_init@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_mallinfo>:
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   1050 <my_restore@plt>
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1070 <mallinfo@plt>
lea    0x1079(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%esi
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xef2(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xf0b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xf2b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xf55(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xf6e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xf82(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <my_init@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.mallinfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [55 x i8] c"-----------------------------------------------------\0A\00"
@.str.1 = [58 x i8] c"/* non-mmapped space allocated from system */, arena: %d\0A\00"
@.str.2 = [42 x i8] c"/* number of free chunks */, ordblks: %d\0A\00"
@.str.3 = [44 x i8] c"/* number of fastbin blocks */, smblks: %d\0A\00"
@.str.4 = [44 x i8] c"/* number of mmapped regions */, hblks: %d\0A\00"
@.str.5 = [43 x i8] c"/* space in mmapped regions */, hblks: %d\0A\00"
@.str.6 = [50 x i8] c"/* maximum total allocated space */, usmblks: %d\0A\00"
@.str.7 = [60 x i8] c"/* space available in freed fastbin blocks */, fsmblks: %d\0A\00"
@.str.8 = [43 x i8] c"/* total allocated space */, uordblks: %d\0A\00"
@.str.9 = [38 x i8] c"/* total free space */, fordblks: %d\0A\00"
@.str.10 = [66 x i8] c"/* top-most, releasable (via malloc_trim) space */, keepcost: %d\0A\00"
define void @show_mallinfo() {
%1 = alloca %struct.mallinfo
%2 = call i32 (...) @my_restore()
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 1
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 2
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 3
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 4
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 5
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 6
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 7
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 8
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 9
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.10, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%35 = call i32 (...) @my_init()
ret void
}

LLVM IR (-O2):
%struct.mallinfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str.1 = [58 x i8] c"/* non-mmapped space allocated from system */, arena: %d\0A\00"
@.str.2 = [42 x i8] c"/* number of free chunks */, ordblks: %d\0A\00"
@.str.3 = [44 x i8] c"/* number of fastbin blocks */, smblks: %d\0A\00"
@.str.4 = [44 x i8] c"/* number of mmapped regions */, hblks: %d\0A\00"
@.str.5 = [43 x i8] c"/* space in mmapped regions */, hblks: %d\0A\00"
@.str.6 = [50 x i8] c"/* maximum total allocated space */, usmblks: %d\0A\00"
@.str.7 = [60 x i8] c"/* space available in freed fastbin blocks */, fsmblks: %d\0A\00"
@.str.8 = [43 x i8] c"/* total allocated space */, uordblks: %d\0A\00"
@.str.9 = [38 x i8] c"/* total free space */, fordblks: %d\0A\00"
@.str.10 = [66 x i8] c"/* top-most, releasable (via malloc_trim) space */, keepcost: %d\0A\00"
@str.11 = [54 x i8] c"-----------------------------------------------------\00"
define void @show_mallinfo() {
%1 = alloca %struct.mallinfo
%2 = tail call i32 (...) @my_restore()
%3 = bitcast %struct.mallinfo* %1 to i8*
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.11, i64 0, i64 0))
%5 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 3
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 6
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 7
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 8
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i64 0, i32 9
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.10, i64 0, i64 0), i32 %33)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.11, i64 0, i64 0))
%36 = call i32 (...) @my_init()
ret void
}