#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*/ memset(char *, char, int);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ refresh();
int snprintf(char *, int, char *, int);
int print_footer(int maxY, int height_tree, int height_trunk) {
  char buf[50];
  int footer_width = 0;
  memset(buf, '\0', sizeof buf);
  int char_ret1 = snprintf(buf, sizeof buf, "Height tree: %d", height_tree);
  mvaddstr(maxY - 1, 0, buf);
  footer_width += char_ret1;
  memset(buf, '\0', sizeof buf);
  int char_ret2 = snprintf(buf, sizeof buf, "Height trunk: %d", height_trunk);
  mvaddstr(maxY - 1, ++footer_width, buf);
  footer_width += char_ret2;
  memset(buf, '\0', sizeof buf);
  int char_ret3 = snprintf(buf, sizeof buf, "Total tree height: %d",
                           height_tree + height_trunk);
  mvaddstr(maxY - 1, ++footer_width, buf);
  footer_width += char_ret3;
  refresh();
  return 0;
}


x86 assembly (clang, -O0):
<print_footer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x32,%esi
lea    0xe85(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
lea    -0x40(%rbp),%rdx
xor    %esi,%esi
call   1060 <mvaddstr@plt>
mov    -0x48(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x32,%esi
lea    0xe50(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x44(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x44(%rbp)
lea    -0x40(%rbp),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4c(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
mov    $0x32,%esi
lea    0xe12(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x44(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x44(%rbp)
lea    -0x40(%rbp),%rdx
call   1060 <mvaddstr@plt>
mov    -0x50(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    $0x0,%al
call   1050 <refresh@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_footer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%ebp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    0xe92(%rip),%rdx
mov    %r14,%rdi
mov    $0x32,%esi
mov    %r15d,%ecx
call   1030 <snprintf@plt>
mov    %eax,%r12d
add    $0xffffffff,%ebp
mov    %ebp,%edi
xor    %esi,%esi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    0xe6a(%rip),%rdx
mov    %r14,%rdi
mov    $0x32,%esi
mov    %ebx,%ecx
call   1030 <snprintf@plt>
mov    %eax,%r13d
lea    0x1(%r12),%esi
mov    %ebp,%edi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
add    %r15d,%ebx
lea    0xe41(%rip),%rdx
mov    %r14,%rdi
mov    $0x32,%esi
mov    %ebx,%ecx
call   1030 <snprintf@plt>
lea    (%r12,%r13,1),%esi
add    $0x2,%esi
mov    %ebp,%edi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Height tree: %d\00"
@.str.1 = [17 x i8] c"Height trunk: %d\00"
@.str.2 = [22 x i8] c"Total tree height: %d\00"
define i32 @print_footer(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i8 signext 0, i32 50)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* %5
%16 = call i32 @snprintf(i8* %14, i32 50, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 %16, i32* %9
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%20 = call i32 @mvaddstr(i32 %18, i32 0, i8* %19)
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = add nsw i32 %22, %21
store i32 %23, i32* %8
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%25 = call i32 @memset(i8* %24, i8 signext 0, i32 50)
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%27 = load i32, i32* %6
%28 = call i32 @snprintf(i8* %26, i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 %28, i32* %10
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 1
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%34 = call i32 @mvaddstr(i32 %30, i32 %32, i8* %33)
%35 = load i32, i32* %10
%36 = load i32, i32* %8
%37 = add nsw i32 %36, %35
store i32 %37, i32* %8
%38 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%39 = call i32 @memset(i8* %38, i8 signext 0, i32 50)
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = add nsw i32 %41, %42
%44 = call i32 @snprintf(i8* %40, i32 50, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %43)
store i32 %44, i32* %11
%45 = load i32, i32* %4
%46 = sub nsw i32 %45, 1
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%50 = call i32 @mvaddstr(i32 %46, i32 %48, i8* %49)
%51 = load i32, i32* %11
%52 = load i32, i32* %8
%53 = add nsw i32 %52, %51
store i32 %53, i32* %8
%54 = call i32 (...) @refresh()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Height tree: %d\00"
@.str.1 = [17 x i8] c"Height trunk: %d\00"
@.str.2 = [22 x i8] c"Total tree height: %d\00"
define i32 @print_footer(i32 %0, i32 %1, i32 %2) {
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i8 signext 0, i32 50)
%7 = call i32 @snprintf(i8* %5, i32 50, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
%8 = add nsw i32 %0, -1
%9 = call i32 @mvaddstr(i32 %8, i32 0, i8* %5)
%10 = call i32 @memset(i8* %5, i8 signext 0, i32 50)
%11 = call i32 @snprintf(i8* %5, i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%12 = add nsw i32 %7, 1
%13 = call i32 @mvaddstr(i32 %8, i32 %12, i8* %5)
%14 = call i32 @memset(i8* %5, i8 signext 0, i32 50)
%15 = add nsw i32 %2, %1
%16 = call i32 @snprintf(i8* %5, i32 50, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = add i32 %7, 2
%18 = add i32 %17, %11
%19 = call i32 @mvaddstr(i32 %8, i32 %18, i8* %5)
%20 = call i32 (...) @refresh()
ret i32 0
}