#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 */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
scalar_t__ COLS;
int LINES;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mvwhline(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, scalar_t__, char *,
                             ...);
int /*<<< orphan*/ *newwin(int, scalar_t__, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ print_activities(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ print_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *print_main_window(int sel, int off) {
  WINDOW *win = newwin(LINES, COLS, 0, 0);
  keypad(win, TRUE);
  time_t now = time(0);
  char buf[11];
  strftime(buf, 11, "%d.%m.%Y", localtime(&now));
  mvwprintw(win, 0, 0, "Today (%s)", buf);
  mvwhline(win, 1, 0, 0, COLS);
  mvwprintw(win, 2, 0, "Name");
  mvwprintw(win, 2, COLS - 6, "Time");
  mvwhline(win, 3, 0, 0, COLS);
  print_activities(win, sel, off);
  mvwhline(win, LINES - 2, 0, 0, COLS);
  print_new(win);
  wrefresh(win);
  return win;
}


x86 assembly (clang, -O0):
<print_main_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
mov    0x2e1a(%rip),%rax
mov    (%rax),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1070 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x1f(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%ecx
mov    $0xb,%esi
lea    0xdf3(%rip),%rdx
call   10a0 <strftime@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1f(%rbp),%r8
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
lea    0xde2(%rip),%rcx
mov    $0x0,%al
call   10b0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d9f(%rip),%rax
mov    (%rax),%r8
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1090 <mvwhline@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
xor    %eax,%eax
mov    %eax,%edx
lea    0xdb6(%rip),%rcx
mov    $0x0,%al
call   10b0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d68(%rip),%rax
mov    (%rax),%rdx
sub    $0x6,%rdx
mov    $0x2,%esi
lea    0xd96(%rip),%rcx
mov    $0x0,%al
call   10b0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d43(%rip),%rax
mov    (%rax),%r8
mov    $0x3,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1090 <mvwhline@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1060 <print_activities@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
sub    $0x2,%esi
mov    0x2d0c(%rip),%rax
mov    (%rax),%r8
xor    %ecx,%ecx
mov    %ecx,%edx
call   1090 <mvwhline@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <print_new@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_main_window>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %edi,%r15d
mov    0x2e2d(%rip),%r13
mov    0x0(%r13),%edi
mov    0x2e12(%rip),%r12
mov    (%r12),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1070 <newwin@plt>
mov    %rax,%rbx
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <keypad@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xdfd(%rip),%rdx
lea    0xd(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xb,%esi
mov    %eax,%ecx
call   10a0 <strftime@plt>
lea    0xdeb(%rip),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %rbp,%r8
xor    %eax,%eax
call   10b0 <mvwprintw@plt>
mov    (%r12),%r8
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <mvwhline@plt>
lea    0xdc9(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
xor    %eax,%eax
call   10b0 <mvwprintw@plt>
mov    (%r12),%rdx
add    $0xfffffffffffffffa,%rdx
lea    0xdae(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   10b0 <mvwprintw@plt>
mov    (%r12),%r8
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <mvwhline@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1060 <print_activities@plt>
mov    0x0(%r13),%esi
add    $0xfffffffe,%esi
mov    (%r12),%r8
mov    %rbx,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <mvwhline@plt>
mov    %rbx,%rdi
call   10c0 <print_new@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i64 0
@TRUE = global i32 0
@.str = [9 x i8] c"%d.%m.%Y\00"
@.str.1 = [11 x i8] c"Today (%s)\00"
@.str.2 = [5 x i8] c"Name\00"
@.str.3 = [5 x i8] c"Time\00"
define i32* @print_main_window(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [11 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* @LINES
%9 = load i64, i64* @COLS
%10 = call i32* @newwin(i32 %8, i64 %9, i32 0, i32 0)
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = load i32, i32* @TRUE
%13 = call i32 @keypad(i32* %11, i32 %12)
%14 = call i32 @time(i32 0)
store i32 %14, i32* %6
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%16 = call i32 @localtime(i32* %6)
%17 = call i32 @strftime(i8* %15, i32 11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %5
%19 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%20 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %18, i32 0, i64 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %5
%22 = load i64, i64* @COLS
%23 = call i32 @mvwhline(i32* %21, i32 1, i32 0, i32 0, i64 %22)
%24 = load i32*, i32** %5
%25 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %24, i32 2, i64 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32*, i32** %5
%27 = load i64, i64* @COLS
%28 = sub nsw i64 %27, 6
%29 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %26, i32 2, i64 %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32*, i32** %5
%31 = load i64, i64* @COLS
%32 = call i32 @mvwhline(i32* %30, i32 3, i32 0, i32 0, i64 %31)
%33 = load i32*, i32** %5
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = call i32 @print_activities(i32* %33, i32 %34, i32 %35)
%37 = load i32*, i32** %5
%38 = load i32, i32* @LINES
%39 = sub nsw i32 %38, 2
%40 = load i64, i64* @COLS
%41 = call i32 @mvwhline(i32* %37, i32 %39, i32 0, i32 0, i64 %40)
%42 = load i32*, i32** %5
%43 = call i32 @print_new(i32* %42)
%44 = load i32*, i32** %5
%45 = call i32 @wrefresh(i32* %44)
%46 = load i32*, i32** %5
ret i32* %46
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i64 0
@TRUE = global i32 0
@.str = [9 x i8] c"%d.%m.%Y\00"
@.str.1 = [11 x i8] c"Today (%s)\00"
@.str.2 = [5 x i8] c"Name\00"
@.str.3 = [5 x i8] c"Time\00"
define i32* @print_main_window(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [11 x i8]
%5 = load i32, i32* @LINES
%6 = load i64, i64* @COLS
%7 = tail call i32* @newwin(i32 %5, i64 %6, i32 0, i32 0)
%8 = load i32, i32* @TRUE
%9 = tail call i32 @keypad(i32* %7, i32 %8)
%10 = bitcast i32* %3 to i8*
%11 = tail call i32 @time(i32 0)
store i32 %11, i32* %3
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%13 = call i32 @localtime(i32* %3)
%14 = call i32 @strftime(i8* %12, i32 11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %7, i32 0, i64 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%16 = load i64, i64* @COLS
%17 = call i32 @mvwhline(i32* %7, i32 1, i32 0, i32 0, i64 %16)
%18 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %7, i32 2, i64 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = load i64, i64* @COLS
%20 = add nsw i64 %19, -6
%21 = call i32 (i32*, i32, i64, i8*, ...) @mvwprintw(i32* %7, i32 2, i64 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = load i64, i64* @COLS
%23 = call i32 @mvwhline(i32* %7, i32 3, i32 0, i32 0, i64 %22)
%24 = call i32 @print_activities(i32* %7, i32 %0, i32 %1)
%25 = load i32, i32* @LINES
%26 = add nsw i32 %25, -2
%27 = load i64, i64* @COLS
%28 = call i32 @mvwhline(i32* %7, i32 %26, i32 0, i32 0, i64 %27)
%29 = call i32 @print_new(i32* %7)
%30 = call i32 @wrefresh(i32* %7)
ret i32* %7
}