#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;
typedef int /*<<< orphan*/ FORM;
typedef int /*<<< orphan*/ FIELD;

/* Variables and functions */
int /*<<< orphan*/ A_UNDERLINE;
int /*<<< orphan*/ COLOR_BLACK;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
#define KEY_DOWN 129
int KEY_F(int);
#define KEY_UP 128
scalar_t__ LINES;
int /*<<< orphan*/ O_AUTOSKIP;
int REQ_END_LINE;
int REQ_NEXT_FIELD;
int REQ_PREV_FIELD;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ derwin(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ field_opts_off(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ form_driver(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ free_field(int /*<<< orphan*/ *);
int /*<<< orphan*/ free_form(int /*<<< orphan*/ *);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(scalar_t__, int /*<<< orphan*/, char *);
int /*<<< orphan*/ *new_field(int, int, int, int, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ *new_form(int /*<<< orphan*/ **);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ post_form(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_in_middle(int /*<<< orphan*/ *, int,
                                   int /*<<< orphan*/, int, char *,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scale_form(int /*<<< orphan*/ *, int *, int *);
int /*<<< orphan*/ set_field_back(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ set_form_sub(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ set_form_win(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ *stdscr;
int /*<<< orphan*/ unpost_form(int /*<<< orphan*/ *);
int wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int main() {
  FIELD *field[3];
  FORM *my_form;
  WINDOW *my_form_win;
  int ch, rows, cols;
  initscr();
  start_color();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  field[0] = new_field(1, 10, 6, 1, 0, 0);
  field[1] = new_field(1, 10, 8, 1, 0, 0);
  field[2] = NULL;
  set_field_back(field[0], A_UNDERLINE);
  field_opts_off(field[0], O_AUTOSKIP);
  set_field_back(field[1], A_UNDERLINE);
  field_opts_off(field[1], O_AUTOSKIP);
  my_form = new_form(field);
  scale_form(my_form, &rows, &cols);
  my_form_win = newwin(rows + 4, cols + 4, 4, 4);
  keypad(my_form_win, TRUE);
  set_form_win(my_form, my_form_win);
  set_form_sub(my_form, derwin(my_form_win, rows, cols, 2, 2));
  box(my_form_win, 0, 0);
  print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1));
  post_form(my_form);
  wrefresh(my_form_win);
  mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
  refresh();
  while ((ch = wgetch(my_form_win)) != KEY_F(1)) {
    switch (ch) {
    case KEY_DOWN:
      form_driver(my_form, REQ_NEXT_FIELD);
      form_driver(my_form, REQ_END_LINE);
      break;
    case KEY_UP:
      form_driver(my_form, REQ_PREV_FIELD);
      form_driver(my_form, REQ_END_LINE);
      break;
    default:
      form_driver(my_form, ch);
      break;
    }
  }
  unpost_form(my_form);
  free_form(my_form);
  free_field(field[0]);
  free_field(field[1]);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <initscr@plt>
mov    $0x0,%al
call   10a0 <start_color@plt>
mov    $0x0,%al
call   1040 <cbreak@plt>
mov    $0x0,%al
call   1180 <noecho@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%rdi
mov    0x2cc4(%rip),%rax
mov    (%rax),%esi
call   1080 <keypad@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%esi
mov    0x2ca5(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    $0x1,%ecx
mov    $0xa,%esi
mov    $0x6,%edx
xor    %r9d,%r9d
mov    %ecx,%edi
mov    %r9d,%r8d
call   1060 <new_field@plt>
mov    %rax,-0x20(%rbp)
mov    $0x1,%ecx
mov    $0xa,%esi
mov    $0x8,%edx
xor    %r9d,%r9d
mov    %ecx,%edi
mov    %r9d,%r8d
call   1060 <new_field@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2c16(%rip),%rax
mov    (%rax),%esi
call   11c0 <set_field_back@plt>
mov    -0x20(%rbp),%rdi
mov    0x2c2c(%rip),%rax
mov    (%rax),%esi
call   11d0 <field_opts_off@plt>
mov    -0x18(%rbp),%rdi
mov    0x2bf2(%rip),%rax
mov    (%rax),%esi
call   11c0 <set_field_back@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c08(%rip),%rax
mov    (%rax),%esi
call   11d0 <field_opts_off@plt>
lea    -0x20(%rbp),%rdi
call   1190 <new_form@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1030 <scale_form@plt>
mov    -0x38(%rbp),%edi
add    $0x4,%edi
mov    -0x3c(%rbp),%esi
add    $0x4,%esi
mov    $0x4,%ecx
mov    %ecx,%edx
call   10c0 <newwin@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2bcc(%rip),%rax
mov    (%rax),%esi
call   1080 <keypad@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1130 <set_form_win@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    $0x2,%r8d
mov    %r8d,%ecx
call   11f0 <derwin@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   11b0 <set_form_sub@plt>
mov    -0x30(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10f0 <box@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x40(%rbp)
mov    $0x1,%edi
call   1120 <COLOR_PAIR@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%ecx
mov    %eax,%r9d
mov    $0x1,%esi
xor    %edx,%edx
lea    0xb7d(%rip),%r8
call   11a0 <print_in_middle@plt>
mov    -0x28(%rbp),%rdi
call   10b0 <post_form@plt>
mov    -0x30(%rbp),%rdi
call   1070 <wrefresh@plt>
mov    0x2b47(%rip),%rax
mov    (%rax),%rdi
sub    $0x2,%rdi
xor    %esi,%esi
lea    0xb57(%rip),%rdx
call   11e0 <mvprintw@plt>
mov    $0x0,%al
call   1140 <refresh@plt>
mov    -0x30(%rbp),%rdi
call   1170 <wgetch@plt>
mov    %eax,-0x54(%rbp)
mov    %eax,-0x34(%rbp)
mov    $0x1,%edi
call   10d0 <KEY_F@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
je     156f <main+0x29f>
mov    -0x34(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x80,%eax
je     1535 <main+0x265>
jmp    14f9 <main+0x229>
mov    -0x58(%rbp),%eax
sub    $0x81,%eax
jne    155e <main+0x28e>
jmp    150c <main+0x23c>
mov    -0x28(%rbp),%rdi
mov    0x2a99(%rip),%rax
mov    (%rax),%esi
call   10e0 <form_driver@plt>
mov    -0x28(%rbp),%rdi
mov    0x2ab7(%rip),%rax
mov    (%rax),%esi
call   10e0 <form_driver@plt>
jmp    156a <main+0x29a>
mov    -0x28(%rbp),%rdi
mov    0x2a68(%rip),%rax
mov    (%rax),%esi
call   10e0 <form_driver@plt>
mov    -0x28(%rbp),%rdi
mov    0x2a8e(%rip),%rax
mov    (%rax),%esi
call   10e0 <form_driver@plt>
jmp    156a <main+0x29a>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   10e0 <form_driver@plt>
jmp    14bd <main+0x1ed>
mov    -0x28(%rbp),%rdi
call   1110 <unpost_form@plt>
mov    -0x28(%rbp),%rdi
call   1100 <free_form@plt>
mov    -0x20(%rbp),%rdi
call   1150 <free_field@plt>
mov    -0x18(%rbp),%rdi
call   1150 <free_field@plt>
mov    $0x0,%al
call   1160 <endwin@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1090 <initscr@plt>
xor    %eax,%eax
call   10a0 <start_color@plt>
xor    %eax,%eax
call   1040 <cbreak@plt>
xor    %eax,%eax
call   1180 <noecho@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%rdi
mov    0x2cc5(%rip),%r15
mov    (%r15),%esi
call   1080 <keypad@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%esi
mov    0x2ca5(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x6,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <new_field@plt>
mov    %rax,%rbx
mov    %rax,0x10(%rsp)
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x8,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <new_field@plt>
mov    %rax,%rbp
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
mov    0x2c0b(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   11c0 <set_field_back@plt>
mov    0x2c21(%rip),%r12
mov    (%r12),%esi
mov    %rbx,%rdi
call   11d0 <field_opts_off@plt>
mov    (%r14),%esi
mov    %rbp,%rdi
call   11c0 <set_field_back@plt>
mov    (%r12),%esi
mov    %rbp,%rdi
call   11d0 <field_opts_off@plt>
lea    0x10(%rsp),%rdi
call   1190 <new_form@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1030 <scale_form@plt>
mov    0xc(%rsp),%edi
add    $0x4,%edi
mov    0x8(%rsp),%esi
add    $0x4,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
call   10c0 <newwin@plt>
mov    %rax,%r14
mov    (%r15),%esi
mov    %rax,%rdi
call   1080 <keypad@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1130 <set_form_win@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    $0x2,%ecx
mov    $0x2,%r8d
call   11f0 <derwin@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   11b0 <set_form_sub@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <box@plt>
mov    0x8(%rsp),%ebp
add    $0x4,%ebp
mov    $0x1,%edi
call   1120 <COLOR_PAIR@plt>
lea    0xba0(%rip),%r8
mov    %r14,%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    %ebp,%ecx
mov    %eax,%r9d
call   11a0 <print_in_middle@plt>
mov    %rbx,%rdi
call   10b0 <post_form@plt>
mov    %r14,%rdi
call   1070 <wrefresh@plt>
mov    0x2b5d(%rip),%rax
mov    (%rax),%rdi
add    $0xfffffffffffffffe,%rdi
lea    0xb6f(%rip),%rdx
xor    %esi,%esi
call   11e0 <mvprintw@plt>
xor    %eax,%eax
call   1140 <refresh@plt>
mov    %r14,%rdi
call   1170 <wgetch@plt>
mov    %eax,%ebp
mov    $0x1,%edi
call   10d0 <KEY_F@plt>
cmp    %eax,%ebp
jne    14fb <main+0x22b>
mov    %rbx,%rdi
call   1110 <unpost_form@plt>
mov    %rbx,%rdi
call   1100 <free_form@plt>
mov    0x10(%rsp),%rdi
call   1150 <free_field@plt>
mov    0x18(%rsp),%rdi
call   1150 <free_field@plt>
xor    %eax,%eax
call   1160 <endwin@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aae(%rip),%r15
mov    0x2ad7(%rip),%r12
mov    0x2a98(%rip),%r13
jmp    1554 <main+0x284>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rax),%esi
mov    %rbx,%rdi
call   10e0 <form_driver@plt>
mov    (%r12),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   10e0 <form_driver@plt>
mov    %r14,%rdi
call   1170 <wgetch@plt>
mov    %eax,%ebp
mov    $0x1,%edi
call   10d0 <KEY_F@plt>
cmp    %eax,%ebp
je     14bf <main+0x1ef>
mov    %r15,%rax
cmp    $0x81,%ebp
je     1520 <main+0x250>
cmp    $0x80,%ebp
jne    152e <main+0x25e>
mov    %r13,%rax
jmp    1520 <main+0x250>

LLVM IR (-O0):
@stdscr = global i32* null
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@A_UNDERLINE = global i32 0
@O_AUTOSKIP = global i32 0
@.str = [8 x i8] c"My Form\00"
@LINES = global i64 0
@.str.1 = [49 x i8] c"Use UP, DOWN arrow keys to switch between fields\00"
@REQ_NEXT_FIELD = global i32 0
@REQ_END_LINE = global i32 0
@REQ_PREV_FIELD = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32*]
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (...) @initscr()
%9 = call i32 (...) @start_color()
%10 = call i32 (...) @cbreak()
%11 = call i32 (...) @noecho()
%12 = load i32*, i32** @stdscr
%13 = load i32, i32* @TRUE
%14 = call i32 @keypad(i32* %12, i32 %13)
%15 = load i32, i32* @COLOR_RED
%16 = load i32, i32* @COLOR_BLACK
%17 = call i32 @init_pair(i32 1, i32 %15, i32 %16)
%18 = call i32* @new_field(i32 1, i32 10, i32 6, i32 1, i32 0, i32 0)
%19 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
store i32* %18, i32** %19
%20 = call i32* @new_field(i32 1, i32 10, i32 8, i32 1, i32 0, i32 0)
%21 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
store i32* %20, i32** %21
%22 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 2
store i32* null, i32** %22
%23 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%24 = load i32*, i32** %23
%25 = load i32, i32* @A_UNDERLINE
%26 = call i32 @set_field_back(i32* %24, i32 %25)
%27 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%28 = load i32*, i32** %27
%29 = load i32, i32* @O_AUTOSKIP
%30 = call i32 @field_opts_off(i32* %28, i32 %29)
%31 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
%32 = load i32*, i32** %31
%33 = load i32, i32* @A_UNDERLINE
%34 = call i32 @set_field_back(i32* %32, i32 %33)
%35 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
%36 = load i32*, i32** %35
%37 = load i32, i32* @O_AUTOSKIP
%38 = call i32 @field_opts_off(i32* %36, i32 %37)
%39 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%40 = call i32* @new_form(i32** %39)
store i32* %40, i32** %3
%41 = load i32*, i32** %3
%42 = call i32 @scale_form(i32* %41, i32* %6, i32* %7)
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 4
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 4
%47 = call i32* @newwin(i32 %44, i32 %46, i32 4, i32 4)
store i32* %47, i32** %4
%48 = load i32*, i32** %4
%49 = load i32, i32* @TRUE
%50 = call i32 @keypad(i32* %48, i32 %49)
%51 = load i32*, i32** %3
%52 = load i32*, i32** %4
%53 = call i32 @set_form_win(i32* %51, i32* %52)
%54 = load i32*, i32** %3
%55 = load i32*, i32** %4
%56 = load i32, i32* %6
%57 = load i32, i32* %7
%58 = call i32 @derwin(i32* %55, i32 %56, i32 %57, i32 2, i32 2)
%59 = call i32 @set_form_sub(i32* %54, i32 %58)
%60 = load i32*, i32** %4
%61 = call i32 @box(i32* %60, i32 0, i32 0)
%62 = load i32*, i32** %4
%63 = load i32, i32* %7
%64 = add nsw i32 %63, 4
%65 = call i32 @COLOR_PAIR(i32 1)
%66 = call i32 @print_in_middle(i32* %62, i32 1, i32 0, i32 %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %65)
%67 = load i32*, i32** %3
%68 = call i32 @post_form(i32* %67)
%69 = load i32*, i32** %4
%70 = call i32 @wrefresh(i32* %69)
%71 = load i64, i64* @LINES
%72 = sub nsw i64 %71, 2
%73 = call i32 @mvprintw(i64 %72, i32 0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%74 = call i32 (...) @refresh()
br label %75
75: ; preds = %100, %0
%76 = load i32*, i32** %4
%77 = call i32 @wgetch(i32* %76)
store i32 %77, i32* %5
%78 = call i32 @KEY_F(i32 1)
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %101
80: ; preds = %75
%81 = load i32, i32* %5
switch i32 %81, label %96 [
i32 129, label %82
i32 128, label %89
]
82: ; preds = %80
%83 = load i32*, i32** %3
%84 = load i32, i32* @REQ_NEXT_FIELD
%85 = call i32 @form_driver(i32* %83, i32 %84)
%86 = load i32*, i32** %3
%87 = load i32, i32* @REQ_END_LINE
%88 = call i32 @form_driver(i32* %86, i32 %87)
br label %100
89: ; preds = %80
%90 = load i32*, i32** %3
%91 = load i32, i32* @REQ_PREV_FIELD
%92 = call i32 @form_driver(i32* %90, i32 %91)
%93 = load i32*, i32** %3
%94 = load i32, i32* @REQ_END_LINE
%95 = call i32 @form_driver(i32* %93, i32 %94)
br label %100
96: ; preds = %80
%97 = load i32*, i32** %3
%98 = load i32, i32* %5
%99 = call i32 @form_driver(i32* %97, i32 %98)
br label %100
100: ; preds = %96, %89, %82
br label %75
101: ; preds = %75
%102 = load i32*, i32** %3
%103 = call i32 @unpost_form(i32* %102)
%104 = load i32*, i32** %3
%105 = call i32 @free_form(i32* %104)
%106 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%107 = load i32*, i32** %106
%108 = call i32 @free_field(i32* %107)
%109 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
%110 = load i32*, i32** %109
%111 = call i32 @free_field(i32* %110)
%112 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32* null
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@A_UNDERLINE = global i32 0
@O_AUTOSKIP = global i32 0
@.str = [8 x i8] c"My Form\00"
@LINES = global i64 0
@.str.1 = [49 x i8] c"Use UP, DOWN arrow keys to switch between fields\00"
@REQ_NEXT_FIELD = global i32 0
@REQ_END_LINE = global i32 0
@REQ_PREV_FIELD = global i32 0
define i32 @main() {
%1 = alloca [3 x i32*]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [3 x i32*]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (...) @initscr()
%8 = tail call i32 (...) @start_color()
%9 = tail call i32 (...) @cbreak()
%10 = tail call i32 (...) @noecho()
%11 = load i32*, i32** @stdscr
%12 = load i32, i32* @TRUE
%13 = tail call i32 @keypad(i32* %11, i32 %12)
%14 = load i32, i32* @COLOR_RED
%15 = load i32, i32* @COLOR_BLACK
%16 = tail call i32 @init_pair(i32 1, i32 %14, i32 %15)
%17 = tail call i32* @new_field(i32 1, i32 10, i32 6, i32 1, i32 0, i32 0)
%18 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
store i32* %17, i32** %18
%19 = tail call i32* @new_field(i32 1, i32 10, i32 8, i32 1, i32 0, i32 0)
%20 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 1
store i32* %19, i32** %20
%21 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 2
store i32* null, i32** %21
%22 = load i32, i32* @A_UNDERLINE
%23 = tail call i32 @set_field_back(i32* %17, i32 %22)
%24 = load i32, i32* @O_AUTOSKIP
%25 = tail call i32 @field_opts_off(i32* %17, i32 %24)
%26 = load i32, i32* @A_UNDERLINE
%27 = tail call i32 @set_field_back(i32* %19, i32 %26)
%28 = load i32, i32* @O_AUTOSKIP
%29 = tail call i32 @field_opts_off(i32* %19, i32 %28)
%30 = call i32* @new_form(i32** %18)
%31 = call i32 @scale_form(i32* %30, i32* %2, i32* %3)
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 4
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 4
%36 = call i32* @newwin(i32 %33, i32 %35, i32 4, i32 4)
%37 = load i32, i32* @TRUE
%38 = call i32 @keypad(i32* %36, i32 %37)
%39 = call i32 @set_form_win(i32* %30, i32* %36)
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = call i32 @derwin(i32* %36, i32 %40, i32 %41, i32 2, i32 2)
%43 = call i32 @set_form_sub(i32* %30, i32 %42)
%44 = call i32 @box(i32* %36, i32 0, i32 0)
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 4
%47 = call i32 @COLOR_PAIR(i32 1)
%48 = call i32 @print_in_middle(i32* %36, i32 1, i32 0, i32 %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = call i32 @post_form(i32* %30)
%50 = call i32 @wrefresh(i32* %36)
%51 = load i64, i64* @LINES
%52 = add nsw i64 %51, -2
%53 = call i32 @mvprintw(i64 %52, i32 0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%54 = call i32 (...) @refresh()
%55 = call i32 @wgetch(i32* %36)
%56 = call i32 @KEY_F(i32 1)
%57 = icmp eq i32 %55, %56
br i1 %57, label %72, label %58
58: ; preds = %0, %66
%59 = phi i32 [ %69, %66 ], [ %55, %0 ]
switch i32 %59, label %66 [
i32 129, label %61
i32 128, label %60
]
60: ; preds = %58
br label %61
61: ; preds = %58, %60
%62 = phi i32* [ @REQ_PREV_FIELD, %60 ], [ @REQ_NEXT_FIELD, %58 ]
%63 = load i32, i32* %62
%64 = call i32 @form_driver(i32* %30, i32 %63)
%65 = load i32, i32* @REQ_END_LINE
br label %66
66: ; preds = %61, %58
%67 = phi i32 [ %59, %58 ], [ %65, %61 ]
%68 = call i32 @form_driver(i32* %30, i32 %67)
%69 = call i32 @wgetch(i32* %36)
%70 = call i32 @KEY_F(i32 1)
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %58
72: ; preds = %66, %0
%73 = call i32 @unpost_form(i32* %30)
%74 = call i32 @free_form(i32* %30)
%75 = load i32*, i32** %18
%76 = call i32 @free_field(i32* %75)
%77 = load i32*, i32** %20
%78 = call i32 @free_field(i32* %77)
%79 = call i32 (...) @endwin()
ret i32 0
}