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

/* Variables and functions */
int COLS;
int /*<<< orphan*/ EXIT_SUCCESS;
int LINES;
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int /*<<< orphan*/ *newpad(int, int);
int /*<<< orphan*/ prefresh(int /*<<< orphan*/ *, int, int, int, int, int, int);
int /*<<< orphan*/ sleep(int);
int main() {
  WINDOW *pad_ptr;
  int x, y;
  int pad_lines;
  int pad_cols;
  char disp_char;
  initscr();
  pad_lines = LINES + 50;
  pad_cols = COLS + 50;
  pad_ptr = newpad(pad_lines, pad_cols);
  disp_char = 'a';
  for (x = 0; x < pad_lines; x++) {
    for (y = 0; y < pad_cols; y++) {
      mvwaddch(pad_ptr, x, y, disp_char);
      if (disp_char == 'z')
        disp_char = 'a';
      else
        disp_char++;
    }
  }
  prefresh(pad_ptr, 5, 7, 2, 2, 9, 9);
  sleep(1);
  prefresh(pad_ptr, LINES + 5, COLS + 7, 5, 5, 21, 19);
  sleep(1);
  delwin(pad_ptr);
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
add    $0x32,%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%eax
add    $0x32,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1060 <newpad@plt>
mov    %rax,-0x10(%rbp)
movb   $0x61,-0x21(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1244 <main+0xc4>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1231 <main+0xb1>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movsbl -0x21(%rbp),%ecx
call   1080 <mvwaddch@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x7a,%eax
jne    1216 <main+0x96>
movb   $0x61,-0x21(%rbp)
jmp    121e <main+0x9e>
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
jmp    1223 <main+0xa3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e1 <main+0x61>
jmp    1236 <main+0xb6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ce <main+0x4e>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x7,%edx
mov    $0x2,%r8d
mov    $0x9,%r9d
mov    %r8d,%ecx
movl   $0x9,(%rsp)
call   1050 <prefresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d66(%rip),%rax
mov    (%rax),%esi
add    $0x5,%esi
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
add    $0x7,%edx
mov    $0x5,%r8d
mov    $0x15,%r9d
mov    %r8d,%ecx
movl   $0x13,(%rsp)
call   1050 <prefresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x10(%rbp),%rdi
call   1040 <delwin@plt>
mov    $0x0,%al
call   1070 <endwin@plt>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %r12d,%r12d
xor    %eax,%eax
call   1030 <initscr@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%ebp
lea    0x32(%rbp),%edi
mov    0x2e35(%rip),%rax
mov    (%rax),%eax
mov    %rax,0x10(%rsp)
lea    0x32(%rax),%ebx
mov    %edi,0xc(%rsp)
mov    %ebx,%esi
call   1060 <newpad@plt>
mov    %rax,%r15
cmp    $0xffffffcf,%ebp
jl     122a <main+0xaa>
cmp    $0x2,%ebx
mov    $0x1,%r14d
cmovge %ebx,%r14d
mov    $0x61,%al
mov    $0x61,%r13d
jmp    11eb <main+0x6b>
nop
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
je     122a <main+0xaa>
cmpl   $0xffffffcf,0x10(%rsp)
jl     11e0 <main+0x60>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%ebp
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1080 <mvwaddch@plt>
lea    0x1(%rbp),%eax
cmp    $0x7a,%bpl
movzbl %al,%eax
cmove  %r13d,%eax
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1200 <main+0x80>
jmp    11e0 <main+0x60>
movl   $0x9,(%rsp)
mov    %r15,%rdi
mov    $0x5,%esi
mov    $0x7,%edx
mov    $0x2,%ecx
mov    $0x2,%r8d
mov    $0x9,%r9d
call   1050 <prefresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%esi
add    $0x5,%esi
mov    0x2d6f(%rip),%rax
mov    (%rax),%edx
add    $0x7,%edx
movl   $0x13,(%rsp)
mov    %r15,%rdi
mov    $0x5,%ecx
mov    $0x5,%r8d
mov    $0x15,%r9d
call   1050 <prefresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    %r15,%rdi
call   1040 <delwin@plt>
xor    %eax,%eax
call   1070 <endwin@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (...) @initscr()
%9 = load i32, i32* @LINES
%10 = add nsw i32 %9, 50
store i32 %10, i32* %5
%11 = load i32, i32* @COLS
%12 = add nsw i32 %11, 50
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32* @newpad(i32 %13, i32 %14)
store i32* %15, i32** %2
store i8 97, i8* %7
store i32 0, i32* %3
br label %16
16: ; preds = %43, %0
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %46
20: ; preds = %16
store i32 0, i32* %4
br label %21
21: ; preds = %39, %20
%22 = load i32, i32* %4
%23 = load i32, i32* %6
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %42
25: ; preds = %21
%26 = load i32*, i32** %2
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i8, i8* %7
%30 = call i32 @mvwaddch(i32* %26, i32 %27, i32 %28, i8 signext %29)
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 122
br i1 %33, label %34, label %35
34: ; preds = %25
store i8 97, i8* %7
br label %38
35: ; preds = %25
%36 = load i8, i8* %7
%37 = add i8 %36, 1
store i8 %37, i8* %7
br label %38
38: ; preds = %35, %34
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %21
42: ; preds = %21
br label %43
43: ; preds = %42
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %16
46: ; preds = %16
%47 = load i32*, i32** %2
%48 = call i32 @prefresh(i32* %47, i32 5, i32 7, i32 2, i32 2, i32 9, i32 9)
%49 = call i32 @sleep(i32 1)
%50 = load i32*, i32** %2
%51 = load i32, i32* @LINES
%52 = add nsw i32 %51, 5
%53 = load i32, i32* @COLS
%54 = add nsw i32 %53, 7
%55 = call i32 @prefresh(i32* %50, i32 %52, i32 %54, i32 5, i32 5, i32 21, i32 19)
%56 = call i32 @sleep(i32 1)
%57 = load i32*, i32** %2
%58 = call i32 @delwin(i32* %57)
%59 = call i32 (...) @endwin()
%60 = load i32, i32* @EXIT_SUCCESS
%61 = call i32 @exit(i32 %60)
unreachable
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = load i32, i32* @LINES
%3 = add nsw i32 %2, 50
%4 = load i32, i32* @COLS
%5 = add nsw i32 %4, 50
%6 = tail call i32* @newpad(i32 %3, i32 %5)
%7 = icmp sgt i32 %2, -50
br i1 %7, label %8, label %27
8: ; preds = %0
%9 = icmp sgt i32 %4, -50
%10 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %11
11: ; preds = %8, %23
%12 = phi i8 [ 97, %8 ], [ %24, %23 ]
%13 = phi i32 [ 0, %8 ], [ %25, %23 ]
br i1 %9, label %14, label %23
14: ; preds = %11, %14
%15 = phi i8 [ %20, %14 ], [ %12, %11 ]
%16 = phi i32 [ %21, %14 ], [ 0, %11 ]
%17 = tail call i32 @mvwaddch(i32* %6, i32 %13, i32 %16, i8 signext %15)
%18 = icmp eq i8 %15, 122
%19 = add i8 %15, 1
%20 = select i1 %18, i8 97, i8 %19
%21 = add nuw nsw i32 %16, 1
%22 = icmp eq i32 %21, %10
br i1 %22, label %23, label %14
23: ; preds = %14, %11
%24 = phi i8 [ %12, %11 ], [ %20, %14 ]
%25 = add nuw nsw i32 %13, 1
%26 = icmp eq i32 %25, %3
br i1 %26, label %27, label %11
27: ; preds = %23, %0
%28 = tail call i32 @prefresh(i32* %6, i32 5, i32 7, i32 2, i32 2, i32 9, i32 9)
%29 = tail call i32 @sleep(i32 1)
%30 = load i32, i32* @LINES
%31 = add nsw i32 %30, 5
%32 = load i32, i32* @COLS
%33 = add nsw i32 %32, 7
%34 = tail call i32 @prefresh(i32* %6, i32 %31, i32 %33, i32 5, i32 5, i32 21, i32 19)
%35 = tail call i32 @sleep(i32 1)
%36 = tail call i32 @delwin(i32* %6)
%37 = tail call i32 (...) @endwin()
%38 = load i32, i32* @EXIT_SUCCESS
%39 = tail call i32 @exit(i32 %38)
unreachable
}