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

/* Variables and functions */
int /*<<< orphan*/ b_getcur(int *, int *);
int /*<<< orphan*/ b_getmark(int *, int *);
int /*<<< orphan*/ b_gets(int, char *);
int /*<<< orphan*/ b_setcur(int, int);
int /*<<< orphan*/ b_setline(int);
int b_size();
int /*<<< orphan*/ do_up_down(int);
int /*<<< orphan*/ isspace(char);
char k_getch();
int /*<<< orphan*/ loc_char(char, int);
int /*<<< orphan*/ loc_string(char);
int /*<<< orphan*/ loc_word(int);
int s_firstline();
int s_lastline();
int strlen(char *);
void address(int n, char c, char op) {
  static int prev_line = 0, prev_pos, scroll_size = 12;
  int cur_line, cur_pos, direction, limit, line_addr, mark_line, mark_pos,
      new_line, new_pos;
  char ch, text[1000 - 1];
  if (n == 0 && c != 'g' && c != ('d' & 037) && c != ('u' & 037))
    n = 1;
  b_getcur(&cur_line, &cur_pos);
  line_addr = 0;
  switch (c) {
  case 'g':
    if (n == 0)
      n = b_size();
    line_addr = n;
    break;
  case 'H':
    line_addr = s_firstline() + n - 1;
    break;
  case 'L':
    line_addr = (s_lastline() - n + 1 > 1) ? s_lastline() - n + 1 : 1;
    break;
  case 'M':
    line_addr = (s_firstline() + s_lastline()) / 2;
    break;
  case '\r':
    line_addr = cur_line + n;
    break;
  case '-':
    line_addr = (cur_line - n > 1) ? cur_line - n : 1;
    break;
  case ('d' & 037):
    if (n != 0)
      scroll_size = n;
    line_addr = s_lastline() + scroll_size;
    break;
  case ('u' & 037):
    if (n != 0)
      scroll_size = n;
    line_addr =
        (s_firstline() - scroll_size > 1) ? s_firstline() - scroll_size : 1;
    break;
  case 'c':
  case 'd':
  case 'y':
    if (op == c)
      line_addr = cur_line + n - 1;
    break;
  case 'b':
    while (n-- > 0)
      loc_word(-1);
    if (op != ' ') {
      b_getcur(&new_line, &new_pos);
      if (new_line != cur_line)
        b_setcur(cur_line, 0);
    }
    break;
  case 'f':
  case 'F':
    direction = (c == 'f') ? 1 : -1;
    ch = k_getch();
    while (n-- > 0)
      loc_char(ch, direction);
    break;
  case 'h':
  case '\b':
    b_setcur(cur_line, (cur_pos - n > 0) ? cur_pos - n : 0);
    break;
  case 'j':
    do_up_down(n);
    break;
  case 'k':
    do_up_down(-n);
    break;
  case 'l':
  case ' ':
    b_gets(cur_line, text);
    limit = strlen(text) - 1;
    if (op != ' ')
      ++limit;
    b_setcur(cur_line, (cur_pos + n < limit) ? cur_pos + n : limit);
    break;
  case 'n':
    while (n-- > 0)
      loc_string('\0');
    break;
  case 'w':
    while (n-- > 0)
      loc_word(1);
    if (op != ' ') {
      b_getcur(&new_line, &new_pos);
      if (new_line != cur_line || new_pos == cur_pos) {
        b_gets(cur_line, text);
        b_setcur(cur_line, strlen(text));
      }
    }
    if (op == 'c') {
      b_getcur(&new_line, &new_pos);
      b_gets(new_line, text);
      while (new_pos > 0 && isspace(text[new_pos - 1]))
        --new_pos;
      b_setcur(new_line, new_pos);
    }
    break;
  case '0':
    b_setcur(cur_line, 0);
    break;
  case '$':
    new_line = cur_line + n - 1;
    b_gets(new_line, text);
    new_pos = strlen(text) - 1;
    if (op != ' ')
      ++new_pos;
    b_setcur(new_line, new_pos);
    break;
  case '\'':
    b_getmark(&mark_line, &mark_pos);
    if (mark_line == 0)
      break;
    b_setcur(mark_line, mark_pos);
    if (op != ' ')
      line_addr = mark_line;
    break;
  case '`':
    if (prev_line == 0)
      break;
    b_setcur(prev_line, prev_pos);
    if (op != ' ')
      line_addr = prev_line;
    break;
  case ';':
    while (n-- > 0)
      loc_char('\0', 0);
    break;
  case '\\':
  case '/':
    loc_string(c);
    while (n-- > 1)
      loc_string('\0');
    break;
  default:
    break;
  }
  if (line_addr > 0) {
    line_addr = (line_addr < b_size()) ? line_addr : b_size();
    if (op == ' ')
      b_setline(line_addr);
    else
      b_setcur(line_addr, -1);
  }
  if (op == ' ') {
    b_getcur(&new_line, &new_pos);
    if (new_line != cur_line || new_pos != cur_pos) {
      prev_line = cur_line;
      prev_pos = cur_pos;
    }
  } else if (op == 'c' || op == 'd')
    prev_line = 0;
}


x86 assembly (clang, -O0):
<address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %edi,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1241 <address+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0x67,%eax
je     1241 <address+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0x4,%eax
je     1241 <address+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0x15,%eax
je     1241 <address+0x51>
movl   $0x1,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1100 <b_getcur@plt>
movl   $0x0,-0x1c(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x428(%rbp)
sub    $0x75,%eax
ja     183d <address+0x64d>
mov    -0x428(%rbp),%rax
lea    0xd84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x4(%rbp)
jne    1299 <address+0xa9>
mov    $0x0,%al
call   10f0 <b_size@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
mov    $0x0,%al
call   1040 <s_firstline@plt>
add    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
mov    $0x0,%al
call   10e0 <s_lastline@plt>
sub    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x1,%eax
jle    12e7 <address+0xf7>
mov    $0x0,%al
call   10e0 <s_lastline@plt>
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    12f7 <address+0x107>
mov    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    12f7 <address+0x107>
mov    -0x42c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
mov    $0x0,%al
call   1040 <s_firstline@plt>
mov    %eax,-0x430(%rbp)
mov    $0x0,%al
call   10e0 <s_lastline@plt>
mov    %eax,%ecx
mov    -0x430(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
cmp    $0x1,%eax
jle    1361 <address+0x171>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x434(%rbp)
jmp    1371 <address+0x181>
mov    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    1371 <address+0x181>
mov    -0x434(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
cmpl   $0x0,-0x4(%rbp)
je     1392 <address+0x1a2>
mov    -0x4(%rbp),%eax
mov    %eax,0x2d06(%rip)
mov    $0x0,%al
call   10e0 <s_lastline@plt>
add    0x2cf9(%rip),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
cmpl   $0x0,-0x4(%rbp)
je     13ba <address+0x1ca>
mov    -0x4(%rbp),%eax
mov    %eax,0x2cde(%rip)
mov    $0x0,%al
call   1040 <s_firstline@plt>
sub    0x2cd1(%rip),%eax
cmp    $0x1,%eax
jle    13e8 <address+0x1f8>
mov    $0x0,%al
call   1040 <s_firstline@plt>
sub    0x2cbb(%rip),%eax
mov    %eax,-0x438(%rbp)
jmp    13f8 <address+0x208>
mov    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    13f8 <address+0x208>
mov    -0x438(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
movsbl -0x6(%rbp),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1422 <address+0x232>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
jmp    142c <address+0x23c>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    144f <address+0x25f>
mov    $0xffffffff,%edi
call   1030 <loc_word@plt>
jmp    142c <address+0x23c>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     1484 <address+0x294>
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1100 <b_getcur@plt>
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     147f <address+0x28f>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   10c0 <b_setcur@plt>
jmp    1484 <address+0x294>
jmp    1842 <address+0x652>
movsbl -0x5(%rbp),%edx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x66,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1080 <k_getch@plt>
mov    %al,-0x2d(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    14d1 <address+0x2e1>
mov    -0x2d(%rbp),%al
mov    -0x14(%rbp),%esi
movsbl %al,%edi
call   1070 <loc_char@plt>
jmp    14aa <address+0x2ba>
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%eax
mov    %eax,-0x43c(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x4(%rbp),%eax
cmp    $0x0,%eax
jle    14ff <address+0x30f>
mov    -0x10(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x440(%rbp)
jmp    150c <address+0x31c>
xor    %eax,%eax
mov    %eax,-0x440(%rbp)
jmp    150c <address+0x31c>
mov    -0x43c(%rbp),%edi
mov    -0x440(%rbp),%esi
call   10c0 <b_setcur@plt>
jmp    1842 <address+0x652>
mov    -0x4(%rbp),%edi
call   1110 <do_up_down@plt>
jmp    1842 <address+0x652>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1110 <do_up_down@plt>
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   10b0 <b_gets@plt>
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     1575 <address+0x385>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x444(%rbp)
mov    -0x10(%rbp),%eax
add    -0x4(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    159e <address+0x3ae>
mov    -0x10(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x448(%rbp)
jmp    15a7 <address+0x3b7>
mov    -0x18(%rbp),%eax
mov    %eax,-0x448(%rbp)
mov    -0x444(%rbp),%edi
mov    -0x448(%rbp),%esi
call   10c0 <b_setcur@plt>
jmp    1842 <address+0x652>
jmp    15c2 <address+0x3d2>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    15e2 <address+0x3f2>
xor    %edi,%edi
call   10d0 <loc_string@plt>
jmp    15c2 <address+0x3d2>
jmp    1842 <address+0x652>
jmp    15ec <address+0x3fc>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    160f <address+0x41f>
mov    $0x1,%edi
call   1030 <loc_word@plt>
jmp    15ec <address+0x3fc>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     1677 <address+0x487>
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1100 <b_getcur@plt>
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1641 <address+0x451>
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1672 <address+0x482>
mov    -0xc(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   10b0 <b_gets@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x44c(%rbp)
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x44c(%rbp),%edi
mov    %eax,%esi
call   10c0 <b_setcur@plt>
jmp    1677 <address+0x487>
movsbl -0x6(%rbp),%eax
cmp    $0x63,%eax
jne    16ff <address+0x50f>
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1100 <b_getcur@plt>
mov    -0x28(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   10b0 <b_gets@plt>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x44d(%rbp)
jle    16d3 <address+0x4e3>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x420(%rbp,%rax,1),%edi
ff
call   10a0 <isspace@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x44d(%rbp)
mov    -0x44d(%rbp),%al
test   $0x1,%al
jne    16e6 <address+0x4f6>
jmp    16f4 <address+0x504>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    16a0 <address+0x4b0>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   10c0 <b_setcur@plt>
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   10c0 <b_setcur@plt>
jmp    1842 <address+0x652>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   10b0 <b_gets@plt>
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     1756 <address+0x566>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   10c0 <b_setcur@plt>
jmp    1842 <address+0x652>
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1090 <b_getmark@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1782 <address+0x592>
jmp    1842 <address+0x652>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
call   10c0 <b_setcur@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     17a0 <address+0x5b0>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
cmpl   $0x0,0x28f4(%rip)
jne    17b7 <address+0x5c7>
jmp    1842 <address+0x652>
mov    0x28e3(%rip),%edi
mov    0x28e1(%rip),%esi
call   10c0 <b_setcur@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
je     17de <address+0x5ee>
mov    0x28c5(%rip),%eax
mov    %eax,-0x1c(%rbp)
jmp    1842 <address+0x652>
jmp    17e8 <address+0x5f8>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    180a <address+0x61a>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <loc_char@plt>
jmp    17e8 <address+0x5f8>
jmp    1842 <address+0x652>
movsbl -0x5(%rbp),%edi
call   10d0 <loc_string@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x1,%eax
jle    1838 <address+0x648>
xor    %edi,%edi
call   10d0 <loc_string@plt>
jmp    1818 <address+0x628>
jmp    1842 <address+0x652>
jmp    1842 <address+0x652>
cmpl   $0x0,-0x1c(%rbp)
jle    18bc <address+0x6cc>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x454(%rbp)
mov    $0x0,%al
call   10f0 <b_size@plt>
mov    %eax,%ecx
mov    -0x454(%rbp),%eax
cmp    %ecx,%eax
jge    187a <address+0x68a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x458(%rbp)
jmp    1887 <address+0x697>
mov    $0x0,%al
call   10f0 <b_size@plt>
mov    %eax,-0x458(%rbp)
mov    -0x458(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
jne    18aa <address+0x6ba>
mov    -0x1c(%rbp),%edi
call   1060 <b_setline@plt>
jmp    18b7 <address+0x6c7>
mov    -0x1c(%rbp),%edi
mov    $0xffffffff,%esi
call   10c0 <b_setcur@plt>
jmp    18bc <address+0x6cc>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
jne    1905 <address+0x715>
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1100 <b_getcur@plt>
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    18ee <address+0x6fe>
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1900 <address+0x710>
mov    -0xc(%rbp),%eax
mov    %eax,0x27a9(%rip)
mov    -0x10(%rbp),%eax
mov    %eax,0x27a4(%rip)
jmp    192e <address+0x73e>
movsbl -0x6(%rbp),%eax
cmp    $0x63,%eax
je     191f <address+0x72f>
movsbl -0x6(%rbp),%eax
cmp    $0x64,%eax
jne    1929 <address+0x739>
movl   $0x0,0x2777(%rip)
jmp    192e <address+0x73e>
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<address>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %ebp,%r15d
test   %edi,%edi
je     1248 <address+0x58>
lea    0xc(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1100 <b_getcur@plt>
add    $0xfffffffc,%ebp
cmp    $0x75,%ebp
ja     157f <address+0x38f>
lea    0xdd3(%rip),%rax
movslq (%rax,%rbp,4),%rcx
add    %rax,%rcx
jmp    *%rcx
cmp    %r15b,%r14b
jne    157f <address+0x38f>
mov    0xc(%rsp),%eax
jmp    144d <address+0x25d>
xor    %ebx,%ebx
cmp    $0x4,%r15b
je     120b <address+0x1b>
cmp    $0x15,%r15b
je     120b <address+0x1b>
cmp    $0x67,%r15b
je     120b <address+0x1b>
mov    $0x1,%ebx
jmp    120b <address+0x1b>
mov    0xc(%rsp),%edi
mov    0x18(%rsp),%esi
xor    %eax,%eax
sub    %ebx,%esi
cmovs  %eax,%esi
jmp    1412 <address+0x222>
mov    0xc(%rsp),%edi
lea    0x20(%rsp),%rbp
mov    %rbp,%rsi
call   10b0 <b_gets@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
xor    %ecx,%ecx
cmp    $0x20,%r14b
sete   %cl
sub    %ecx,%eax
add    0x18(%rsp),%ebx
mov    0xc(%rsp),%edi
cmp    %eax,%ebx
cmovge %eax,%ebx
mov    %ebx,%esi
jmp    1412 <address+0x222>
movsbl %r15b,%edi
call   10d0 <loc_string@plt>
cmp    $0x2,%ebx
jl     157f <address+0x38f>
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   10d0 <loc_string@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
ja     12d0 <address+0xe0>
jmp    157f <address+0x38f>
xor    %ebp,%ebp
cmp    $0x66,%r15b
sete   %r15b
xor    %eax,%eax
call   1080 <k_getch@plt>
test   %ebx,%ebx
jle    157f <address+0x38f>
mov    %r15b,%bpl
lea    -0x1(%rbp,%rbp,1),%r15d
add    $0x1,%ebx
movsbl %al,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r15d,%esi
call   1070 <loc_char@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1310 <address+0x120>
jmp    157f <address+0x38f>
test   %ebx,%ebx
je     1331 <address+0x141>
mov    %ebx,0x2d67(%rip)
xor    %eax,%eax
call   10e0 <s_lastline@plt>
mov    %eax,%ebx
add    0x2d58(%rip),%ebx
jmp    151a <address+0x32a>
add    0xc(%rsp),%ebx
jmp    151a <address+0x32a>
test   %ebx,%ebx
je     1358 <address+0x168>
mov    %ebx,0x2d40(%rip)
xor    %eax,%eax
call   1040 <s_firstline@plt>
sub    0x2d33(%rip),%eax
mov    $0x1,%ebp
cmp    $0x2,%eax
jl     1520 <address+0x330>
xor    %eax,%eax
call   1040 <s_firstline@plt>
mov    %eax,%ebx
sub    0x2d16(%rip),%ebx
jmp    151a <address+0x32a>
mov    0xc(%rsp),%eax
add    %eax,%ebx
add    $0xffffffff,%ebx
mov    %ebx,0x14(%rsp)
lea    0x20(%rsp),%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
call   10b0 <b_gets@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
xor    %ecx,%ecx
cmp    $0x20,%r14b
sete   %cl
sub    %ecx,%eax
mov    %eax,0x10(%rsp)
mov    %ebx,%edi
mov    %eax,%esi
jmp    1412 <address+0x222>
lea    0x20(%rsp),%rdi
lea    0x1c(%rsp),%rsi
call   1090 <b_getmark@plt>
mov    0x20(%rsp),%edi
test   %edi,%edi
je     157f <address+0x38f>
mov    0x1c(%rsp),%esi
call   10c0 <b_setcur@plt>
cmp    $0x20,%r14b
je     1589 <address+0x399>
mov    0x20(%rsp),%ebx
jmp    151a <address+0x32a>
mov    0xc(%rsp),%eax
sub    %ebx,%eax
test   %eax,%eax
mov    $0x1,%ebp
cmovg  %eax,%ebp
jmp    1520 <address+0x330>
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   10c0 <b_setcur@plt>
jmp    157f <address+0x38f>
test   %ebx,%ebx
jle    157f <address+0x38f>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
xor    %esi,%esi
call   1070 <loc_char@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1430 <address+0x240>
jmp    157f <address+0x38f>
xor    %eax,%eax
call   1040 <s_firstline@plt>
add    %eax,%ebx
add    $0xffffffff,%ebx
jmp    151a <address+0x32a>
xor    %eax,%eax
call   10e0 <s_lastline@plt>
mov    $0x1,%ebp
cmp    %ebx,%eax
jle    1520 <address+0x330>
xor    %eax,%eax
call   10e0 <s_lastline@plt>
sub    %ebx,%eax
add    $0x1,%eax
jmp    1518 <address+0x328>
xor    %eax,%eax
call   1040 <s_firstline@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10e0 <s_lastline@plt>
add    %ebx,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
jmp    151a <address+0x32a>
mov    0x2bfe(%rip),%edi
test   %edi,%edi
je     157f <address+0x38f>
mov    0x2bf4(%rip),%esi
call   10c0 <b_setcur@plt>
cmp    $0x20,%r14b
je     1589 <address+0x399>
mov    0x2bdb(%rip),%ebx
jmp    151a <address+0x32a>
test   %ebx,%ebx
jle    14e2 <address+0x2f2>
add    $0x1,%ebx
xchg   %ax,%ax
mov    $0xffffffff,%edi
call   1030 <loc_word@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     14d0 <address+0x2e0>
cmp    $0x20,%r14b
je     1589 <address+0x399>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1100 <b_getcur@plt>
mov    0xc(%rsp),%edi
cmp    %edi,0x14(%rsp)
je     167b <address+0x48b>
xor    %esi,%esi
jmp    1548 <address+0x358>
test   %ebx,%ebx
jne    151a <address+0x32a>
xor    %eax,%eax
call   10f0 <b_size@plt>
mov    %eax,%ebx
mov    %ebx,%ebp
test   %ebx,%ebx
jle    157f <address+0x38f>
xor    %eax,%eax
call   10f0 <b_size@plt>
cmp    %eax,%ebp
jl     1534 <address+0x344>
xor    %eax,%eax
call   10f0 <b_size@plt>
mov    %eax,%ebp
mov    %ebp,%edi
cmp    $0x20,%r14b
jne    1543 <address+0x353>
call   1060 <b_setline@plt>
jmp    1589 <address+0x399>
mov    $0xffffffff,%esi
call   10c0 <b_setcur@plt>
jmp    167b <address+0x48b>
neg    %ebx
mov    %ebx,%edi
call   1110 <do_up_down@plt>
jmp    157f <address+0x38f>
test   %ebx,%ebx
jle    157f <address+0x38f>
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   10d0 <loc_string@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1570 <address+0x380>
cmp    $0x20,%r14b
jne    167b <address+0x48b>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1100 <b_getcur@plt>
mov    0xc(%rsp),%eax
cmp    %eax,0x14(%rsp)
jne    15b2 <address+0x3c2>
mov    0x18(%rsp),%ecx
cmp    %ecx,0x10(%rsp)
je     168f <address+0x49f>
jmp    15b6 <address+0x3c6>
mov    0x18(%rsp),%ecx
mov    %eax,0x2ae4(%rip)
mov    %ecx,0x2ae2(%rip)
jmp    168f <address+0x49f>
test   %ebx,%ebx
jle    15e2 <address+0x3f2>
add    $0x1,%ebx
xchg   %ax,%ax
mov    $0x1,%edi
call   1030 <loc_word@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     15d0 <address+0x3e0>
cmp    $0x20,%r14b
je     1589 <address+0x399>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1100 <b_getcur@plt>
mov    0xc(%rsp),%edi
cmp    %edi,0x14(%rsp)
jne    160b <address+0x41b>
mov    0x10(%rsp),%eax
cmp    0x18(%rsp),%eax
jne    162d <address+0x43d>
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   10b0 <b_gets@plt>
mov    0xc(%rsp),%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   10c0 <b_setcur@plt>
cmp    $0x63,%r14b
jne    167b <address+0x48b>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1100 <b_getcur@plt>
mov    0x14(%rsp),%edi
lea    0x20(%rsp),%rsi
call   10b0 <b_gets@plt>
mov    0x10(%rsp),%esi
test   %esi,%esi
jle    169f <address+0x4af>
add    $0xffffffff,%esi
movsbl 0x20(%rsp,%rsi,1),%edi
call   10a0 <isspace@plt>
mov    0x10(%rsp),%ecx
test   %eax,%eax
je     169d <address+0x4ad>
lea    -0x1(%rcx),%esi
mov    %esi,0x10(%rsp)
cmp    $0x1,%ecx
jg     1658 <address+0x468>
jmp    169f <address+0x4af>
add    $0x9d,%r14b
cmp    $0x1,%r14b
ja     168f <address+0x49f>
movl   $0x0,0x2a11(%rip)
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ecx,%esi
mov    0x14(%rsp),%edi
jmp    1412 <address+0x222>

LLVM IR (-O0):
@address.prev_line = internal global i32 0
@address.prev_pos = internal global i32 0
@address.scroll_size = internal global i32 12
define void @address(i32 %0, i8 signext %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
%17 = alloca [999 x i8]
store i32 %0, i32* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %3
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 103
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 4
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8, i8* %5
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 21
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 1, i32* %4
br label %33
33: ; preds = %32, %28, %24, %20, %3
%34 = call i32 @b_getcur(i32* %7, i32* %8)
store i32 0, i32* %11
%35 = load i8, i8* %5
%36 = sext i8 %35 to i32
switch i32 %36, label %347 [
i32 103, label %37
i32 72, label %44
i32 76, label %49
i32 77, label %63
i32 13, label %68
i32 45, label %72
i32 4, label %84
i32 21, label %93
i32 99, label %110
i32 100, label %110
i32 121, label %110
i32 98, label %122
i32 102, label %143
i32 70, label %143
i32 104, label %159
i32 8, label %159
i32 106, label %173
i32 107, label %176
i32 108, label %180
i32 32, label %180
i32 110, label %209
i32 119, label %217
i32 48, label %276
i32 36, label %279
i32 39, label %300
i32 96, label %315
i32 59, label %329
i32 92, label %337
i32 47, label %337
]
37: ; preds = %33
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (...) @b_size()
store i32 %41, i32* %4
br label %42
42: ; preds = %40, %37
%43 = load i32, i32* %4
store i32 %43, i32* %11
br label %348
44: ; preds = %33
%45 = call i32 (...) @s_firstline()
%46 = load i32, i32* %4
%47 = add nsw i32 %45, %46
%48 = sub nsw i32 %47, 1
store i32 %48, i32* %11
br label %348
49: ; preds = %33
%50 = call i32 (...) @s_lastline()
%51 = load i32, i32* %4
%52 = sub nsw i32 %50, %51
%53 = add nsw i32 %52, 1
%54 = icmp sgt i32 %53, 1
br i1 %54, label %55, label %60
55: ; preds = %49
%56 = call i32 (...) @s_lastline()
%57 = load i32, i32* %4
%58 = sub nsw i32 %56, %57
%59 = add nsw i32 %58, 1
br label %61
60: ; preds = %49
br label %61
61: ; preds = %60, %55
%62 = phi i32 [ %59, %55 ], [ 1, %60 ]
store i32 %62, i32* %11
br label %348
63: ; preds = %33
%64 = call i32 (...) @s_firstline()
%65 = call i32 (...) @s_lastline()
%66 = add nsw i32 %64, %65
%67 = sdiv i32 %66, 2
store i32 %67, i32* %11
br label %348
68: ; preds = %33
%69 = load i32, i32* %7
%70 = load i32, i32* %4
%71 = add nsw i32 %69, %70
store i32 %71, i32* %11
br label %348
72: ; preds = %33
%73 = load i32, i32* %7
%74 = load i32, i32* %4
%75 = sub nsw i32 %73, %74
%76 = icmp sgt i32 %75, 1
br i1 %76, label %77, label %81
77: ; preds = %72
%78 = load i32, i32* %7
%79 = load i32, i32* %4
%80 = sub nsw i32 %78, %79
br label %82
81: ; preds = %72
br label %82
82: ; preds = %81, %77
%83 = phi i32 [ %80, %77 ], [ 1, %81 ]
store i32 %83, i32* %11
br label %348
84: ; preds = %33
%85 = load i32, i32* %4
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = load i32, i32* %4
store i32 %88, i32* @address.scroll_size
br label %89
89: ; preds = %87, %84
%90 = call i32 (...) @s_lastline()
%91 = load i32, i32* @address.scroll_size
%92 = add nsw i32 %90, %91
store i32 %92, i32* %11
br label %348
93: ; preds = %33
%94 = load i32, i32* %4
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %93
%97 = load i32, i32* %4
store i32 %97, i32* @address.scroll_size
br label %98
98: ; preds = %96, %93
%99 = call i32 (...) @s_firstline()
%100 = load i32, i32* @address.scroll_size
%101 = sub nsw i32 %99, %100
%102 = icmp sgt i32 %101, 1
br i1 %102, label %103, label %107
103: ; preds = %98
%104 = call i32 (...) @s_firstline()
%105 = load i32, i32* @address.scroll_size
%106 = sub nsw i32 %104, %105
br label %108
107: ; preds = %98
br label %108
108: ; preds = %107, %103
%109 = phi i32 [ %106, %103 ], [ 1, %107 ]
store i32 %109, i32* %11
br label %348
110: ; preds = %33, %33, %33
%111 = load i8, i8* %6
%112 = sext i8 %111 to i32
%113 = load i8, i8* %5
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %112, %114
br i1 %115, label %116, label %121
116: ; preds = %110
%117 = load i32, i32* %7
%118 = load i32, i32* %4
%119 = add nsw i32 %117, %118
%120 = sub nsw i32 %119, 1
store i32 %120, i32* %11
br label %121
121: ; preds = %116, %110
br label %348
122: ; preds = %33
br label %123
123: ; preds = %127, %122
%124 = load i32, i32* %4
%125 = add nsw i32 %124, -1
store i32 %125, i32* %4
%126 = icmp sgt i32 %124, 0
br i1 %126, label %127, label %129
127: ; preds = %123
%128 = call i32 @loc_word(i32 -1)
br label %123
129: ; preds = %123
%130 = load i8, i8* %6
%131 = sext i8 %130 to i32
%132 = icmp ne i32 %131, 32
br i1 %132, label %133, label %142
133: ; preds = %129
%134 = call i32 @b_getcur(i32* %14, i32* %15)
%135 = load i32, i32* %14
%136 = load i32, i32* %7
%137 = icmp ne i32 %135, %136
br i1 %137, label %138, label %141
138: ; preds = %133
%139 = load i32, i32* %7
%140 = call i32 @b_setcur(i32 %139, i32 0)
br label %141
141: ; preds = %138, %133
br label %142
142: ; preds = %141, %129
br label %348
143: ; preds = %33, %33
%144 = load i8, i8* %5
%145 = sext i8 %144 to i32
%146 = icmp eq i32 %145, 102
%147 = zext i1 %146 to i64
%148 = select i1 %146, i32 1, i32 -1
store i32 %148, i32* %9
%149 = call signext i8 (...) @k_getch()
store i8 %149, i8* %16
br label %150
150: ; preds = %154, %143
%151 = load i32, i32* %4
%152 = add nsw i32 %151, -1
store i32 %152, i32* %4
%153 = icmp sgt i32 %151, 0
br i1 %153, label %154, label %158
154: ; preds = %150
%155 = load i8, i8* %16
%156 = load i32, i32* %9
%157 = call i32 @loc_char(i8 signext %155, i32 %156)
br label %150
158: ; preds = %150
br label %348
159: ; preds = %33, %33
%160 = load i32, i32* %7
%161 = load i32, i32* %8
%162 = load i32, i32* %4
%163 = sub nsw i32 %161, %162
%164 = icmp sgt i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %159
%166 = load i32, i32* %8
%167 = load i32, i32* %4
%168 = sub nsw i32 %166, %167
br label %170
169: ; preds = %159
br label %170
170: ; preds = %169, %165
%171 = phi i32 [ %168, %165 ], [ 0, %169 ]
%172 = call i32 @b_setcur(i32 %160, i32 %171)
br label %348
173: ; preds = %33
%174 = load i32, i32* %4
%175 = call i32 @do_up_down(i32 %174)
br label %348
176: ; preds = %33
%177 = load i32, i32* %4
%178 = sub nsw i32 0, %177
%179 = call i32 @do_up_down(i32 %178)
br label %348
180: ; preds = %33, %33
%181 = load i32, i32* %7
%182 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%183 = call i32 @b_gets(i32 %181, i8* %182)
%184 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%185 = call i32 @strlen(i8* %184)
%186 = sub nsw i32 %185, 1
store i32 %186, i32* %10
%187 = load i8, i8* %6
%188 = sext i8 %187 to i32
%189 = icmp ne i32 %188, 32
br i1 %189, label %190, label %193
190: ; preds = %180
%191 = load i32, i32* %10
%192 = add nsw i32 %191, 1
store i32 %192, i32* %10
br label %193
193: ; preds = %190, %180
%194 = load i32, i32* %7
%195 = load i32, i32* %8
%196 = load i32, i32* %4
%197 = add nsw i32 %195, %196
%198 = load i32, i32* %10
%199 = icmp slt i32 %197, %198
br i1 %199, label %200, label %204
200: ; preds = %193
%201 = load i32, i32* %8
%202 = load i32, i32* %4
%203 = add nsw i32 %201, %202
br label %206
204: ; preds = %193
%205 = load i32, i32* %10
br label %206
206: ; preds = %204, %200
%207 = phi i32 [ %203, %200 ], [ %205, %204 ]
%208 = call i32 @b_setcur(i32 %194, i32 %207)
br label %348
209: ; preds = %33
br label %210
210: ; preds = %214, %209
%211 = load i32, i32* %4
%212 = add nsw i32 %211, -1
store i32 %212, i32* %4
%213 = icmp sgt i32 %211, 0
br i1 %213, label %214, label %216
214: ; preds = %210
%215 = call i32 @loc_string(i8 signext 0)
br label %210
216: ; preds = %210
br label %348
217: ; preds = %33
br label %218
218: ; preds = %222, %217
%219 = load i32, i32* %4
%220 = add nsw i32 %219, -1
store i32 %220, i32* %4
%221 = icmp sgt i32 %219, 0
br i1 %221, label %222, label %224
222: ; preds = %218
%223 = call i32 @loc_word(i32 1)
br label %218
224: ; preds = %218
%225 = load i8, i8* %6
%226 = sext i8 %225 to i32
%227 = icmp ne i32 %226, 32
br i1 %227, label %228, label %246
228: ; preds = %224
%229 = call i32 @b_getcur(i32* %14, i32* %15)
%230 = load i32, i32* %14
%231 = load i32, i32* %7
%232 = icmp ne i32 %230, %231
br i1 %232, label %237, label %233
233: ; preds = %228
%234 = load i32, i32* %15
%235 = load i32, i32* %8
%236 = icmp eq i32 %234, %235
br i1 %236, label %237, label %245
237: ; preds = %233, %228
%238 = load i32, i32* %7
%239 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%240 = call i32 @b_gets(i32 %238, i8* %239)
%241 = load i32, i32* %7
%242 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%243 = call i32 @strlen(i8* %242)
%244 = call i32 @b_setcur(i32 %241, i32 %243)
br label %245
245: ; preds = %237, %233
br label %246
246: ; preds = %245, %224
%247 = load i8, i8* %6
%248 = sext i8 %247 to i32
%249 = icmp eq i32 %248, 99
br i1 %249, label %250, label %275
250: ; preds = %246
%251 = call i32 @b_getcur(i32* %14, i32* %15)
%252 = load i32, i32* %14
%253 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%254 = call i32 @b_gets(i32 %252, i8* %253)
br label %255
255: ; preds = %268, %250
%256 = load i32, i32* %15
%257 = icmp sgt i32 %256, 0
br i1 %257, label %258, label %266
258: ; preds = %255
%259 = load i32, i32* %15
%260 = sub nsw i32 %259, 1
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 %261
%263 = load i8, i8* %262
%264 = call i32 @isspace(i8 signext %263)
%265 = icmp ne i32 %264, 0
br label %266
266: ; preds = %258, %255
%267 = phi i1 [ false, %255 ], [ %265, %258 ]
br i1 %267, label %268, label %271
268: ; preds = %266
%269 = load i32, i32* %15
%270 = add nsw i32 %269, -1
store i32 %270, i32* %15
br label %255
271: ; preds = %266
%272 = load i32, i32* %14
%273 = load i32, i32* %15
%274 = call i32 @b_setcur(i32 %272, i32 %273)
br label %275
275: ; preds = %271, %246
br label %348
276: ; preds = %33
%277 = load i32, i32* %7
%278 = call i32 @b_setcur(i32 %277, i32 0)
br label %348
279: ; preds = %33
%280 = load i32, i32* %7
%281 = load i32, i32* %4
%282 = add nsw i32 %280, %281
%283 = sub nsw i32 %282, 1
store i32 %283, i32* %14
%284 = load i32, i32* %14
%285 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%286 = call i32 @b_gets(i32 %284, i8* %285)
%287 = getelementptr inbounds [999 x i8], [999 x i8]* %17, i64 0, i64 0
%288 = call i32 @strlen(i8* %287)
%289 = sub nsw i32 %288, 1
store i32 %289, i32* %15
%290 = load i8, i8* %6
%291 = sext i8 %290 to i32
%292 = icmp ne i32 %291, 32
br i1 %292, label %293, label %296
293: ; preds = %279
%294 = load i32, i32* %15
%295 = add nsw i32 %294, 1
store i32 %295, i32* %15
br label %296
296: ; preds = %293, %279
%297 = load i32, i32* %14
%298 = load i32, i32* %15
%299 = call i32 @b_setcur(i32 %297, i32 %298)
br label %348
300: ; preds = %33
%301 = call i32 @b_getmark(i32* %12, i32* %13)
%302 = load i32, i32* %12
%303 = icmp eq i32 %302, 0
br i1 %303, label %304, label %305
304: ; preds = %300
br label %348
305: ; preds = %300
%306 = load i32, i32* %12
%307 = load i32, i32* %13
%308 = call i32 @b_setcur(i32 %306, i32 %307)
%309 = load i8, i8* %6
%310 = sext i8 %309 to i32
%311 = icmp ne i32 %310, 32
br i1 %311, label %312, label %314
312: ; preds = %305
%313 = load i32, i32* %12
store i32 %313, i32* %11
br label %314
314: ; preds = %312, %305
br label %348
315: ; preds = %33
%316 = load i32, i32* @address.prev_line
%317 = icmp eq i32 %316, 0
br i1 %317, label %318, label %319
318: ; preds = %315
br label %348
319: ; preds = %315
%320 = load i32, i32* @address.prev_line
%321 = load i32, i32* @address.prev_pos
%322 = call i32 @b_setcur(i32 %320, i32 %321)
%323 = load i8, i8* %6
%324 = sext i8 %323 to i32
%325 = icmp ne i32 %324, 32
br i1 %325, label %326, label %328
326: ; preds = %319
%327 = load i32, i32* @address.prev_line
store i32 %327, i32* %11
br label %328
328: ; preds = %326, %319
br label %348
329: ; preds = %33
br label %330
330: ; preds = %334, %329
%331 = load i32, i32* %4
%332 = add nsw i32 %331, -1
store i32 %332, i32* %4
%333 = icmp sgt i32 %331, 0
br i1 %333, label %334, label %336
334: ; preds = %330
%335 = call i32 @loc_char(i8 signext 0, i32 0)
br label %330
336: ; preds = %330
br label %348
337: ; preds = %33, %33
%338 = load i8, i8* %5
%339 = call i32 @loc_string(i8 signext %338)
br label %340
340: ; preds = %344, %337
%341 = load i32, i32* %4
%342 = add nsw i32 %341, -1
store i32 %342, i32* %4
%343 = icmp sgt i32 %341, 1
br i1 %343, label %344, label %346
344: ; preds = %340
%345 = call i32 @loc_string(i8 signext 0)
br label %340
346: ; preds = %340
br label %348
347: ; preds = %33
br label %348
348: ; preds = %347, %346, %336, %328, %318, %314, %304, %296, %276, %275, %216, %206, %176, %173, %170, %158, %142, %121, %108, %89, %82, %68, %63, %61, %44, %42
%349 = load i32, i32* %11
%350 = icmp sgt i32 %349, 0
br i1 %350, label %351, label %371
351: ; preds = %348
%352 = load i32, i32* %11
%353 = call i32 (...) @b_size()
%354 = icmp slt i32 %352, %353
br i1 %354, label %355, label %357
355: ; preds = %351
%356 = load i32, i32* %11
br label %359
357: ; preds = %351
%358 = call i32 (...) @b_size()
br label %359
359: ; preds = %357, %355
%360 = phi i32 [ %356, %355 ], [ %358, %357 ]
store i32 %360, i32* %11
%361 = load i8, i8* %6
%362 = sext i8 %361 to i32
%363 = icmp eq i32 %362, 32
br i1 %363, label %364, label %367
364: ; preds = %359
%365 = load i32, i32* %11
%366 = call i32 @b_setline(i32 %365)
br label %370
367: ; preds = %359
%368 = load i32, i32* %11
%369 = call i32 @b_setcur(i32 %368, i32 -1)
br label %370
370: ; preds = %367, %364
br label %371
371: ; preds = %370, %348
%372 = load i8, i8* %6
%373 = sext i8 %372 to i32
%374 = icmp eq i32 %373, 32
br i1 %374, label %375, label %388
375: ; preds = %371
%376 = call i32 @b_getcur(i32* %14, i32* %15)
%377 = load i32, i32* %14
%378 = load i32, i32* %7
%379 = icmp ne i32 %377, %378
br i1 %379, label %384, label %380
380: ; preds = %375
%381 = load i32, i32* %15
%382 = load i32, i32* %8
%383 = icmp ne i32 %381, %382
br i1 %383, label %384, label %387
384: ; preds = %380, %375
%385 = load i32, i32* %7
store i32 %385, i32* @address.prev_line
%386 = load i32, i32* %8
store i32 %386, i32* @address.prev_pos
br label %387
387: ; preds = %384, %380
br label %398
388: ; preds = %371
%389 = load i8, i8* %6
%390 = sext i8 %389 to i32
%391 = icmp eq i32 %390, 99
br i1 %391, label %396, label %392
392: ; preds = %388
%393 = load i8, i8* %6
%394 = sext i8 %393 to i32
%395 = icmp eq i32 %394, 100
br i1 %395, label %396, label %397
396: ; preds = %392, %388
store i32 0, i32* @address.prev_line
br label %397
397: ; preds = %396, %392
br label %398
398: ; preds = %397, %387
ret void
}

LLVM IR (-O2):
@address.prev_line = internal unnamed_addr global i32 0
@address.prev_pos = internal unnamed_addr global i32 0
@address.scroll_size = internal unnamed_addr global i32 12
define void @address(i32 %0, i8 signext %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [999 x i8]
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = bitcast i32* %9 to i8*
%17 = getelementptr inbounds [999 x i8], [999 x i8]* %10, i64 0, i64 0
%18 = icmp eq i32 %0, 0
%19 = sext i8 %1 to i32
br i1 %18, label %20, label %22
20: ; preds = %3
switch i8 %1, label %21 [
i8 103, label %22
i8 21, label %22
i8 4, label %22
]
21: ; preds = %20
br label %22
22: ; preds = %20, %20, %20, %3, %21
%23 = phi i32 [ 1, %21 ], [ 0, %20 ], [ %0, %3 ], [ 0, %20 ], [ 0, %20 ]
%24 = call i32 @b_getcur(i32* %4, i32* %5)
switch i32 %19, label %244 [
i32 103, label %33
i32 72, label %37
i32 76, label %41
i32 77, label %48
i32 13, label %53
i32 45, label %56
i32 4, label %61
i32 21, label %68
i32 99, label %80
i32 100, label %80
i32 121, label %80
i32 98, label %31
i32 102, label %100
i32 70, label %100
i32 104, label %110
i32 8, label %110
i32 106, label %117
i32 107, label %119
i32 108, label %122
i32 32, label %122
i32 110, label %29
i32 119, label %27
i32 48, label %185
i32 36, label %188
i32 39, label %198
i32 96, label %207
i32 59, label %25
i32 92, label %220
i32 47, label %220
]
25: ; preds = %22
%26 = icmp sgt i32 %23, 0
br i1 %26, label %215, label %244
27: ; preds = %22
%28 = icmp sgt i32 %23, 0
br i1 %28, label %140, label %145
29: ; preds = %22
%30 = icmp sgt i32 %23, 0
br i1 %30, label %135, label %244
31: ; preds = %22
%32 = icmp sgt i32 %23, 0
br i1 %32, label %86, label %91
33: ; preds = %22
%34 = icmp eq i32 %23, 0
br i1 %34, label %35, label %228
35: ; preds = %33
%36 = call i32 (...) @b_size()
br label %228
37: ; preds = %22
%38 = call i32 (...) @s_firstline()
%39 = add i32 %23, -1
%40 = add i32 %39, %38
br label %228
41: ; preds = %22
%42 = call i32 (...) @s_lastline()
%43 = icmp sgt i32 %42, %23
br i1 %43, label %44, label %231
44: ; preds = %41
%45 = call i32 (...) @s_lastline()
%46 = sub i32 1, %23
%47 = add i32 %46, %45
br label %228
48: ; preds = %22
%49 = call i32 (...) @s_firstline()
%50 = call i32 (...) @s_lastline()
%51 = add nsw i32 %50, %49
%52 = sdiv i32 %51, 2
br label %228
53: ; preds = %22
%54 = load i32, i32* %4
%55 = add nsw i32 %54, %23
br label %228
56: ; preds = %22
%57 = load i32, i32* %4
%58 = sub nsw i32 %57, %23
%59 = icmp sgt i32 %58, 1
%60 = select i1 %59, i32 %58, i32 1
br label %231
61: ; preds = %22
%62 = icmp eq i32 %23, 0
br i1 %62, label %64, label %63
63: ; preds = %61
store i32 %23, i32* @address.scroll_size
br label %64
64: ; preds = %63, %61
%65 = call i32 (...) @s_lastline()
%66 = load i32, i32* @address.scroll_size
%67 = add nsw i32 %66, %65
br label %228
68: ; preds = %22
%69 = icmp eq i32 %23, 0
br i1 %69, label %71, label %70
70: ; preds = %68
store i32 %23, i32* @address.scroll_size
br label %71
71: ; preds = %70, %68
%72 = call i32 (...) @s_firstline()
%73 = load i32, i32* @address.scroll_size
%74 = sub nsw i32 %72, %73
%75 = icmp sgt i32 %74, 1
br i1 %75, label %76, label %231
76: ; preds = %71
%77 = call i32 (...) @s_firstline()
%78 = load i32, i32* @address.scroll_size
%79 = sub nsw i32 %77, %78
br label %228
80: ; preds = %22, %22, %22
%81 = icmp eq i8 %2, %1
br i1 %81, label %82, label %244
82: ; preds = %80
%83 = load i32, i32* %4
%84 = add i32 %23, -1
%85 = add i32 %84, %83
br label %228
86: ; preds = %31, %86
%87 = phi i32 [ %88, %86 ], [ %23, %31 ]
%88 = add nsw i32 %87, -1
%89 = call i32 @loc_word(i32 -1)
%90 = icmp ugt i32 %87, 1
br i1 %90, label %86, label %91
91: ; preds = %86, %31
%92 = icmp eq i8 %2, 32
br i1 %92, label %246, label %93
93: ; preds = %91
%94 = call i32 @b_getcur(i32* %8, i32* %9)
%95 = load i32, i32* %8
%96 = load i32, i32* %4
%97 = icmp eq i32 %95, %96
br i1 %97, label %259, label %98
98: ; preds = %93
%99 = call i32 @b_setcur(i32 %96, i32 0)
br label %259
100: ; preds = %22, %22
%101 = icmp eq i8 %1, 102
%102 = select i1 %101, i32 1, i32 -1
%103 = call signext i8 (...) @k_getch()
%104 = icmp sgt i32 %23, 0
br i1 %104, label %105, label %244
105: ; preds = %100, %105
%106 = phi i32 [ %107, %105 ], [ %23, %100 ]
%107 = add nsw i32 %106, -1
%108 = call i32 @loc_char(i8 signext %103, i32 %102)
%109 = icmp ugt i32 %106, 1
br i1 %109, label %105, label %244
110: ; preds = %22, %22
%111 = load i32, i32* %4
%112 = load i32, i32* %5
%113 = sub nsw i32 %112, %23
%114 = icmp sgt i32 %113, 0
%115 = select i1 %114, i32 %113, i32 0
%116 = call i32 @b_setcur(i32 %111, i32 %115)
br label %244
117: ; preds = %22
%118 = call i32 @do_up_down(i32 %23)
br label %244
119: ; preds = %22
%120 = sub i32 0, %23
%121 = call i32 @do_up_down(i32 %120)
br label %244
122: ; preds = %22, %22
%123 = load i32, i32* %4
%124 = call i32 @b_gets(i32 %123, i8* %17)
%125 = call i32 @strlen(i8* %17)
%126 = icmp eq i8 %2, 32
%127 = sext i1 %126 to i32
%128 = add nsw i32 %125, %127
%129 = load i32, i32* %4
%130 = load i32, i32* %5
%131 = add nsw i32 %130, %23
%132 = icmp slt i32 %131, %128
%133 = select i1 %132, i32 %131, i32 %128
%134 = call i32 @b_setcur(i32 %129, i32 %133)
br label %244
135: ; preds = %29, %135
%136 = phi i32 [ %137, %135 ], [ %23, %29 ]
%137 = add nsw i32 %136, -1
%138 = call i32 @loc_string(i8 signext 0)
%139 = icmp ugt i32 %136, 1
br i1 %139, label %135, label %244
140: ; preds = %27, %140
%141 = phi i32 [ %142, %140 ], [ %23, %27 ]
%142 = add nsw i32 %141, -1
%143 = call i32 @loc_word(i32 1)
%144 = icmp ugt i32 %141, 1
br i1 %144, label %140, label %145
145: ; preds = %140, %27
%146 = icmp eq i8 %2, 32
br i1 %146, label %246, label %147
147: ; preds = %145
%148 = call i32 @b_getcur(i32* %8, i32* %9)
%149 = load i32, i32* %8
%150 = load i32, i32* %4
%151 = icmp eq i32 %149, %150
br i1 %151, label %152, label %156
152: ; preds = %147
%153 = load i32, i32* %9
%154 = load i32, i32* %5
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %161
156: ; preds = %152, %147
%157 = call i32 @b_gets(i32 %150, i8* %17)
%158 = load i32, i32* %4
%159 = call i32 @strlen(i8* %17)
%160 = call i32 @b_setcur(i32 %158, i32 %159)
br label %161
161: ; preds = %152, %156
%162 = icmp eq i8 %2, 99
br i1 %162, label %163, label %259
163: ; preds = %161
%164 = call i32 @b_getcur(i32* %8, i32* %9)
%165 = load i32, i32* %8
%166 = call i32 @b_gets(i32 %165, i8* %17)
%167 = load i32, i32* %9
%168 = icmp sgt i32 %167, 0
br i1 %168, label %169, label %181
169: ; preds = %163, %178
%170 = phi i32 [ %179, %178 ], [ %167, %163 ]
%171 = add nsw i32 %170, -1
%172 = zext i32 %171 to i64
%173 = getelementptr inbounds [999 x i8], [999 x i8]* %10, i64 0, i64 %172
%174 = load i8, i8* %173
%175 = call i32 @isspace(i8 signext %174)
%176 = icmp eq i32 %175, 0
%177 = load i32, i32* %9
br i1 %176, label %181, label %178
178: ; preds = %169
%179 = add nsw i32 %177, -1
store i32 %179, i32* %9
%180 = icmp sgt i32 %177, 1
br i1 %180, label %169, label %181
181: ; preds = %178, %169, %163
%182 = phi i32 [ %167, %163 ], [ %177, %169 ], [ %179, %178 ]
%183 = load i32, i32* %8
%184 = call i32 @b_setcur(i32 %183, i32 %182)
br label %244
185: ; preds = %22
%186 = load i32, i32* %4
%187 = call i32 @b_setcur(i32 %186, i32 0)
br label %244
188: ; preds = %22
%189 = load i32, i32* %4
%190 = add i32 %23, -1
%191 = add i32 %190, %189
store i32 %191, i32* %8
%192 = call i32 @b_gets(i32 %191, i8* %17)
%193 = call i32 @strlen(i8* %17)
%194 = icmp eq i8 %2, 32
%195 = sext i1 %194 to i32
%196 = add nsw i32 %193, %195
store i32 %196, i32* %9
%197 = call i32 @b_setcur(i32 %191, i32 %196)
br label %244
198: ; preds = %22
%199 = call i32 @b_getmark(i32* %6, i32* %7)
%200 = load i32, i32* %6
%201 = icmp eq i32 %200, 0
br i1 %201, label %244, label %202
202: ; preds = %198
%203 = load i32, i32* %7
%204 = call i32 @b_setcur(i32 %200, i32 %203)
%205 = icmp eq i8 %2, 32
%206 = load i32, i32* %6
br i1 %205, label %246, label %228
207: ; preds = %22
%208 = load i32, i32* @address.prev_line
%209 = icmp eq i32 %208, 0
br i1 %209, label %244, label %210
210: ; preds = %207
%211 = load i32, i32* @address.prev_pos
%212 = call i32 @b_setcur(i32 %208, i32 %211)
%213 = icmp eq i8 %2, 32
%214 = load i32, i32* @address.prev_line
br i1 %213, label %246, label %228
215: ; preds = %25, %215
%216 = phi i32 [ %217, %215 ], [ %23, %25 ]
%217 = add nsw i32 %216, -1
%218 = call i32 @loc_char(i8 signext 0, i32 0)
%219 = icmp ugt i32 %216, 1
br i1 %219, label %215, label %244
220: ; preds = %22, %22
%221 = call i32 @loc_string(i8 signext %1)
%222 = icmp sgt i32 %23, 1
br i1 %222, label %223, label %244
223: ; preds = %220, %223
%224 = phi i32 [ %225, %223 ], [ %23, %220 ]
%225 = add nsw i32 %224, -1
%226 = call i32 @loc_string(i8 signext 0)
%227 = icmp ugt i32 %224, 2
br i1 %227, label %223, label %244
228: ; preds = %210, %202, %76, %44, %33, %35, %82, %64, %53, %48, %37
%229 = phi i32 [ %85, %82 ], [ %67, %64 ], [ %55, %53 ], [ %52, %48 ], [ %40, %37 ], [ %36, %35 ], [ %23, %33 ], [ %47, %44 ], [ %79, %76 ], [ %206, %202 ], [ %214, %210 ]
%230 = icmp sgt i32 %229, 0
br i1 %230, label %231, label %244
231: ; preds = %56, %71, %41, %228
%232 = phi i32 [ %229, %228 ], [ 1, %71 ], [ 1, %41 ], [ %60, %56 ]
%233 = call i32 (...) @b_size()
%234 = icmp slt i32 %232, %233
br i1 %234, label %237, label %235
235: ; preds = %231
%236 = call i32 (...) @b_size()
br label %237
237: ; preds = %231, %235
%238 = phi i32 [ %236, %235 ], [ %232, %231 ]
%239 = icmp eq i8 %2, 32
br i1 %239, label %240, label %242
240: ; preds = %237
%241 = call i32 @b_setline(i32 %238)
br label %246
242: ; preds = %237
%243 = call i32 @b_setcur(i32 %238, i32 -1)
br label %259
244: ; preds = %223, %215, %135, %105, %220, %25, %29, %100, %80, %110, %117, %119, %122, %181, %185, %188, %198, %207, %22, %228
%245 = icmp eq i8 %2, 32
br i1 %245, label %246, label %259
246: ; preds = %91, %145, %202, %210, %240, %244
%247 = call i32 @b_getcur(i32* %8, i32* %9)
%248 = load i32, i32* %8
%249 = load i32, i32* %4
%250 = icmp eq i32 %248, %249
br i1 %250, label %253, label %251
251: ; preds = %246
%252 = load i32, i32* %5
br label %257
253: ; preds = %246
%254 = load i32, i32* %9
%255 = load i32, i32* %5
%256 = icmp eq i32 %254, %255
br i1 %256, label %263, label %257
257: ; preds = %251, %253
%258 = phi i32 [ %252, %251 ], [ %255, %253 ]
store i32 %249, i32* @address.prev_line
store i32 %258, i32* @address.prev_pos
br label %263
259: ; preds = %161, %98, %93, %242, %244
%260 = add i8 %2, -99
%261 = icmp ult i8 %260, 2
br i1 %261, label %262, label %263
262: ; preds = %259
store i32 0, i32* @address.prev_line
br label %263
263: ; preds = %262, %259, %253, %257
ret void
}