#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 */

/* Variables and functions */
int /*<<< orphan*/ _xtotals(char *, char *, int, int, int);
int /*<<< orphan*/ link_slabs();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rename_slabs();
int /*<<< orphan*/ totals();
void xtotals(void) {
  char *heading, *underline;
  totals();
  link_slabs();
  rename_slabs();
  heading = "\nSlabs sorted by size\n";
  underline = "--------------------\n";
  _xtotals(heading, underline, 0, 1, 0);
  heading = "\nSlabs sorted by loss\n";
  underline = "--------------------\n";
  _xtotals(heading, underline, 1, 0, 0);
  heading = "\nSlabs sorted by number of partial slabs\n";
  underline = "---------------------------------------\n";
  _xtotals(heading, underline, 0, 0, 1);
  printf("\n");
}


x86 assembly (clang, -O0):
<xtotals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <totals@plt>
mov    $0x0,%al
call   1060 <link_slabs@plt>
mov    $0x0,%al
call   1050 <rename_slabs@plt>
lea    0xe8c(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeec(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r8d,%r8d
mov    $0x1,%ecx
mov    %r8d,%edx
call   1070 <_xtotals@plt>
lea    0xe75(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xebe(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1070 <_xtotals@plt>
lea    0xe5e(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe7d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1070 <_xtotals@plt>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtotals>:
push   %rbx
xor    %eax,%eax
call   1030 <totals@plt>
xor    %eax,%eax
call   1060 <link_slabs@plt>
xor    %eax,%eax
call   1050 <rename_slabs@plt>
lea    0xe93(%rip),%rdi
lea    0xef7(%rip),%rbx
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1070 <_xtotals@plt>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1070 <_xtotals@plt>
lea    0xe88(%rip),%rdi
lea    0xeab(%rip),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1070 <_xtotals@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putchar@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0ASlabs sorted by size\0A\00"
@.str.1 = [22 x i8] c"--------------------\0A\00"
@.str.2 = [23 x i8] c"\0ASlabs sorted by loss\0A\00"
@.str.3 = [42 x i8] c"\0ASlabs sorted by number of partial slabs\0A\00"
@.str.4 = [41 x i8] c"---------------------------------------\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @xtotals() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 (...) @totals()
%4 = call i32 (...) @link_slabs()
%5 = call i32 (...) @rename_slabs()
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8** %2
%6 = load i8*, i8** %1
%7 = load i8*, i8** %2
%8 = call i32 @_xtotals(i8* %6, i8* %7, i32 0, i32 1, i32 0)
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8** %2
%9 = load i8*, i8** %1
%10 = load i8*, i8** %2
%11 = call i32 @_xtotals(i8* %9, i8* %10, i32 1, i32 0, i32 0)
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8** %2
%12 = load i8*, i8** %1
%13 = load i8*, i8** %2
%14 = call i32 @_xtotals(i8* %12, i8* %13, i32 0, i32 0, i32 1)
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0ASlabs sorted by size\0A\00"
@.str.1 = [22 x i8] c"--------------------\0A\00"
@.str.2 = [23 x i8] c"\0ASlabs sorted by loss\0A\00"
@.str.3 = [42 x i8] c"\0ASlabs sorted by number of partial slabs\0A\00"
@.str.4 = [41 x i8] c"---------------------------------------\0A\00"
define void @xtotals() {
%1 = tail call i32 (...) @totals()
%2 = tail call i32 (...) @link_slabs()
%3 = tail call i32 (...) @rename_slabs()
%4 = tail call i32 @_xtotals(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 0)
%5 = tail call i32 @_xtotals(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0, i32 0)
%6 = tail call i32 @_xtotals(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 1)
%7 = tail call i32 @putchar(i32 10)
ret void
}