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


x86 assembly (clang, -O0):
<stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x58(%rbp),%rdi
mov    $0x0,%al
call   1040 <mallinfo@plt>
lea    -0x30(%rbp),%rdi
lea    -0x58(%rbp),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xf46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xf9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xfbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xfd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x100e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r15
lea    0x20(%rsp),%rdi
xor    %eax,%eax
call   1060 <mallinfo@plt>
mov    0x20(%rsp),%r12d
mov    0x24(%rsp),%r13d
mov    0x28(%rsp),%ebx
mov    0x2c(%rsp),%r14d
mov    0x30(%rsp),%ebp
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x38(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x3c(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x40(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x44(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0xe55(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf34(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf64(%rip),%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf82(%rip),%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf9b(%rip),%rdi
mov    0x1c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x48,%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 = [4 x i8] c"%s\0A\00"
@.str.1 = [66 x i8] c"%10d int arena; /* non-mmapped space allocated from system */\0A\00"
@.str.2 = [48 x i8] c"%10d int ordblks; /* number of free chunks */\0A\00"
@.str.3 = [51 x i8] c"%10d int smblks; /* number of fastbin blocks */\0A\00"
@.str.4 = [52 x i8] c"%10d int hblks; /* number of mmapped regions */\0A\00"
@.str.5 = [51 x i8] c"%10d int hblkhd; /* space in mmapped regions */\0A\00"
@.str.6 = [56 x i8] c"%10d int usmblks; /* maximum total allocated space */\0A\00"
@.str.7 = [66 x i8] c"%10d int fsmblks; /* space available in freed fastbin blocks */\0A\00"
@.str.8 = [48 x i8] c"%10d int uordblks; /* total allocated space */\0A\00"
@.str.9 = [43 x i8] c"%10d int fordblks; /* total free space */\0A\00"
@.str.10 = [71 x i8] c"%10d int keepcost; /* top-most, releasable (via malloc_trim) space */\0A\00"
@.str.11 = [2 x i8] c"\0A\00"
define void @stats(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.mallinfo
%4 = alloca %struct.mallinfo
store i8* %0, i8** %2
%5 = bitcast %struct.mallinfo* %3 to i8*
%6 = bitcast %struct.mallinfo* %4 to i8*
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 1
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 2
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 3
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 4
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 5
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 6
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 7
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 8
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %3, i32 0, i32 9
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.10, i64 0, i64 0), i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
ret void
}

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