#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 */
struct node {
  int dummy;
};
struct boot_option {
  int dummy;
};
typedef int /*<<< orphan*/ MENU;
typedef int /*<<< orphan*/ ITEM;

/* Variables and functions */
int /*<<< orphan*/ COLOR_BLACK;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ COLOR_RED;
#define KEY_DOWN 129
int KEY_F(int);
#define KEY_UP 128
int O_SELECTABLE;
int /*<<< orphan*/ REQ_DOWN_ITEM;
int /*<<< orphan*/ REQ_UP_ITEM;
int /*<<< orphan*/ TRUE;
char *add_to_string(char *, int, char *, char *);
int /*<<< orphan*/ *build_menu(int, struct boot_option **);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ clrtoeol();
int /*<<< orphan*/ *current_item(int /*<<< orphan*/ *);
int /*<<< orphan*/ delete_configuration(struct node **, struct boot_option *,
                                        char *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ free_boot_option(struct boot_option *);
int /*<<< orphan*/ free_item(int /*<<< orphan*/ *);
int /*<<< orphan*/ free_menu(int /*<<< orphan*/ *);
int get_boot_options_list(struct boot_option ***, struct node *);
int getch();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
char *item_name(int /*<<< orphan*/ *);
int item_opts(int /*<<< orphan*/ *);
int /*<<< orphan*/ item_opts_off(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ item_opts_on(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ menu_driver(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ **menu_items(int /*<<< orphan*/ *);
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(int, int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ output_config_file(struct node *, char *);
struct node *parse_config_file(char *);
int /*<<< orphan*/ pos_menu_cursor(int /*<<< orphan*/ *);
struct boot_option **realloc(struct boot_option **, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ unpost_menu(int /*<<< orphan*/ *);
int /*<<< orphan*/ update_menu(int /*<<< orphan*/ *, int, int /*<<< orphan*/ **,
                               struct boot_option **);
int main(void) {
  struct boot_option **boot_options = NULL;
  char *config_file = NULL;
  config_file =
      add_to_string(config_file, 2, "/boot", "/syslinux/syslinux.cfg");
  struct node *head = parse_config_file(config_file);
  int size = get_boot_options_list(&boot_options, head);
  initscr();
  start_color();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
  MENU *my_menu = build_menu(size, boot_options);
  ITEM **my_items = menu_items(my_menu);
  refresh();
  struct boot_option **to_delete_array;
  int num_indexes;
  int c;
  while ((c = getch()) != KEY_F(1)) {
    switch (c) {
    case KEY_DOWN:
      menu_driver(my_menu, REQ_DOWN_ITEM);
      break;
    case 'j':
      menu_driver(my_menu, REQ_DOWN_ITEM);
      break;
    case KEY_UP:
      menu_driver(my_menu, REQ_UP_ITEM);
      break;
    case 'k':
      menu_driver(my_menu, REQ_UP_ITEM);
      break;
    case 10:
      move(20, 0);
      clrtoeol();
      const char *selected = item_name(current_item(my_menu));
      if (strcmp(selected, "Exit") == 0)
        goto exit;
      mvprintw(20, 0, "Item selected is : %s", selected);
      pos_menu_cursor(my_menu);
      break;
    case 'd':
      if ((O_SELECTABLE & item_opts(current_item(my_menu))) == O_SELECTABLE) {
        item_opts_off(current_item(my_menu), O_SELECTABLE);
      } else {
        item_opts_on(current_item(my_menu), O_SELECTABLE);
      }
      break;
    case 'a':
      to_delete_array = NULL;
      num_indexes = 0;
      for (int i = 0; i < size; i++) {
        if ((O_SELECTABLE & item_opts(my_items[i])) != O_SELECTABLE) {
          to_delete_array = realloc(
              to_delete_array, ++num_indexes * sizeof(struct boot_option *));
          to_delete_array[num_indexes - 1] = boot_options[i];
        }
      }
      for (int i = num_indexes - 1; i >= 0; i--) {
        delete_configuration(&head, to_delete_array[i], "/boot");
        size = get_boot_options_list(&boot_options, head);
      }
      update_menu(my_menu, size, my_items, boot_options);
      refresh();
      output_config_file(head, config_file);
      break;
    case 'q':
      goto exit;
    }
  }
exit:
  unpost_menu(my_menu);
  for (int i = 0; i < size; i++) {
    free_item(my_items[i]);
    free_boot_option(boot_options[i]);
  }
  free(boot_options);
  free_menu(my_menu);
  endwin();
  free(config_file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
lea    0xca1(%rip),%rdx
lea    0xca0(%rip),%rcx
call   1140 <add_to_string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1250 <parse_config_file@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1040 <get_boot_options_list@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   10c0 <initscr@plt>
mov    $0x0,%al
call   10d0 <start_color@plt>
mov    $0x0,%al
call   1070 <cbreak@plt>
mov    $0x0,%al
call   1200 <noecho@plt>
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
mov    0x2c28(%rip),%rax
mov    (%rax),%esi
call   10b0 <keypad@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%esi
mov    0x2c09(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   10a0 <init_pair@plt>
mov    0x2be6(%rip),%rax
mov    (%rax),%esi
mov    0x2bed(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   10a0 <init_pair@plt>
mov    0x2bba(%rip),%rax
mov    (%rax),%esi
mov    0x2bd1(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   10a0 <init_pair@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <build_menu@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   11a0 <menu_items@plt>
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1180 <refresh@plt>
mov    $0x0,%al
call   1190 <getch@plt>
mov    %eax,-0x60(%rbp)
mov    %eax,-0x48(%rbp)
mov    $0x1,%edi
call   1100 <KEY_F@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
cmp    %ecx,%eax
je     1749 <main+0x419>
mov    -0x48(%rbp),%eax
mov    %eax,-0x64(%rbp)
sub    $0xa,%eax
je     1546 <main+0x216>
jmp    146f <main+0x13f>
mov    -0x64(%rbp),%eax
sub    $0x61,%eax
je     1622 <main+0x2f2>
jmp    1480 <main+0x150>
mov    -0x64(%rbp),%eax
sub    $0x64,%eax
je     15b1 <main+0x281>
jmp    1491 <main+0x161>
mov    -0x64(%rbp),%eax
sub    $0x6a,%eax
je     1501 <main+0x1d1>
jmp    14a2 <main+0x172>
mov    -0x64(%rbp),%eax
sub    $0x6b,%eax
je     152f <main+0x1ff>
jmp    14b3 <main+0x183>
mov    -0x64(%rbp),%eax
sub    $0x71,%eax
je     173f <main+0x40f>
jmp    14c4 <main+0x194>
mov    -0x64(%rbp),%eax
sub    $0x80,%eax
je     1518 <main+0x1e8>
jmp    14d7 <main+0x1a7>
mov    -0x64(%rbp),%eax
sub    $0x81,%eax
jne    1744 <main+0x414>
jmp    14ea <main+0x1ba>
mov    -0x30(%rbp),%rdi
mov    0x2ab3(%rip),%rax
mov    (%rax),%esi
call   1090 <menu_driver@plt>
jmp    1744 <main+0x414>
mov    -0x30(%rbp),%rdi
mov    0x2a9c(%rip),%rax
mov    (%rax),%esi
call   1090 <menu_driver@plt>
jmp    1744 <main+0x414>
mov    -0x30(%rbp),%rdi
mov    0x2a8d(%rip),%rax
mov    (%rax),%esi
call   1090 <menu_driver@plt>
jmp    1744 <main+0x414>
mov    -0x30(%rbp),%rdi
mov    0x2a76(%rip),%rax
mov    (%rax),%esi
call   1090 <menu_driver@plt>
jmp    1744 <main+0x414>
mov    $0x14,%edi
xor    %esi,%esi
call   1240 <move@plt>
mov    $0x0,%al
call   11e0 <clrtoeol@plt>
mov    -0x30(%rbp),%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
call   1160 <item_name@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
lea    0xaa4(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    158c <main+0x25c>
jmp    174e <main+0x41e>
mov    -0x50(%rbp),%rcx
mov    $0x14,%edi
xor    %esi,%esi
lea    0xa84(%rip),%rdx
call   1230 <mvprintw@plt>
mov    -0x30(%rbp),%rdi
call   11d0 <pos_menu_cursor@plt>
jmp    1744 <main+0x414>
mov    0x2a18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
call   11f0 <item_opts@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
and    %ecx,%eax
mov    0x29f4(%rip),%rcx
cmp    (%rcx),%eax
jne    1603 <main+0x2d3>
mov    -0x30(%rbp),%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
mov    0x29d9(%rip),%rax
mov    (%rax),%esi
call   1220 <item_opts_off@plt>
jmp    161d <main+0x2ed>
mov    -0x30(%rbp),%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
mov    0x29ba(%rip),%rax
mov    (%rax),%esi
call   1110 <item_opts_on@plt>
jmp    1744 <main+0x414>
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    16c5 <main+0x395>
mov    0x2985(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   11f0 <item_opts@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
and    %ecx,%eax
mov    0x2961(%rip),%rcx
cmp    (%rcx),%eax
je     16b2 <main+0x382>
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1170 <realloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    16b7 <main+0x387>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1638 <main+0x308>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x58(%rbp)
cmpl   $0x0,-0x58(%rbp)
jl     1712 <main+0x3e2>
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x20(%rbp),%rdi
lea    0x911(%rip),%rdx
call   1120 <delete_configuration@plt>
mov    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1040 <get_boot_options_list@plt>
mov    %eax,-0x24(%rbp)
mov    -0x58(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x58(%rbp)
jmp    16ce <main+0x39e>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x10(%rbp),%rcx
call   11c0 <update_menu@plt>
mov    $0x0,%al
call   1180 <refresh@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1210 <output_config_file@plt>
jmp    1744 <main+0x414>
jmp    174e <main+0x41e>
jmp    1437 <main+0x107>
jmp    174e <main+0x41e>
mov    -0x30(%rbp),%rdi
call   1080 <unpost_menu@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    179a <main+0x46a>
mov    -0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <free_item@plt>
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1150 <free_boot_option@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    175e <main+0x42e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   10f0 <free_menu@plt>
mov    $0x0,%al
call   11b0 <endwin@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movq   $0x0,0x8(%rsp)
lea    0xd36(%rip),%rdx
lea    0xd35(%rip),%rcx
xor    %edi,%edi
mov    $0x2,%esi
call   1140 <add_to_string@plt>
mov    %rax,0x28(%rsp)
mov    %rax,%rdi
call   1250 <parse_config_file@plt>
mov    %rax,0x10(%rsp)
lea    0x8(%rsp),%rdi
mov    %rax,%rsi
call   1040 <get_boot_options_list@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   10c0 <initscr@plt>
xor    %eax,%eax
call   10d0 <start_color@plt>
xor    %eax,%eax
call   1070 <cbreak@plt>
xor    %eax,%eax
call   1200 <noecho@plt>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
mov    0x2c31(%rip),%rax
mov    (%rax),%esi
call   10b0 <keypad@plt>
mov    0x2be3(%rip),%rax
mov    (%rax),%esi
mov    0x2c12(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
call   10a0 <init_pair@plt>
mov    0x2bef(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   10a0 <init_pair@plt>
mov    0x2bca(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   10a0 <init_pair@plt>
mov    0x8(%rsp),%rsi
mov    %r12d,%edi
call   1050 <build_menu@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   11a0 <menu_items@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1180 <refresh@plt>
xor    %eax,%eax
call   1190 <getch@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1100 <KEY_F@plt>
cmp    %eax,%ebx
jne    14a5 <main+0x175>
mov    %rbp,%r14
mov    %rbp,%rdi
call   1080 <unpost_menu@plt>
test   %r12d,%r12d
jle    1471 <main+0x141>
mov    %r12d,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,8),%rdi
call   10e0 <free_item@plt>
mov    0x8(%rsp),%rax
mov    (%rax,%rbp,8),%rdi
call   1150 <free_boot_option@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1450 <main+0x120>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   10f0 <free_menu@plt>
xor    %eax,%eax
call   11b0 <endwin@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb54(%rip),%r14
mov    %rbp,0x20(%rsp)
mov    %r13,0x30(%rsp)
jmp    14ec <main+0x1bc>
nopl   0x0(%rax,%rax,1)
mov    0x2ae1(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1090 <menu_driver@plt>
xor    %eax,%eax
call   1190 <getch@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1100 <KEY_F@plt>
cmp    %eax,%ebx
je     1435 <main+0x105>
lea    -0x61(%rbx),%eax
cmp    $0x20,%eax
ja     1506 <main+0x1d6>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x2aac(%rip),%rax
jmp    14c7 <main+0x197>
cmp    $0xa,%ebx
jne    14d1 <main+0x1a1>
mov    $0x14,%edi
xor    %esi,%esi
call   1240 <move@plt>
xor    %eax,%eax
call   11e0 <clrtoeol@plt>
mov    %rbp,%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
call   1160 <item_name@plt>
mov    %rax,%rbx
mov    %rax,%rdi
lea    0xb66(%rip),%rsi
call   1130 <strcmp@plt>
test   %eax,%eax
je     1435 <main+0x105>
mov    $0x14,%edi
xor    %esi,%esi
lea    0xb50(%rip),%rdx
mov    %rbx,%rcx
call   1230 <mvprintw@plt>
mov    %rbp,%rdi
call   11d0 <pos_menu_cursor@plt>
jmp    14d1 <main+0x1a1>
test   %r12d,%r12d
jle    16a2 <main+0x372>
mov    %r12d,0x1c(%rsp)
mov    %r12d,%ebp
mov    0x2a4d(%rip),%rax
mov    (%rax),%r12d
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    15b0 <main+0x280>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    %eax,%r12d
cmp    %r15,%rbp
je     1644 <main+0x314>
mov    0x30(%rsp),%rax
mov    (%rax,%r15,8),%rdi
call   11f0 <item_opts@plt>
and    %r12d,%eax
mov    0x2a08(%rip),%rbx
cmp    (%rbx),%eax
je     15a0 <main+0x270>
mov    %rbp,%r12
lea    0x1(%r14),%ebp
lea    0x8(,%r14,8),%esi
mov    %r13,%rdi
call   1170 <realloc@plt>
mov    %rax,%r13
mov    0x8(%rsp),%rax
mov    (%rax,%r15,8),%rax
movslq %r14d,%rcx
mov    %rax,0x0(%r13,%rcx,8)
mov    (%rbx),%eax
mov    %ebp,%r14d
mov    %r12,%rbp
jmp    15a0 <main+0x270>
mov    0x29c8(%rip),%r15
mov    (%r15),%r14d
mov    %rbp,%rdi
call   1060 <current_item@plt>
mov    %rax,%rdi
call   11f0 <item_opts@plt>
mov    %eax,%ebx
and    %r14d,%ebx
mov    (%r15),%r14d
mov    %rbp,%rdi
call   1060 <current_item@plt>
mov    (%r15),%esi
mov    %rax,%rdi
cmp    %r14d,%ebx
jne    16d2 <main+0x3a2>
call   1220 <item_opts_off@plt>
jmp    16d7 <main+0x3a7>
test   %r14d,%r14d
mov    0x1c(%rsp),%r12d
mov    0x20(%rsp),%rbp
jle    16a2 <main+0x372>
mov    %r14d,%ebx
add    $0x1,%rbx
lea    0xa23(%rip),%r14
lea    0x10(%rsp),%rbp
lea    0x8(%rsp),%r15
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    0x0(%r13,%rax,8),%rsi
mov    %rbp,%rdi
mov    %r14,%rdx
call   1120 <delete_configuration@plt>
mov    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1040 <get_boot_options_list@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1670 <main+0x340>
mov    %eax,%r12d
mov    0x20(%rsp),%rbp
mov    0x8(%rsp),%rcx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    0x30(%rsp),%r13
mov    %r13,%rdx
call   11c0 <update_menu@plt>
xor    %eax,%eax
call   1180 <refresh@plt>
mov    0x10(%rsp),%rdi
mov    0x28(%rsp),%rsi
call   1210 <output_config_file@plt>
jmp    16d7 <main+0x3a7>
call   1110 <item_opts_on@plt>
lea    0x922(%rip),%r14
jmp    14d1 <main+0x1a1>

LLVM IR (-O0):
%struct.boot_option = type { i32 }
%struct.node = type { i32 }
@.str = [6 x i8] c"/boot\00"
@.str.1 = [23 x i8] c"/syslinux/syslinux.cfg\00"
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_MAGENTA = global i32 0
@REQ_DOWN_ITEM = global i32 0
@REQ_UP_ITEM = global i32 0
@.str.2 = [5 x i8] c"Exit\00"
@.str.3 = [22 x i8] c"Item selected is : %s\00"
@O_SELECTABLE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.boot_option**
%3 = alloca i8*
%4 = alloca %struct.node*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32**
%8 = alloca %struct.boot_option**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
store %struct.boot_option** null, %struct.boot_option*** %2
store i8* null, i8** %3
%15 = load i8*, i8** %3
%16 = call i8* @add_to_string(i8* %15, i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = call %struct.node* @parse_config_file(i8* %17)
store %struct.node* %18, %struct.node** %4
%19 = load %struct.node*, %struct.node** %4
%20 = call i32 @get_boot_options_list(%struct.boot_option*** %2, %struct.node* %19)
store i32 %20, i32* %5
%21 = call i32 (...) @initscr()
%22 = call i32 (...) @start_color()
%23 = call i32 (...) @cbreak()
%24 = call i32 (...) @noecho()
%25 = load i32, i32* @stdscr
%26 = load i32, i32* @TRUE
%27 = call i32 @keypad(i32 %25, i32 %26)
%28 = load i32, i32* @COLOR_RED
%29 = load i32, i32* @COLOR_BLACK
%30 = call i32 @init_pair(i32 1, i32 %28, i32 %29)
%31 = load i32, i32* @COLOR_GREEN
%32 = load i32, i32* @COLOR_BLACK
%33 = call i32 @init_pair(i32 2, i32 %31, i32 %32)
%34 = load i32, i32* @COLOR_MAGENTA
%35 = load i32, i32* @COLOR_BLACK
%36 = call i32 @init_pair(i32 3, i32 %34, i32 %35)
%37 = load i32, i32* %5
%38 = load %struct.boot_option**, %struct.boot_option*** %2
%39 = call i32* @build_menu(i32 %37, %struct.boot_option** %38)
store i32* %39, i32** %6
%40 = load i32*, i32** %6
%41 = call i32** @menu_items(i32* %40)
store i32** %41, i32*** %7
%42 = call i32 (...) @refresh()
br label %43
43: ; preds = %166, %0
%44 = call i32 (...) @getch()
store i32 %44, i32* %10
%45 = call i32 @KEY_F(i32 1)
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %167
47: ; preds = %43
%48 = load i32, i32* %10
switch i32 %48, label %166 [
i32 129, label %49
i32 106, label %53
i32 128, label %57
i32 107, label %61
i32 10, label %65
i32 100, label %80
i32 97, label %99
i32 113, label %165
]
49: ; preds = %47
%50 = load i32*, i32** %6
%51 = load i32, i32* @REQ_DOWN_ITEM
%52 = call i32 @menu_driver(i32* %50, i32 %51)
br label %166
53: ; preds = %47
%54 = load i32*, i32** %6
%55 = load i32, i32* @REQ_DOWN_ITEM
%56 = call i32 @menu_driver(i32* %54, i32 %55)
br label %166
57: ; preds = %47
%58 = load i32*, i32** %6
%59 = load i32, i32* @REQ_UP_ITEM
%60 = call i32 @menu_driver(i32* %58, i32 %59)
br label %166
61: ; preds = %47
%62 = load i32*, i32** %6
%63 = load i32, i32* @REQ_UP_ITEM
%64 = call i32 @menu_driver(i32* %62, i32 %63)
br label %166
65: ; preds = %47
%66 = call i32 @move(i32 20, i32 0)
%67 = call i32 (...) @clrtoeol()
%68 = load i32*, i32** %6
%69 = call i32* @current_item(i32* %68)
%70 = call i8* @item_name(i32* %69)
store i8* %70, i8** %11
%71 = load i8*, i8** %11
%72 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %65
br label %168
75: ; preds = %65
%76 = load i8*, i8** %11
%77 = call i32 @mvprintw(i32 20, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %76)
%78 = load i32*, i32** %6
%79 = call i32 @pos_menu_cursor(i32* %78)
br label %166
80: ; preds = %47
%81 = load i32, i32* @O_SELECTABLE
%82 = load i32*, i32** %6
%83 = call i32* @current_item(i32* %82)
%84 = call i32 @item_opts(i32* %83)
%85 = and i32 %81, %84
%86 = load i32, i32* @O_SELECTABLE
%87 = icmp eq i32 %85, %86
br i1 %87, label %88, label %93
88: ; preds = %80
%89 = load i32*, i32** %6
%90 = call i32* @current_item(i32* %89)
%91 = load i32, i32* @O_SELECTABLE
%92 = call i32 @item_opts_off(i32* %90, i32 %91)
br label %98
93: ; preds = %80
%94 = load i32*, i32** %6
%95 = call i32* @current_item(i32* %94)
%96 = load i32, i32* @O_SELECTABLE
%97 = call i32 @item_opts_on(i32* %95, i32 %96)
br label %98
98: ; preds = %93, %88
br label %166
99: ; preds = %47
store %struct.boot_option** null, %struct.boot_option*** %8
store i32 0, i32* %9
store i32 0, i32* %12
br label %100
100: ; preds = %134, %99
%101 = load i32, i32* %12
%102 = load i32, i32* %5
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %137
104: ; preds = %100
%105 = load i32, i32* @O_SELECTABLE
%106 = load i32**, i32*** %7
%107 = load i32, i32* %12
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32*, i32** %106, i64 %108
%110 = load i32*, i32** %109
%111 = call i32 @item_opts(i32* %110)
%112 = and i32 %105, %111
%113 = load i32, i32* @O_SELECTABLE
%114 = icmp ne i32 %112, %113
br i1 %114, label %115, label %133
115: ; preds = %104
%116 = load %struct.boot_option**, %struct.boot_option*** %8
%117 = load i32, i32* %9
%118 = add nsw i32 %117, 1
store i32 %118, i32* %9
%119 = sext i32 %118 to i64
%120 = mul i64 %119, 8
%121 = trunc i64 %120 to i32
%122 = call %struct.boot_option** @realloc(%struct.boot_option** %116, i32 %121)
store %struct.boot_option** %122, %struct.boot_option*** %8
%123 = load %struct.boot_option**, %struct.boot_option*** %2
%124 = load i32, i32* %12
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %123, i64 %125
%127 = load %struct.boot_option*, %struct.boot_option** %126
%128 = load %struct.boot_option**, %struct.boot_option*** %8
%129 = load i32, i32* %9
%130 = sub nsw i32 %129, 1
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %128, i64 %131
store %struct.boot_option* %127, %struct.boot_option** %132
br label %133
133: ; preds = %115, %104
br label %134
134: ; preds = %133
%135 = load i32, i32* %12
%136 = add nsw i32 %135, 1
store i32 %136, i32* %12
br label %100
137: ; preds = %100
%138 = load i32, i32* %9
%139 = sub nsw i32 %138, 1
store i32 %139, i32* %13
br label %140
140: ; preds = %152, %137
%141 = load i32, i32* %13
%142 = icmp sge i32 %141, 0
br i1 %142, label %143, label %155
143: ; preds = %140
%144 = load %struct.boot_option**, %struct.boot_option*** %8
%145 = load i32, i32* %13
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %144, i64 %146
%148 = load %struct.boot_option*, %struct.boot_option** %147
%149 = call i32 @delete_configuration(%struct.node** %4, %struct.boot_option* %148, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%150 = load %struct.node*, %struct.node** %4
%151 = call i32 @get_boot_options_list(%struct.boot_option*** %2, %struct.node* %150)
store i32 %151, i32* %5
br label %152
152: ; preds = %143
%153 = load i32, i32* %13
%154 = add nsw i32 %153, -1
store i32 %154, i32* %13
br label %140
155: ; preds = %140
%156 = load i32*, i32** %6
%157 = load i32, i32* %5
%158 = load i32**, i32*** %7
%159 = load %struct.boot_option**, %struct.boot_option*** %2
%160 = call i32 @update_menu(i32* %156, i32 %157, i32** %158, %struct.boot_option** %159)
%161 = call i32 (...) @refresh()
%162 = load %struct.node*, %struct.node** %4
%163 = load i8*, i8** %3
%164 = call i32 @output_config_file(%struct.node* %162, i8* %163)
br label %166
165: ; preds = %47
br label %168
166: ; preds = %47, %155, %98, %75, %61, %57, %53, %49
br label %43
167: ; preds = %43
br label %168
168: ; preds = %167, %165, %74
%169 = load i32*, i32** %6
%170 = call i32 @unpost_menu(i32* %169)
store i32 0, i32* %14
br label %171
171: ; preds = %188, %168
%172 = load i32, i32* %14
%173 = load i32, i32* %5
%174 = icmp slt i32 %172, %173
br i1 %174, label %175, label %191
175: ; preds = %171
%176 = load i32**, i32*** %7
%177 = load i32, i32* %14
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i32*, i32** %176, i64 %178
%180 = load i32*, i32** %179
%181 = call i32 @free_item(i32* %180)
%182 = load %struct.boot_option**, %struct.boot_option*** %2
%183 = load i32, i32* %14
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %182, i64 %184
%186 = load %struct.boot_option*, %struct.boot_option** %185
%187 = call i32 @free_boot_option(%struct.boot_option* %186)
br label %188
188: ; preds = %175
%189 = load i32, i32* %14
%190 = add nsw i32 %189, 1
store i32 %190, i32* %14
br label %171
191: ; preds = %171
%192 = load %struct.boot_option**, %struct.boot_option*** %2
%193 = bitcast %struct.boot_option** %192 to i8*
%194 = call i32 @free(i8* %193)
%195 = load i32*, i32** %6
%196 = call i32 @free_menu(i32* %195)
%197 = call i32 (...) @endwin()
%198 = load i8*, i8** %3
%199 = call i32 @free(i8* %198)
ret i32 0
}

LLVM IR (-O2):
%struct.boot_option = type { i32 }
%struct.node = type { i32 }
@.str = [6 x i8] c"/boot\00"
@.str.1 = [23 x i8] c"/syslinux/syslinux.cfg\00"
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_MAGENTA = global i32 0
@REQ_DOWN_ITEM = global i32 0
@REQ_UP_ITEM = global i32 0
@.str.2 = [5 x i8] c"Exit\00"
@.str.3 = [22 x i8] c"Item selected is : %s\00"
@O_SELECTABLE = global i32 0
define i32 @main() {
%1 = alloca %struct.boot_option**
%2 = alloca %struct.node*
%3 = bitcast %struct.boot_option*** %1 to i8*
store %struct.boot_option** null, %struct.boot_option*** %1
%4 = tail call i8* @add_to_string(i8* null, i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast %struct.node** %2 to i8*
%6 = tail call %struct.node* @parse_config_file(i8* %4)
store %struct.node* %6, %struct.node** %2
%7 = call i32 @get_boot_options_list(%struct.boot_option*** %1, %struct.node* %6)
%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 = load i32, i32* @COLOR_GREEN
%19 = load i32, i32* @COLOR_BLACK
%20 = call i32 @init_pair(i32 2, i32 %18, i32 %19)
%21 = load i32, i32* @COLOR_MAGENTA
%22 = load i32, i32* @COLOR_BLACK
%23 = call i32 @init_pair(i32 3, i32 %21, i32 %22)
%24 = load %struct.boot_option**, %struct.boot_option*** %1
%25 = call i32* @build_menu(i32 %7, %struct.boot_option** %24)
%26 = call i32** @menu_items(i32* %25)
%27 = call i32 (...) @refresh()
%28 = call i32 (...) @getch()
%29 = call i32 @KEY_F(i32 1)
%30 = icmp eq i32 %28, %29
br i1 %30, label %127, label %31
31: ; preds = %0, %122
%32 = phi i32 [ %124, %122 ], [ %28, %0 ]
%33 = phi i32 [ %123, %122 ], [ %7, %0 ]
switch i32 %32, label %122 [
i32 129, label %39
i32 106, label %42
i32 128, label %45
i32 107, label %48
i32 10, label %51
i32 100, label %61
i32 97, label %34
i32 113, label %127
]
34: ; preds = %31
%35 = icmp sgt i32 %33, 0
br i1 %35, label %36, label %105
36: ; preds = %34
%37 = zext i32 %33 to i64
%38 = load i32, i32* @O_SELECTABLE
br label %78
39: ; preds = %31
%40 = load i32, i32* @REQ_DOWN_ITEM
%41 = call i32 @menu_driver(i32* %25, i32 %40)
br label %122
42: ; preds = %31
%43 = load i32, i32* @REQ_DOWN_ITEM
%44 = call i32 @menu_driver(i32* %25, i32 %43)
br label %122
45: ; preds = %31
%46 = load i32, i32* @REQ_UP_ITEM
%47 = call i32 @menu_driver(i32* %25, i32 %46)
br label %122
48: ; preds = %31
%49 = load i32, i32* @REQ_UP_ITEM
%50 = call i32 @menu_driver(i32* %25, i32 %49)
br label %122
51: ; preds = %31
%52 = call i32 @move(i32 20, i32 0)
%53 = call i32 (...) @clrtoeol()
%54 = call i32* @current_item(i32* %25)
%55 = call i8* @item_name(i32* %54)
%56 = call i32 @strcmp(i8* dereferenceable(1) %55, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%57 = icmp eq i32 %56, 0
br i1 %57, label %127, label %58
58: ; preds = %51
%59 = call i32 @mvprintw(i32 20, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%60 = call i32 @pos_menu_cursor(i32* %25)
br label %122
61: ; preds = %31
%62 = load i32, i32* @O_SELECTABLE
%63 = call i32* @current_item(i32* %25)
%64 = call i32 @item_opts(i32* %63)
%65 = and i32 %64, %62
%66 = load i32, i32* @O_SELECTABLE
%67 = icmp eq i32 %65, %66
%68 = call i32* @current_item(i32* %25)
%69 = load i32, i32* @O_SELECTABLE
br i1 %67, label %70, label %72
70: ; preds = %61
%71 = call i32 @item_opts_off(i32* %68, i32 %69)
br label %122
72: ; preds = %61
%73 = call i32 @item_opts_on(i32* %68, i32 %69)
br label %122
74: ; preds = %99
%75 = icmp sgt i32 %102, 0
br i1 %75, label %76, label %105
76: ; preds = %74
%77 = zext i32 %102 to i64
br label %112
78: ; preds = %36, %99
%79 = phi i32 [ %38, %36 ], [ %100, %99 ]
%80 = phi i64 [ 0, %36 ], [ %103, %99 ]
%81 = phi i32 [ 0, %36 ], [ %102, %99 ]
%82 = phi %struct.boot_option** [ null, %36 ], [ %101, %99 ]
%83 = getelementptr inbounds i32*, i32** %26, i64 %80
%84 = load i32*, i32** %83
%85 = call i32 @item_opts(i32* %84)
%86 = and i32 %85, %79
%87 = load i32, i32* @O_SELECTABLE
%88 = icmp eq i32 %86, %87
br i1 %88, label %99, label %89
89: ; preds = %78
%90 = add nsw i32 %81, 1
%91 = shl i32 %90, 3
%92 = call %struct.boot_option** @realloc(%struct.boot_option** %82, i32 %91)
%93 = load %struct.boot_option**, %struct.boot_option*** %1
%94 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %93, i64 %80
%95 = load %struct.boot_option*, %struct.boot_option** %94
%96 = sext i32 %81 to i64
%97 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %92, i64 %96
store %struct.boot_option* %95, %struct.boot_option** %97
%98 = load i32, i32* @O_SELECTABLE
br label %99
99: ; preds = %78, %89
%100 = phi i32 [ %98, %89 ], [ %86, %78 ]
%101 = phi %struct.boot_option** [ %92, %89 ], [ %82, %78 ]
%102 = phi i32 [ %90, %89 ], [ %81, %78 ]
%103 = add nuw nsw i64 %80, 1
%104 = icmp eq i64 %103, %37
br i1 %104, label %74, label %78
105: ; preds = %112, %34, %74
%106 = phi i32 [ %33, %74 ], [ %33, %34 ], [ %120, %112 ]
%107 = load %struct.boot_option**, %struct.boot_option*** %1
%108 = call i32 @update_menu(i32* %25, i32 %106, i32** %26, %struct.boot_option** %107)
%109 = call i32 (...) @refresh()
%110 = load %struct.node*, %struct.node** %2
%111 = call i32 @output_config_file(%struct.node* %110, i8* %4)
br label %122
112: ; preds = %76, %112
%113 = phi i64 [ %77, %76 ], [ %114, %112 ]
%114 = add nsw i64 %113, -1
%115 = and i64 %114, 4294967295
%116 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %101, i64 %115
%117 = load %struct.boot_option*, %struct.boot_option** %116
%118 = call i32 @delete_configuration(%struct.node** %2, %struct.boot_option* %117, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%119 = load %struct.node*, %struct.node** %2
%120 = call i32 @get_boot_options_list(%struct.boot_option*** %1, %struct.node* %119)
%121 = icmp ugt i64 %113, 1
br i1 %121, label %112, label %105
122: ; preds = %70, %72, %31, %105, %58, %48, %45, %42, %39
%123 = phi i32 [ %33, %31 ], [ %106, %105 ], [ %33, %70 ], [ %33, %72 ], [ %33, %58 ], [ %33, %48 ], [ %33, %45 ], [ %33, %42 ], [ %33, %39 ]
%124 = call i32 (...) @getch()
%125 = call i32 @KEY_F(i32 1)
%126 = icmp eq i32 %124, %125
br i1 %126, label %127, label %31
127: ; preds = %51, %31, %122, %0
%128 = phi i32 [ %7, %0 ], [ %123, %122 ], [ %33, %31 ], [ %33, %51 ]
%129 = call i32 @unpost_menu(i32* %25)
%130 = icmp sgt i32 %128, 0
br i1 %130, label %131, label %133
131: ; preds = %127
%132 = zext i32 %128 to i64
br label %140
133: ; preds = %140, %127
%134 = bitcast %struct.boot_option*** %1 to i8**
%135 = load i8*, i8** %134
%136 = call i32 @free(i8* %135)
%137 = call i32 @free_menu(i32* %25)
%138 = call i32 (...) @endwin()
%139 = call i32 @free(i8* %4)
ret i32 0
140: ; preds = %131, %140
%141 = phi i64 [ 0, %131 ], [ %149, %140 ]
%142 = getelementptr inbounds i32*, i32** %26, i64 %141
%143 = load i32*, i32** %142
%144 = call i32 @free_item(i32* %143)
%145 = load %struct.boot_option**, %struct.boot_option*** %1
%146 = getelementptr inbounds %struct.boot_option*, %struct.boot_option** %145, i64 %141
%147 = load %struct.boot_option*, %struct.boot_option** %146
%148 = call i32 @free_boot_option(%struct.boot_option* %147)
%149 = add nuw nsw i64 %141, 1
%150 = icmp eq i64 %149, %132
br i1 %150, label %133, label %140
}