#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 */
typedef struct TYPE_14__ TYPE_1__;

/* Type definitions */
struct TYPE_14__ {
  int _begy;
  int _begx;
  int _attrs;
};
typedef TYPE_1__ WINDOW;

/* Variables and functions */
int A_BOLD;
int A_REVERSE;
int ERR;
int FALSE;
#define KEY_DOWN 133
#define KEY_EIC 132
#define KEY_IC 131
#define KEY_LEFT 130
#define KEY_RIGHT 129
#define KEY_UP 128
int TRUE;
int /*<<< orphan*/ colorbox(TYPE_1__ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ delwin(TYPE_1__ *);
int erasechar();
int /*<<< orphan*/ getyx(TYPE_1__ *, int, int);
int /*<<< orphan*/ insertcursor();
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ keypad(TYPE_1__ *, int);
int killchar();
int /*<<< orphan*/ memmove(void *, void const *, int);
int /*<<< orphan*/ nodelay(TYPE_1__ *, int);
int /*<<< orphan*/ normalcursor();
int /*<<< orphan*/ repainteditbox(TYPE_1__ *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
TYPE_1__ *subwin(TYPE_1__ *, int, int, int, int);
int /*<<< orphan*/ wattrset(TYPE_1__ *, int);
int wgetch(TYPE_1__ *);
int wordchar();
int /*<<< orphan*/ wrefresh(TYPE_1__ *);
int weditstr(WINDOW *win, char *buf, int field) {
  char org[256], *tp, *bp = buf;
  bool defdisp = TRUE, stop = FALSE, insert = FALSE;
  int cury, curx, begy, begx, oldattr;
  WINDOW *wedit;
  int c = 0;
  if ((field >= 256) || (buf == NULL) || (strlen(buf) > field - 1))
    return ERR;
  strcpy(org, buf);
  wrefresh(win);
  getyx(win, cury, curx);
  (begy = (win)->_begy, begx = (win)->_begx);
  wedit = subwin(win, 1, field, begy + cury, begx + curx);
  oldattr = wedit->_attrs;
  colorbox(wedit, (A_BOLD | A_REVERSE), 0);
  normalcursor();
  nodelay(win, FALSE);
  keypad(wedit, TRUE);
  while (!stop) {
    repainteditbox(wedit, bp - buf, buf);
    switch (c = wgetch(wedit)) {
    case 0x1b:
      strcpy(buf, org);
      stop = TRUE;
      break;
    case '\n':
    case KEY_UP:
    case KEY_DOWN:
      stop = TRUE;
      break;
    case KEY_LEFT:
      if (bp > buf)
        bp--;
      break;
    case KEY_RIGHT:
      defdisp = FALSE;
      if (bp - buf < strlen(buf))
        bp++;
      break;
    case '\t':
    case KEY_IC:
    case KEY_EIC:
      defdisp = FALSE;
      insert = !insert;
      if (insert)
        insertcursor();
      else
        normalcursor();
      break;
    default:
      if (c == erasechar()) {
        if (bp > buf) {
          memmove((void *)(bp - 1), (const void *)bp, strlen(bp) + 1);
          bp--;
        }
      } else if (c == killchar()) {
        bp = buf;
        *bp = '\0';
      } else if (c == wordchar()) {
        tp = bp;
        while ((bp > buf) && (*(bp - 1) == ' '))
          bp--;
        while ((bp > buf) && (*(bp - 1) != ' '))
          bp--;
        memmove((void *)bp, (const void *)tp, strlen(tp) + 1);
      } else if (isprint(c)) {
        if (defdisp) {
          bp = buf;
          *bp = '\0';
          defdisp = FALSE;
        }
        if (insert) {
          if (strlen(buf) < field - 1) {
            memmove((void *)(bp + 1), (const void *)bp, strlen(bp) + 1);
            *bp++ = c;
          }
        } else if (bp - buf < field - 1) {
          if (!*bp)
            bp[1] = '\0';
          *bp++ = c;
        }
      }
      break;
    }
  }
  nodelay(win, TRUE);
  wattrset(wedit, oldattr);
  repainteditbox(wedit, bp - buf, buf);
  delwin(wedit);
  return c;
}


x86 assembly (clang, -O0):
<weditstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
mov    0x2d52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x13c(%rbp)
movl   $0x0,-0x15c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    12b7 <weditstr+0x87>
cmpq   $0x0,-0x18(%rbp)
je     12b7 <weditstr+0x87>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    12c8 <weditstr+0x98>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1939 <weditstr+0x709>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1080 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
mov    -0x140(%rbp),%esi
mov    -0x144(%rbp),%edx
call   1070 <getyx@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x148(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x14c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x148(%rbp),%ecx
add    -0x140(%rbp),%ecx
mov    -0x14c(%rbp),%r8d
add    -0x144(%rbp),%r8d
mov    $0x1,%esi
call   10a0 <subwin@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x150(%rbp)
mov    -0x158(%rbp),%rdi
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
mov    0x2c68(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1040 <colorbox@plt>
mov    $0x0,%al
call   1150 <normalcursor@plt>
mov    -0x10(%rbp),%rdi
mov    0x2c45(%rip),%rax
mov    (%rax),%esi
call   10e0 <nodelay@plt>
mov    -0x158(%rbp),%rdi
mov    0x2c48(%rip),%rax
mov    (%rax),%esi
call   1090 <keypad@plt>
cmpl   $0x0,-0x138(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13b8 <weditstr+0x188>
jmp    18e0 <weditstr+0x6b0>
mov    -0x158(%rbp),%rdi
mov    -0x130(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    %edx,%eax
sub    %eax,%esi
call   1140 <repainteditbox@plt>
mov    -0x158(%rbp),%rdi
call   1120 <wgetch@plt>
mov    %eax,-0x15c(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x160(%rbp)
sub    $0x9,%eax
je     154c <weditstr+0x31c>
jmp    13fa <weditstr+0x1ca>
mov    -0x160(%rbp),%eax
sub    $0xa,%eax
je     14b7 <weditstr+0x287>
jmp    140e <weditstr+0x1de>
mov    -0x160(%rbp),%eax
sub    $0x1b,%eax
je     1493 <weditstr+0x263>
jmp    1422 <weditstr+0x1f2>
mov    -0x160(%rbp),%eax
sub    $0x80,%eax
je     14b7 <weditstr+0x287>
jmp    1438 <weditstr+0x208>
mov    -0x160(%rbp),%eax
sub    $0x81,%eax
je     14f3 <weditstr+0x2c3>
jmp    144e <weditstr+0x21e>
mov    -0x160(%rbp),%eax
sub    $0x82,%eax
je     14cb <weditstr+0x29b>
jmp    1464 <weditstr+0x234>
mov    -0x160(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x2,%eax
jb     154c <weditstr+0x31c>
jmp    147d <weditstr+0x24d>
mov    -0x160(%rbp),%eax
sub    $0x85,%eax
je     14b7 <weditstr+0x287>
jmp    1597 <weditstr+0x367>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
mov    0x2b36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18db <weditstr+0x6ab>
mov    0x2b22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18db <weditstr+0x6ab>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    14ee <weditstr+0x2be>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18db <weditstr+0x6ab>
mov    0x2ace(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
mov    -0x130(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x168(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x168(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    1547 <weditstr+0x317>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    18db <weditstr+0x6ab>
mov    0x2a75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
cmpl   $0x0,-0x13c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x13c(%rbp)
cmpl   $0x0,-0x13c(%rbp)
je     158b <weditstr+0x35b>
mov    $0x0,%al
call   10c0 <insertcursor@plt>
jmp    1592 <weditstr+0x362>
mov    $0x0,%al
call   1150 <normalcursor@plt>
jmp    18db <weditstr+0x6ab>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
mov    $0x0,%al
call   1130 <erasechar@plt>
mov    %eax,%ecx
mov    -0x16c(%rbp),%eax
cmp    %ecx,%eax
jne    1626 <weditstr+0x3f6>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1621 <weditstr+0x3f1>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x180(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x130(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x180(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1110 <memmove@plt>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18d6 <weditstr+0x6a6>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    $0x0,%al
call   10f0 <killchar@plt>
mov    %eax,%ecx
mov    -0x184(%rbp),%eax
cmp    %ecx,%eax
jne    1663 <weditstr+0x433>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
jmp    18d1 <weditstr+0x6a1>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x188(%rbp)
mov    $0x0,%al
call   10b0 <wordchar@plt>
mov    %eax,%ecx
mov    -0x188(%rbp),%eax
cmp    %ecx,%eax
jne    1792 <weditstr+0x562>
mov    -0x130(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x189(%rbp)
jbe    16c4 <weditstr+0x494>
mov    -0x130(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x189(%rbp)
mov    -0x189(%rbp),%al
test   $0x1,%al
jne    16d7 <weditstr+0x4a7>
jmp    16ee <weditstr+0x4be>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    1694 <weditstr+0x464>
jmp    16f3 <weditstr+0x4c3>
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x18a(%rbp)
jbe    1723 <weditstr+0x4f3>
mov    -0x130(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x18a(%rbp)
mov    -0x18a(%rbp),%al
test   $0x1,%al
jne    1736 <weditstr+0x506>
jmp    174d <weditstr+0x51d>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    16f3 <weditstr+0x4c3>
mov    -0x130(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x128(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x128(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1a0(%rbp),%rdi
mov    -0x198(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1110 <memmove@plt>
jmp    18cc <weditstr+0x69c>
mov    -0x15c(%rbp),%edi
call   1100 <isprint@plt>
cmp    $0x0,%eax
je     18c7 <weditstr+0x697>
cmpl   $0x0,-0x134(%rbp)
je     17d7 <weditstr+0x5a7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
mov    0x27f9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
cmpl   $0x0,-0x13c(%rbp)
je     1863 <weditstr+0x633>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    185e <weditstr+0x62e>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x130(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1b0(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1110 <memmove@plt>
mov    -0x15c(%rbp),%eax
mov    %al,%cl
mov    -0x130(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x130(%rbp)
mov    %cl,(%rax)
jmp    18c2 <weditstr+0x692>
mov    -0x130(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    18bd <weditstr+0x68d>
mov    -0x130(%rbp),%rax
cmpb   $0x0,(%rax)
jne    189e <weditstr+0x66e>
mov    -0x130(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x15c(%rbp),%eax
mov    %al,%cl
mov    -0x130(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x130(%rbp)
mov    %cl,(%rax)
jmp    18c2 <weditstr+0x692>
jmp    18c7 <weditstr+0x697>
jmp    18cc <weditstr+0x69c>
jmp    18d1 <weditstr+0x6a1>
jmp    18d6 <weditstr+0x6a6>
jmp    18db <weditstr+0x6ab>
jmp    139f <weditstr+0x16f>
mov    -0x10(%rbp),%rdi
mov    0x26f5(%rip),%rax
mov    (%rax),%esi
call   10e0 <nodelay@plt>
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%esi
call   1050 <wattrset@plt>
mov    -0x158(%rbp),%rdi
mov    -0x130(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   1140 <repainteditbox@plt>
mov    -0x158(%rbp),%rdi
call   10d0 <delwin@plt>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weditstr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
test   %rsi,%rsi
je     1330 <weditstr+0x100>
mov    %edx,%ebx
cmp    $0xff,%edx
jg     1330 <weditstr+0x100>
mov    %rsi,%r14
mov    %rdi,%rbp
mov    0x2d7b(%rip),%r12
mov    (%r12),%r13d
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %rsi,%rdi
call   1060 <strlen@plt>
cmp    %ebx,%eax
jge    1330 <weditstr+0x100>
mov    %r13d,0x4(%rsp)
lea    0x20(%rsp),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
call   1080 <wrefresh@plt>
mov    %rbp,%rdi
call   1070 <getyx@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   10a0 <subwin@plt>
mov    %rax,%r13
mov    0x8(%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2cf9(%rip),%rax
mov    0x2d02(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %r15d,%r15d
mov    %r13,%rdi
xor    %edx,%edx
call   1040 <colorbox@plt>
xor    %eax,%eax
call   1150 <normalcursor@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10e0 <nodelay@plt>
mov    (%r12),%esi
mov    %r13,%rdi
call   1090 <keypad@plt>
mov    %r14,%rdi
cmpl   $0x0,(%rsp)
jne    15b3 <weditstr+0x383>
mov    %rbp,0x18(%rsp)
add    $0xffffffff,%ebx
mov    %ebx,0x8(%rsp)
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
mov    %r14,%rdi
movl   $0x0,(%rsp)
jmp    1360 <weditstr+0x130>
mov    0x2cb1(%rip),%rax
mov    (%rax),%r15d
jmp    15e6 <weditstr+0x3b6>
mov    %r14,%rdi
lea    0x20(%rsp),%rsi
call   1030 <strcpy@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
test   %ebp,%ebp
jne    15a7 <weditstr+0x377>
mov    %rdi,%rbx
mov    %rdi,%r12
sub    %r14,%r12
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
call   1140 <repainteditbox@plt>
mov    %r13,%rdi
call   1120 <wgetch@plt>
mov    %eax,%r15d
cmp    $0x7f,%eax
jle    13d0 <weditstr+0x1a0>
lea    -0x80(%r15),%eax
cmp    $0x5,%eax
ja     13ea <weditstr+0x1ba>
lea    0xc69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2c21(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
xor    %ecx,%ecx
cmp    %rax,%r12
setl   %cl
mov    %rbx,%rdi
add    %rcx,%rdi
jmp    1477 <weditstr+0x247>
nopw   0x0(%rax,%rax,1)
cmp    $0x9,%r15d
je     1430 <weditstr+0x200>
cmp    $0xa,%r15d
je     134c <weditstr+0x11c>
cmp    $0x1b,%r15d
je     133f <weditstr+0x10f>
xor    %eax,%eax
call   1130 <erasechar@plt>
cmp    %eax,%r15d
jne    147e <weditstr+0x24e>
xor    %ebp,%ebp
mov    %rbx,%rdi
cmp    %r14,%rbx
jbe    1358 <weditstr+0x128>
lea    -0x1(%rdi),%rbx
mov    %rdi,%r12
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1110 <memmove@plt>
jmp    1355 <weditstr+0x125>
nopw   0x0(%rax,%rax,1)
mov    0x2b91(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
cmpl   $0x0,(%rsp)
jne    1458 <weditstr+0x228>
xor    %ebp,%ebp
xor    %eax,%eax
call   10c0 <insertcursor@plt>
movl   $0x1,(%rsp)
jmp    1355 <weditstr+0x125>
movl   $0x0,(%rsp)
xor    %eax,%eax
call   1150 <normalcursor@plt>
xor    %ebp,%ebp
jmp    1355 <weditstr+0x125>
mov    %rbx,%rdi
cmp    %rbx,%r14
sbb    $0x0,%rdi
xor    %ebp,%ebp
jmp    1358 <weditstr+0x128>
xor    %eax,%eax
call   10f0 <killchar@plt>
cmp    %eax,%r15d
jne    1498 <weditstr+0x268>
movb   $0x0,(%r14)
xor    %ebp,%ebp
mov    %r14,%rdi
jmp    1358 <weditstr+0x128>
xor    %eax,%eax
call   10b0 <wordchar@plt>
cmp    %eax,%r15d
jne    14fd <weditstr+0x2cd>
mov    %rbx,%rbp
mov    %rbx,%rcx
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
cmp    %r14,%rcx
jbe    14d0 <weditstr+0x2a0>
lea    -0x1(%rax),%rcx
cmpb   $0x20,-0x1(%rax)
je     14b0 <weditstr+0x280>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rax,%rbx
cmp    %r14,%rax
jbe    14e2 <weditstr+0x2b2>
lea    -0x1(%rbx),%rax
cmpb   $0x20,-0x1(%rbx)
jne    14d0 <weditstr+0x2a0>
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1110 <memmove@plt>
jmp    1466 <weditstr+0x236>
mov    %r15d,%edi
call   1100 <isprint@plt>
test   %eax,%eax
je     1466 <weditstr+0x236>
cmpl   $0x0,0x4(%rsp)
je     152a <weditstr+0x2fa>
movb   $0x0,(%r14)
mov    0x2aa9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
jmp    1535 <weditstr+0x305>
movl   $0x0,0x4(%rsp)
mov    %rbx,%rdi
cmpl   $0x0,(%rsp)
je     1572 <weditstr+0x342>
mov    %rdi,%r12
mov    %r14,%rdi
call   1060 <strlen@plt>
xor    %ebp,%ebp
cmp    0x8(%rsp),%eax
jge    159f <weditstr+0x36f>
lea    0x1(%r12),%rbx
mov    %r12,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1110 <memmove@plt>
mov    %r15b,(%r12)
jmp    1355 <weditstr+0x125>
mov    %rdi,%rax
sub    %r14,%rax
movl   $0x0,(%rsp)
cmp    0x10(%rsp),%rax
jge    1477 <weditstr+0x247>
cmpb   $0x0,(%rdi)
jne    1593 <weditstr+0x363>
movb   $0x0,0x1(%rdi)
mov    %r15b,(%rdi)
add    $0x1,%rdi
jmp    1477 <weditstr+0x247>
mov    %r12,%rdi
jmp    1358 <weditstr+0x128>
mov    0x18(%rsp),%rbp
mov    0x2a2d(%rip),%r12
mov    %rdi,%rbx
mov    (%r12),%esi
mov    %rbp,%rdi
call   10e0 <nodelay@plt>
mov    %r13,%rdi
mov    0xc(%rsp),%esi
call   1050 <wattrset@plt>
sub    %r14d,%ebx
mov    %r13,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1140 <repainteditbox@plt>
mov    %r13,%rdi
call   10d0 <delwin@plt>
mov    %r15d,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_14__ = type { i32, i32, i32 }
@TRUE = global i32 0
@FALSE = global i32 0
@ERR = global i32 0
@A_BOLD = global i32 0
@A_REVERSE = global i32 0
define i32 @weditstr(%struct.TYPE_14__* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_14__*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [256 x i8]
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.TYPE_14__*
%20 = alloca i32
store %struct.TYPE_14__* %0, %struct.TYPE_14__** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%21 = load i8*, i8** %6
store i8* %21, i8** %10
%22 = load i32, i32* @TRUE
store i32 %22, i32* %11
%23 = load i32, i32* @FALSE
store i32 %23, i32* %12
%24 = load i32, i32* @FALSE
store i32 %24, i32* %13
store i32 0, i32* %20
%25 = load i32, i32* %7
%26 = icmp sge i32 %25, 256
br i1 %26, label %36, label %27
27: ; preds = %3
%28 = load i8*, i8** %6
%29 = icmp eq i8* %28, null
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = load i8*, i8** %6
%32 = call i32 @strlen(i8* %31)
%33 = load i32, i32* %7
%34 = sub nsw i32 %33, 1
%35 = icmp sgt i32 %32, %34
br i1 %35, label %36, label %38
36: ; preds = %30, %27, %3
%37 = load i32, i32* @ERR
store i32 %37, i32* %4
br label %288
38: ; preds = %30
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%40 = load i8*, i8** %6
%41 = call i32 @strcpy(i8* %39, i8* %40)
%42 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%43 = call i32 @wrefresh(%struct.TYPE_14__* %42)
%44 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%45 = load i32, i32* %14
%46 = load i32, i32* %15
%47 = call i32 @getyx(%struct.TYPE_14__* %44, i32 %45, i32 %46)
%48 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%49 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %48, i32 0, i32 0
%50 = load i32, i32* %49
store i32 %50, i32* %16
%51 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%52 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %51, i32 0, i32 1
%53 = load i32, i32* %52
store i32 %53, i32* %17
%54 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%55 = load i32, i32* %7
%56 = load i32, i32* %16
%57 = load i32, i32* %14
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %17
%60 = load i32, i32* %15
%61 = add nsw i32 %59, %60
%62 = call %struct.TYPE_14__* @subwin(%struct.TYPE_14__* %54, i32 1, i32 %55, i32 %58, i32 %61)
store %struct.TYPE_14__* %62, %struct.TYPE_14__** %19
%63 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%64 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %63, i32 0, i32 2
%65 = load i32, i32* %64
store i32 %65, i32* %18
%66 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%67 = load i32, i32* @A_BOLD
%68 = load i32, i32* @A_REVERSE
%69 = or i32 %67, %68
%70 = call i32 @colorbox(%struct.TYPE_14__* %66, i32 %69, i32 0)
%71 = call i32 (...) @normalcursor()
%72 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%73 = load i32, i32* @FALSE
%74 = call i32 @nodelay(%struct.TYPE_14__* %72, i32 %73)
%75 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%76 = load i32, i32* @TRUE
%77 = call i32 @keypad(%struct.TYPE_14__* %75, i32 %76)
br label %78
78: ; preds = %268, %38
%79 = load i32, i32* %12
%80 = icmp ne i32 %79, 0
%81 = xor i1 %80, true
br i1 %81, label %82, label %269
82: ; preds = %78
%83 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%84 = load i8*, i8** %10
%85 = load i8*, i8** %6
%86 = ptrtoint i8* %84 to i64
%87 = ptrtoint i8* %85 to i64
%88 = sub i64 %86, %87
%89 = trunc i64 %88 to i32
%90 = load i8*, i8** %6
%91 = call i32 @repainteditbox(%struct.TYPE_14__* %83, i32 %89, i8* %90)
%92 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%93 = call i32 @wgetch(%struct.TYPE_14__* %92)
store i32 %93, i32* %20
switch i32 %93, label %137 [
i32 27, label %94
i32 10, label %99
i32 128, label %99
i32 133, label %99
i32 130, label %101
i32 129, label %109
i32 9, label %124
i32 131, label %124
i32 132, label %124
]
94: ; preds = %82
%95 = load i8*, i8** %6
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%97 = call i32 @strcpy(i8* %95, i8* %96)
%98 = load i32, i32* @TRUE
store i32 %98, i32* %12
br label %268
99: ; preds = %82, %82, %82
%100 = load i32, i32* @TRUE
store i32 %100, i32* %12
br label %268
101: ; preds = %82
%102 = load i8*, i8** %10
%103 = load i8*, i8** %6
%104 = icmp ugt i8* %102, %103
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = load i8*, i8** %10
%107 = getelementptr inbounds i8, i8* %106, i32 -1
store i8* %107, i8** %10
br label %108
108: ; preds = %105, %101
br label %268
109: ; preds = %82
%110 = load i32, i32* @FALSE
store i32 %110, i32* %11
%111 = load i8*, i8** %10
%112 = load i8*, i8** %6
%113 = ptrtoint i8* %111 to i64
%114 = ptrtoint i8* %112 to i64
%115 = sub i64 %113, %114
%116 = load i8*, i8** %6
%117 = call i32 @strlen(i8* %116)
%118 = sext i32 %117 to i64
%119 = icmp slt i64 %115, %118
br i1 %119, label %120, label %123
120: ; preds = %109
%121 = load i8*, i8** %10
%122 = getelementptr inbounds i8, i8* %121, i32 1
store i8* %122, i8** %10
br label %123
123: ; preds = %120, %109
br label %268
124: ; preds = %82, %82, %82
%125 = load i32, i32* @FALSE
store i32 %125, i32* %11
%126 = load i32, i32* %13
%127 = icmp ne i32 %126, 0
%128 = xor i1 %127, true
%129 = zext i1 %128 to i32
store i32 %129, i32* %13
%130 = load i32, i32* %13
%131 = icmp ne i32 %130, 0
br i1 %131, label %132, label %134
132: ; preds = %124
%133 = call i32 (...) @insertcursor()
br label %136
134: ; preds = %124
%135 = call i32 (...) @normalcursor()
br label %136
136: ; preds = %134, %132
br label %268
137: ; preds = %82
%138 = load i32, i32* %20
%139 = call i32 (...) @erasechar()
%140 = icmp eq i32 %138, %139
br i1 %140, label %141, label %156
141: ; preds = %137
%142 = load i8*, i8** %10
%143 = load i8*, i8** %6
%144 = icmp ugt i8* %142, %143
br i1 %144, label %145, label %155
145: ; preds = %141
%146 = load i8*, i8** %10
%147 = getelementptr inbounds i8, i8* %146, i64 -1
%148 = load i8*, i8** %10
%149 = load i8*, i8** %10
%150 = call i32 @strlen(i8* %149)
%151 = add nsw i32 %150, 1
%152 = call i32 @memmove(i8* %147, i8* %148, i32 %151)
%153 = load i8*, i8** %10
%154 = getelementptr inbounds i8, i8* %153, i32 -1
store i8* %154, i8** %10
br label %155
155: ; preds = %145, %141
br label %267
156: ; preds = %137
%157 = load i32, i32* %20
%158 = call i32 (...) @killchar()
%159 = icmp eq i32 %157, %158
br i1 %159, label %160, label %163
160: ; preds = %156
%161 = load i8*, i8** %6
store i8* %161, i8** %10
%162 = load i8*, i8** %10
store i8 0, i8* %162
br label %266
163: ; preds = %156
%164 = load i32, i32* %20
%165 = call i32 (...) @wordchar()
%166 = icmp eq i32 %164, %165
br i1 %166, label %167, label %207
167: ; preds = %163
%168 = load i8*, i8** %10
store i8* %168, i8** %9
br label %169
169: ; preds = %181, %167
%170 = load i8*, i8** %10
%171 = load i8*, i8** %6
%172 = icmp ugt i8* %170, %171
br i1 %172, label %173, label %179
173: ; preds = %169
%174 = load i8*, i8** %10
%175 = getelementptr inbounds i8, i8* %174, i64 -1
%176 = load i8, i8* %175
%177 = sext i8 %176 to i32
%178 = icmp eq i32 %177, 32
br label %179
179: ; preds = %173, %169
%180 = phi i1 [ false, %169 ], [ %178, %173 ]
br i1 %180, label %181, label %184
181: ; preds = %179
%182 = load i8*, i8** %10
%183 = getelementptr inbounds i8, i8* %182, i32 -1
store i8* %183, i8** %10
br label %169
184: ; preds = %179
br label %185
185: ; preds = %197, %184
%186 = load i8*, i8** %10
%187 = load i8*, i8** %6
%188 = icmp ugt i8* %186, %187
br i1 %188, label %189, label %195
189: ; preds = %185
%190 = load i8*, i8** %10
%191 = getelementptr inbounds i8, i8* %190, i64 -1
%192 = load i8, i8* %191
%193 = sext i8 %192 to i32
%194 = icmp ne i32 %193, 32
br label %195
195: ; preds = %189, %185
%196 = phi i1 [ false, %185 ], [ %194, %189 ]
br i1 %196, label %197, label %200
197: ; preds = %195
%198 = load i8*, i8** %10
%199 = getelementptr inbounds i8, i8* %198, i32 -1
store i8* %199, i8** %10
br label %185
200: ; preds = %195
%201 = load i8*, i8** %10
%202 = load i8*, i8** %9
%203 = load i8*, i8** %9
%204 = call i32 @strlen(i8* %203)
%205 = add nsw i32 %204, 1
%206 = call i32 @memmove(i8* %201, i8* %202, i32 %205)
br label %265
207: ; preds = %163
%208 = load i32, i32* %20
%209 = call i32 @isprint(i32 %208)
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %264
211: ; preds = %207
%212 = load i32, i32* %11
%213 = icmp ne i32 %212, 0
br i1 %213, label %214, label %218
214: ; preds = %211
%215 = load i8*, i8** %6
store i8* %215, i8** %10
%216 = load i8*, i8** %10
store i8 0, i8* %216
%217 = load i32, i32* @FALSE
store i32 %217, i32* %11
br label %218
218: ; preds = %214, %211
%219 = load i32, i32* %13
%220 = icmp ne i32 %219, 0
br i1 %220, label %221, label %240
221: ; preds = %218
%222 = load i8*, i8** %6
%223 = call i32 @strlen(i8* %222)
%224 = load i32, i32* %7
%225 = sub nsw i32 %224, 1
%226 = icmp slt i32 %223, %225
br i1 %226, label %227, label %239
227: ; preds = %221
%228 = load i8*, i8** %10
%229 = getelementptr inbounds i8, i8* %228, i64 1
%230 = load i8*, i8** %10
%231 = load i8*, i8** %10
%232 = call i32 @strlen(i8* %231)
%233 = add nsw i32 %232, 1
%234 = call i32 @memmove(i8* %229, i8* %230, i32 %233)
%235 = load i32, i32* %20
%236 = trunc i32 %235 to i8
%237 = load i8*, i8** %10
%238 = getelementptr inbounds i8, i8* %237, i32 1
store i8* %238, i8** %10
store i8 %236, i8* %237
br label %239
239: ; preds = %227, %221
br label %263
240: ; preds = %218
%241 = load i8*, i8** %10
%242 = load i8*, i8** %6
%243 = ptrtoint i8* %241 to i64
%244 = ptrtoint i8* %242 to i64
%245 = sub i64 %243, %244
%246 = load i32, i32* %7
%247 = sub nsw i32 %246, 1
%248 = sext i32 %247 to i64
%249 = icmp slt i64 %245, %248
br i1 %249, label %250, label %262
250: ; preds = %240
%251 = load i8*, i8** %10
%252 = load i8, i8* %251
%253 = icmp ne i8 %252, 0
br i1 %253, label %257, label %254
254: ; preds = %250
%255 = load i8*, i8** %10
%256 = getelementptr inbounds i8, i8* %255, i64 1
store i8 0, i8* %256
br label %257
257: ; preds = %254, %250
%258 = load i32, i32* %20
%259 = trunc i32 %258 to i8
%260 = load i8*, i8** %10
%261 = getelementptr inbounds i8, i8* %260, i32 1
store i8* %261, i8** %10
store i8 %259, i8* %260
br label %262
262: ; preds = %257, %240
br label %263
263: ; preds = %262, %239
br label %264
264: ; preds = %263, %207
br label %265
265: ; preds = %264, %200
br label %266
266: ; preds = %265, %160
br label %267
267: ; preds = %266, %155
br label %268
268: ; preds = %267, %136, %123, %108, %99, %94
br label %78
269: ; preds = %78
%270 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%271 = load i32, i32* @TRUE
%272 = call i32 @nodelay(%struct.TYPE_14__* %270, i32 %271)
%273 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%274 = load i32, i32* %18
%275 = call i32 @wattrset(%struct.TYPE_14__* %273, i32 %274)
%276 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%277 = load i8*, i8** %10
%278 = load i8*, i8** %6
%279 = ptrtoint i8* %277 to i64
%280 = ptrtoint i8* %278 to i64
%281 = sub i64 %279, %280
%282 = trunc i64 %281 to i32
%283 = load i8*, i8** %6
%284 = call i32 @repainteditbox(%struct.TYPE_14__* %276, i32 %282, i8* %283)
%285 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%286 = call i32 @delwin(%struct.TYPE_14__* %285)
%287 = load i32, i32* %20
store i32 %287, i32* %4
br label %288
288: ; preds = %269, %36
%289 = load i32, i32* %4
ret i32 %289
}

LLVM IR (-O2):
%struct.TYPE_14__ = type { i32, i32, i32 }
@TRUE = global i32 0
@FALSE = global i32 0
@ERR = global i32 0
@A_BOLD = global i32 0
@A_REVERSE = global i32 0
define i32 @weditstr(%struct.TYPE_14__* %0, i8* %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* @TRUE
%7 = load i32, i32* @FALSE
%8 = icmp sgt i32 %2, 255
%9 = icmp eq i8* %1, null
%10 = or i1 %9, %8
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = tail call i32 @strlen(i8* %1)
%13 = add nsw i32 %2, -1
%14 = icmp slt i32 %12, %2
br i1 %14, label %17, label %15
15: ; preds = %11, %3
%16 = load i32, i32* @ERR
br label %155
17: ; preds = %11
%18 = call i32 @strcpy(i8* %5, i8* %1)
%19 = call i32 @wrefresh(%struct.TYPE_14__* %0)
%20 = call i32 @getyx(%struct.TYPE_14__* %0, i32 undef, i32 undef)
%21 = call %struct.TYPE_14__* @subwin(%struct.TYPE_14__* %0, i32 1, i32 %2, i32 undef, i32 undef)
%22 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %21, i64 0, i32 2
%23 = load i32, i32* %22
%24 = load i32, i32* @A_BOLD
%25 = load i32, i32* @A_REVERSE
%26 = or i32 %25, %24
%27 = call i32 @colorbox(%struct.TYPE_14__* %21, i32 %26, i32 0)
%28 = call i32 (...) @normalcursor()
%29 = load i32, i32* @FALSE
%30 = call i32 @nodelay(%struct.TYPE_14__* %0, i32 %29)
%31 = load i32, i32* @TRUE
%32 = call i32 @keypad(%struct.TYPE_14__* %21, i32 %31)
%33 = icmp eq i32 %7, 0
%34 = ptrtoint i8* %1 to i64
br i1 %33, label %35, label %145
35: ; preds = %17
%36 = sext i32 %13 to i64
br label %37
37: ; preds = %35, %137
%38 = phi i8* [ %1, %35 ], [ %141, %137 ]
%39 = phi i32 [ %6, %35 ], [ %140, %137 ]
%40 = phi i32 [ 0, %35 ], [ %138, %137 ]
%41 = ptrtoint i8* %38 to i64
%42 = sub i64 %41, %34
%43 = trunc i64 %42 to i32
%44 = call i32 @repainteditbox(%struct.TYPE_14__* %21, i32 %43, i8* %1)
%45 = call i32 @wgetch(%struct.TYPE_14__* %21)
switch i32 %45, label %69 [
i32 27, label %46
i32 10, label %49
i32 128, label %49
i32 133, label %49
i32 130, label %51
i32 129, label %55
i32 9, label %62
i32 131, label %62
i32 132, label %62
]
46: ; preds = %37
%47 = call i32 @strcpy(i8* %1, i8* %5)
%48 = load i32, i32* @TRUE
br label %137
49: ; preds = %37, %37, %37
%50 = load i32, i32* @TRUE
br label %137
51: ; preds = %37
%52 = icmp ugt i8* %38, %1
%53 = sext i1 %52 to i64
%54 = getelementptr i8, i8* %38, i64 %53
br label %137
55: ; preds = %37
%56 = load i32, i32* @FALSE
%57 = call i32 @strlen(i8* %1)
%58 = sext i32 %57 to i64
%59 = icmp slt i64 %42, %58
%60 = zext i1 %59 to i64
%61 = getelementptr i8, i8* %38, i64 %60
br label %137
62: ; preds = %37, %37, %37
%63 = load i32, i32* @FALSE
%64 = icmp eq i32 %40, 0
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 (...) @insertcursor()
br label %137
67: ; preds = %62
%68 = call i32 (...) @normalcursor()
br label %137
69: ; preds = %37
%70 = call i32 (...) @erasechar()
%71 = icmp eq i32 %45, %70
br i1 %71, label %72, label %79
72: ; preds = %69
%73 = icmp ugt i8* %38, %1
br i1 %73, label %74, label %137
74: ; preds = %72
%75 = getelementptr inbounds i8, i8* %38, i64 -1
%76 = call i32 @strlen(i8* %38)
%77 = add nsw i32 %76, 1
%78 = call i32 @memmove(i8* %75, i8* %38, i32 %77)
br label %137
79: ; preds = %69
%80 = call i32 (...) @killchar()
%81 = icmp eq i32 %45, %80
br i1 %81, label %82, label %83
82: ; preds = %79
store i8 0, i8* %1
br label %137
83: ; preds = %79
%84 = call i32 (...) @wordchar()
%85 = icmp eq i32 %45, %84
br i1 %85, label %86, label %105
86: ; preds = %83, %89
%87 = phi i8* [ %90, %89 ], [ %38, %83 ]
%88 = icmp ugt i8* %87, %1
br i1 %88, label %89, label %93
89: ; preds = %86
%90 = getelementptr inbounds i8, i8* %87, i64 -1
%91 = load i8, i8* %90
%92 = icmp eq i8 %91, 32
br i1 %92, label %86, label %93
93: ; preds = %86, %89
br label %94
94: ; preds = %93, %97
%95 = phi i8* [ %98, %97 ], [ %87, %93 ]
%96 = icmp ugt i8* %95, %1
br i1 %96, label %97, label %101
97: ; preds = %94
%98 = getelementptr inbounds i8, i8* %95, i64 -1
%99 = load i8, i8* %98
%100 = icmp eq i8 %99, 32
br i1 %100, label %101, label %94
101: ; preds = %94, %97
%102 = call i32 @strlen(i8* %38)
%103 = add nsw i32 %102, 1
%104 = call i32 @memmove(i8* %95, i8* %38, i32 %103)
br label %137
105: ; preds = %83
%106 = call i32 @isprint(i32 %45)
%107 = icmp eq i32 %106, 0
br i1 %107, label %137, label %108
108: ; preds = %105
%109 = icmp eq i32 %39, 0
br i1 %109, label %112, label %110
110: ; preds = %108
store i8 0, i8* %1
%111 = load i32, i32* @FALSE
br label %112
112: ; preds = %110, %108
%113 = phi i32 [ %111, %110 ], [ 0, %108 ]
%114 = phi i8* [ %1, %110 ], [ %38, %108 ]
%115 = icmp eq i32 %40, 0
br i1 %115, label %125, label %116
116: ; preds = %112
%117 = call i32 @strlen(i8* %1)
%118 = icmp slt i32 %117, %13
br i1 %118, label %119, label %137
119: ; preds = %116
%120 = getelementptr inbounds i8, i8* %114, i64 1
%121 = call i32 @strlen(i8* %114)
%122 = add nsw i32 %121, 1
%123 = call i32 @memmove(i8* %120, i8* %114, i32 %122)
%124 = trunc i32 %45 to i8
store i8 %124, i8* %114
br label %137
125: ; preds = %112
%126 = ptrtoint i8* %114 to i64
%127 = sub i64 %126, %34
%128 = icmp slt i64 %127, %36
br i1 %128, label %129, label %137
129: ; preds = %125
%130 = load i8, i8* %114
%131 = icmp eq i8 %130, 0
br i1 %131, label %132, label %134
132: ; preds = %129
%133 = getelementptr inbounds i8, i8* %114, i64 1
store i8 0, i8* %133
br label %134
134: ; preds = %132, %129
%135 = trunc i32 %45 to i8
%136 = getelementptr inbounds i8, i8* %114, i64 1
store i8 %135, i8* %114
br label %137
137: ; preds = %55, %51, %74, %72, %101, %119, %116, %134, %125, %105, %82, %65, %67, %49, %46
%138 = phi i32 [ %40, %74 ], [ %40, %72 ], [ %40, %82 ], [ %40, %101 ], [ %40, %119 ], [ %40, %116 ], [ 0, %134 ], [ 0, %125 ], [ %40, %105 ], [ 1, %65 ], [ 0, %67 ], [ %40, %49 ], [ %40, %46 ], [ %40, %51 ], [ %40, %55 ]
%139 = phi i32 [ 0, %74 ], [ 0, %72 ], [ 0, %82 ], [ 0, %101 ], [ 0, %119 ], [ 0, %116 ], [ 0, %134 ], [ 0, %125 ], [ 0, %105 ], [ 0, %65 ], [ 0, %67 ], [ %50, %49 ], [ %48, %46 ], [ 0, %51 ], [ 0, %55 ]
%140 = phi i32 [ %39, %74 ], [ %39, %72 ], [ %39, %82 ], [ %39, %101 ], [ %113, %119 ], [ %113, %116 ], [ %113, %134 ], [ %113, %125 ], [ %39, %105 ], [ %63, %65 ], [ %63, %67 ], [ %39, %49 ], [ %39, %46 ], [ %39, %51 ], [ %56, %55 ]
%141 = phi i8* [ %75, %74 ], [ %38, %72 ], [ %1, %82 ], [ %95, %101 ], [ %120, %119 ], [ %114, %116 ], [ %136, %134 ], [ %114, %125 ], [ %38, %105 ], [ %38, %65 ], [ %38, %67 ], [ %38, %49 ], [ %38, %46 ], [ %54, %51 ], [ %61, %55 ]
%142 = icmp eq i32 %139, 0
br i1 %142, label %37, label %143
143: ; preds = %137
%144 = ptrtoint i8* %141 to i64
br label %145
145: ; preds = %17, %143
%146 = phi i64 [ %144, %143 ], [ %34, %17 ]
%147 = phi i32 [ %45, %143 ], [ 0, %17 ]
%148 = load i32, i32* @TRUE
%149 = call i32 @nodelay(%struct.TYPE_14__* %0, i32 %148)
%150 = call i32 @wattrset(%struct.TYPE_14__* %21, i32 %23)
%151 = sub i64 %146, %34
%152 = trunc i64 %151 to i32
%153 = call i32 @repainteditbox(%struct.TYPE_14__* %21, i32 %152, i8* %1)
%154 = call i32 @delwin(%struct.TYPE_14__* %21)
br label %155
155: ; preds = %145, %15
%156 = phi i32 [ %16, %15 ], [ %147, %145 ]
ret i32 %156
}