#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 dumpmallinfo(void) {
  struct mallinfo mi;
  mi = mallinfo();
  printf("\n");
  printf("Total 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);
  printf("\n");
}


x86 assembly (clang, -O0):
<dumpmallinfo>:
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>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xf49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xf7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpmallinfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1050 <mallinfo@plt>
mov    0x10(%rsp),%r15d
mov    0x14(%rsp),%r12d
mov    0x18(%rsp),%r13d
mov    0x1c(%rsp),%r14d
mov    0x20(%rsp),%ebp
mov    0x24(%rsp),%ebx
mov    0x28(%rsp),%eax
mov    %eax,(%rsp)
mov    0x2c(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    0x30(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6a(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf22(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf3b(%rip),%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf54(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@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 = [2 x i8] c"\0A\00"
@.str.1 = [43 x i8] c"Total non-mmapped bytes (arena): %d\0A\00"
@.str.2 = [43 x i8] c"# of free chunks (ordblks): %d\0A\00"
@.str.3 = [43 x i8] c"# of free fastbin blocks (smblks): %d\0A\00"
@.str.4 = [43 x i8] c"# of mapped regions (hblks): %d\0A\00"
@.str.5 = [43 x i8] c"Bytes in mapped regions (hblkhd): %d\0A\00"
@.str.6 = [43 x i8] c"Max. total allocated space (usmblks): %d\0A\00"
@.str.7 = [43 x i8] c"Free bytes held in fastbins (fsmblks): %d\0A\00"
@.str.8 = [43 x i8] c"Total allocated space (uordblks): %d\0A\00"
@.str.9 = [43 x i8] c"Total free space (fordblks): %d\0A\00"
@.str.10 = [43 x i8] c"Topmost releasable block (keepcost): %d\0A\00"
define void @dumpmallinfo() {
%1 = alloca %struct.mallinfo
%2 = alloca %struct.mallinfo
%3 = bitcast %struct.mallinfo* %1 to i8*
%4 = bitcast %struct.mallinfo* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 2
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 3
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 5
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 6
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 7
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 8
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 9
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

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