#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 /*<<< orphan*/ A_REVERSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ *newpad(int, int);
int /*<<< orphan*/ prefresh(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ raw();
int /*<<< orphan*/ *subpad(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wclrtoeol(int /*<<< orphan*/ *);
int /*<<< orphan*/ wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
void padTest(WINDOW *dummy) {
  WINDOW *pad, *spad;
  pad = newpad(50, 100);
  wattron(pad, A_REVERSE);
  mvwaddstr(pad, 5, 2, "This is a new pad");
  wattrset(pad, 0);
  mvwaddstr(pad, 8, 0,
            "The end of this line should be truncated here:except  now");
  mvwaddstr(pad, 11, 1, "This line should not appear.It will now");
  wmove(pad, 10, 1);
  wclrtoeol(pad);
  mvwaddstr(pad, 10, 1, " Press any key to continue");
  prefresh(pad, 0, 0, 0, 0, 10, 45);
  keypad(pad, TRUE);
  raw();
  wgetch(pad);
  spad = subpad(pad, 12, 25, 7, 52);
  mvwaddstr(spad, 2, 2, "This is a new subpad");
  box(spad, 0, 0);
  prefresh(pad, 0, 0, 0, 0, 15, 75);
  keypad(pad, TRUE);
  raw();
  wgetch(pad);
  mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad");
  mvwaddstr(pad, 40, 1, " Press any key to continue");
  prefresh(pad, 30, 0, 0, 0, 10, 45);
  keypad(pad, TRUE);
  raw();
  wgetch(pad);
  delwin(pad);
}


x86 assembly (clang, -O0):
<padTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x32,%edi
mov    $0x64,%esi
call   10b0 <newpad@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
call   10d0 <wattron@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x2,%edx
lea    0xdea(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <wattrset@plt>
mov    -0x10(%rbp),%rdi
mov    $0x8,%esi
xor    %edx,%edx
lea    0xdda(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
lea    0xdfa(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   10e0 <wmove@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wclrtoeol@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
lea    0xdec(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
xor    %r8d,%r8d
mov    $0xa,%r9d
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
movl   $0x2d,(%rsp)
call   10a0 <prefresh@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1060 <raw@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <wgetch@plt>
mov    -0x10(%rbp),%rdi
mov    $0xc,%esi
mov    $0x19,%edx
mov    $0x7,%ecx
mov    $0x34,%r8d
call   1090 <subpad@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2,%edx
lea    0xd8c(%rip),%rcx
mov    %edx,%esi
call   10f0 <mvwaddstr@plt>
mov    -0x18(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <box@plt>
mov    -0x10(%rbp),%rdi
xor    %r8d,%r8d
mov    $0xf,%r9d
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
movl   $0x4b,(%rsp)
call   10a0 <prefresh@plt>
mov    -0x10(%rbp),%rdi
mov    0x2ca4(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1060 <raw@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <wgetch@plt>
mov    -0x10(%rbp),%rdi
mov    $0x23,%esi
mov    $0x2,%edx
lea    0xd34(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
mov    $0x1,%edx
lea    0xcea(%rip),%rcx
call   10f0 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1e,%esi
xor    %r8d,%r8d
mov    $0xa,%r9d
mov    %r8d,%edx
mov    %r8d,%ecx
movl   $0x2d,(%rsp)
call   10a0 <prefresh@plt>
mov    -0x10(%rbp),%rdi
mov    0x2c2a(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1060 <raw@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <wgetch@plt>
mov    -0x10(%rbp),%rdi
call   1080 <delwin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padTest>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x32,%edi
mov    $0x64,%esi
call   10b0 <newpad@plt>
mov    %rax,%rbx
mov    0x2de7(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10d0 <wattron@plt>
lea    0xdfe(%rip),%rcx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   10f0 <mvwaddstr@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <wattrset@plt>
lea    0xded(%rip),%rcx
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   10f0 <mvwaddstr@plt>
lea    0xe11(%rip),%rcx
mov    %rbx,%rdi
mov    $0xb,%esi
mov    $0x1,%edx
call   10f0 <mvwaddstr@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   10e0 <wmove@plt>
mov    %rbx,%rdi
call   1040 <wclrtoeol@plt>
lea    0xe06(%rip),%r14
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10f0 <mvwaddstr@plt>
movl   $0x2d,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0xa,%r9d
call   10a0 <prefresh@plt>
mov    0x2d40(%rip),%r12
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1060 <raw@plt>
mov    %rbx,%rdi
call   10c0 <wgetch@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x19,%edx
mov    $0x7,%ecx
mov    $0x34,%r8d
call   1090 <subpad@plt>
mov    %rax,%r15
lea    0xda5(%rip),%rcx
mov    %rax,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   10f0 <mvwaddstr@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <box@plt>
movl   $0x4b,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0xf,%r9d
call   10a0 <prefresh@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1060 <raw@plt>
mov    %rbx,%rdi
call   10c0 <wgetch@plt>
lea    0xd5c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x23,%esi
mov    $0x2,%edx
call   10f0 <mvwaddstr@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10f0 <mvwaddstr@plt>
movl   $0x2d,(%rsp)
mov    %rbx,%rdi
mov    $0x1e,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0xa,%r9d
call   10a0 <prefresh@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1060 <raw@plt>
mov    %rbx,%rdi
call   10c0 <wgetch@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <delwin@plt>

LLVM IR (-O0):
@A_REVERSE = global i32 0
@.str = [18 x i8] c"This is a new pad\00"
@.str.1 = [58 x i8] c"The end of this line should be truncated here:except now\00"
@.str.2 = [40 x i8] c"This line should not appear.It will now\00"
@.str.3 = [27 x i8] c" Press any key to continue\00"
@TRUE = global i32 0
@.str.4 = [21 x i8] c"This is a new subpad\00"
@.str.5 = [40 x i8] c"This is displayed at line 35 in the pad\00"
define void @padTest(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %2
%5 = call i32* @newpad(i32 50, i32 100)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* @A_REVERSE
%8 = call i32 @wattron(i32* %6, i32 %7)
%9 = load i32*, i32** %3
%10 = call i32 @mvwaddstr(i32* %9, i32 5, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = load i32*, i32** %3
%12 = call i32 @wattrset(i32* %11, i32 0)
%13 = load i32*, i32** %3
%14 = call i32 @mvwaddstr(i32* %13, i32 8, i32 0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32*, i32** %3
%16 = call i32 @mvwaddstr(i32* %15, i32 11, i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = call i32 @wmove(i32* %17, i32 10, i32 1)
%19 = load i32*, i32** %3
%20 = call i32 @wclrtoeol(i32* %19)
%21 = load i32*, i32** %3
%22 = call i32 @mvwaddstr(i32* %21, i32 10, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32*, i32** %3
%24 = call i32 @prefresh(i32* %23, i32 0, i32 0, i32 0, i32 0, i32 10, i32 45)
%25 = load i32*, i32** %3
%26 = load i32, i32* @TRUE
%27 = call i32 @keypad(i32* %25, i32 %26)
%28 = call i32 (...) @raw()
%29 = load i32*, i32** %3
%30 = call i32 @wgetch(i32* %29)
%31 = load i32*, i32** %3
%32 = call i32* @subpad(i32* %31, i32 12, i32 25, i32 7, i32 52)
store i32* %32, i32** %4
%33 = load i32*, i32** %4
%34 = call i32 @mvwaddstr(i32* %33, i32 2, i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32*, i32** %4
%36 = call i32 @box(i32* %35, i32 0, i32 0)
%37 = load i32*, i32** %3
%38 = call i32 @prefresh(i32* %37, i32 0, i32 0, i32 0, i32 0, i32 15, i32 75)
%39 = load i32*, i32** %3
%40 = load i32, i32* @TRUE
%41 = call i32 @keypad(i32* %39, i32 %40)
%42 = call i32 (...) @raw()
%43 = load i32*, i32** %3
%44 = call i32 @wgetch(i32* %43)
%45 = load i32*, i32** %3
%46 = call i32 @mvwaddstr(i32* %45, i32 35, i32 2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%47 = load i32*, i32** %3
%48 = call i32 @mvwaddstr(i32* %47, i32 40, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32*, i32** %3
%50 = call i32 @prefresh(i32* %49, i32 30, i32 0, i32 0, i32 0, i32 10, i32 45)
%51 = load i32*, i32** %3
%52 = load i32, i32* @TRUE
%53 = call i32 @keypad(i32* %51, i32 %52)
%54 = call i32 (...) @raw()
%55 = load i32*, i32** %3
%56 = call i32 @wgetch(i32* %55)
%57 = load i32*, i32** %3
%58 = call i32 @delwin(i32* %57)
ret void
}

LLVM IR (-O2):
@A_REVERSE = global i32 0
@.str = [18 x i8] c"This is a new pad\00"
@.str.1 = [58 x i8] c"The end of this line should be truncated here:except now\00"
@.str.2 = [40 x i8] c"This line should not appear.It will now\00"
@.str.3 = [27 x i8] c" Press any key to continue\00"
@TRUE = global i32 0
@.str.4 = [21 x i8] c"This is a new subpad\00"
@.str.5 = [40 x i8] c"This is displayed at line 35 in the pad\00"
define void @padTest(i32* nocapture readnone %0) {
%2 = tail call i32* @newpad(i32 50, i32 100)
%3 = load i32, i32* @A_REVERSE
%4 = tail call i32 @wattron(i32* %2, i32 %3)
%5 = tail call i32 @mvwaddstr(i32* %2, i32 5, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @wattrset(i32* %2, i32 0)
%7 = tail call i32 @mvwaddstr(i32* %2, i32 8, i32 0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @mvwaddstr(i32* %2, i32 11, i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @wmove(i32* %2, i32 10, i32 1)
%10 = tail call i32 @wclrtoeol(i32* %2)
%11 = tail call i32 @mvwaddstr(i32* %2, i32 10, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @prefresh(i32* %2, i32 0, i32 0, i32 0, i32 0, i32 10, i32 45)
%13 = load i32, i32* @TRUE
%14 = tail call i32 @keypad(i32* %2, i32 %13)
%15 = tail call i32 (...) @raw()
%16 = tail call i32 @wgetch(i32* %2)
%17 = tail call i32* @subpad(i32* %2, i32 12, i32 25, i32 7, i32 52)
%18 = tail call i32 @mvwaddstr(i32* %17, i32 2, i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 @box(i32* %17, i32 0, i32 0)
%20 = tail call i32 @prefresh(i32* %2, i32 0, i32 0, i32 0, i32 0, i32 15, i32 75)
%21 = load i32, i32* @TRUE
%22 = tail call i32 @keypad(i32* %2, i32 %21)
%23 = tail call i32 (...) @raw()
%24 = tail call i32 @wgetch(i32* %2)
%25 = tail call i32 @mvwaddstr(i32* %2, i32 35, i32 2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%26 = tail call i32 @mvwaddstr(i32* %2, i32 40, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%27 = tail call i32 @prefresh(i32* %2, i32 30, i32 0, i32 0, i32 0, i32 10, i32 45)
%28 = load i32, i32* @TRUE
%29 = tail call i32 @keypad(i32* %2, i32 %28)
%30 = tail call i32 (...) @raw()
%31 = tail call i32 @wgetch(i32* %2)
%32 = tail call i32 @delwin(i32* %2)
ret void
}