#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 /*<<< orphan*/, int, char *);
int /*<<< orphan*/ refresh();
int snprintf(char *, int, char *, int);
int print_header(int maxY, int maxX) {
  char buf[50];
  int header_width = 0;
  memset(buf, '\0', sizeof buf);
  int char_ret1 = snprintf(buf, sizeof buf, "Max Height: %d", maxY);
  mvaddstr(0, 0, buf);
  header_width += char_ret1;
  memset(buf, '\0', sizeof buf);
  int char_ret2 = snprintf(buf, sizeof buf, "Max Width: %d", maxX);
  mvaddstr(0, ++header_width, buf);
  header_width += char_ret2;
  refresh();
  return 0;
}


x86 assembly (clang, -O0):
<print_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x32,%esi
lea    0xe88(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdx
xor    %esi,%esi
mov    %esi,%edi
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    -0x8(%rbp),%ecx
mov    $0x32,%esi
lea    0xe56(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x44(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x44(%rbp)
lea    -0x40(%rbp),%rdx
xor    %edi,%edi
call   1060 <mvaddstr@plt>
mov    -0x4c(%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_header>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %esi,%r14d
mov    %edi,%ebp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    0xe9a(%rip),%rdx
mov    %rbx,%rdi
mov    $0x32,%esi
mov    %ebp,%ecx
call   1030 <snprintf@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    0xe76(%rip),%rdx
mov    %rbx,%rdi
mov    $0x32,%esi
mov    %r14d,%ecx
call   1030 <snprintf@plt>
add    $0x1,%ebp
xor    %edi,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Max Height: %d\00"
@.str.1 = [14 x i8] c"Max Width: %d\00"
define i32 @print_header(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 0, i32 50)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @snprintf(i8* %11, i32 50, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %7
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%15 = call i32 @mvaddstr(i32 0, i32 0, i8* %14)
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = add nsw i32 %17, %16
store i32 %18, i32* %6
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%20 = call i32 @memset(i8* %19, i8 signext 0, i32 50)
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%22 = load i32, i32* %4
%23 = call i32 @snprintf(i8* %21, i32 50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %22)
store i32 %23, i32* %8
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%27 = call i32 @mvaddstr(i32 0, i32 %25, i8* %26)
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = add nsw i32 %29, %28
store i32 %30, i32* %6
%31 = call i32 (...) @refresh()
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Max Height: %d\00"
@.str.1 = [14 x i8] c"Max Width: %d\00"
define i32 @print_header(i32 %0, i32 %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 50)
%6 = call i32 @snprintf(i8* %4, i32 50, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 @mvaddstr(i32 0, i32 0, i8* %4)
%8 = call i32 @memset(i8* %4, i8 signext 0, i32 50)
%9 = call i32 @snprintf(i8* %4, i32 50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%10 = add nsw i32 %6, 1
%11 = call i32 @mvaddstr(i32 0, i32 %10, i8* %4)
%12 = call i32 (...) @refresh()
ret i32 0
}