#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 _attrs;
};
typedef TYPE_1__ WINDOW;

/* Variables and functions */
int A_BOLD;
int A_REVERSE;
#define ERR 134
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*/ curs_set(int);
int /*<<< orphan*/ delwin(TYPE_1__ *);
int erasechar();
int /*<<< orphan*/ getbegyx(TYPE_1__ *, int, int);
int /*<<< orphan*/ getyx(TYPE_1__ *, int, int);
int /*<<< orphan*/ idle();
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ keypad(TYPE_1__ *, int);
int killchar();
int /*<<< orphan*/ memmove(void *, void const *, scalar_t__);
int /*<<< orphan*/ repainteditbox(TYPE_1__ *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ 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) || ((int)strlen(buf) > field - 1))
    return ERR;
  strcpy(org, buf);
  wrefresh(win);
  getyx(win, cury, curx);
  getbegyx(win, begy, begx);
  wedit = subwin(win, 1, field, begy + cury, begx + curx);
  oldattr = wedit->_attrs;
  colorbox(wedit, (A_BOLD | A_REVERSE), 0);
  keypad(wedit, TRUE);
  curs_set(1);
  while (!stop) {
    idle();
    repainteditbox(wedit, bp - buf, buf);
    switch (c = wgetch(wedit)) {
    case ERR:
      break;
    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 < (int)strlen(buf))
        bp++;
      break;
    case '\t':
    case KEY_IC:
    case KEY_EIC:
      defdisp = FALSE;
      insert = !insert;
      curs_set(insert ? 2 : 1);
      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 ((int)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;
        }
      }
    }
  }
  curs_set(0);
  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    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
mov    0x2d5a(%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    12c3 <weditstr+0x93>
movl   $0x86,-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),%rdi
mov    -0x148(%rbp),%esi
mov    -0x14c(%rbp),%edx
call   10d0 <getbegyx@plt>
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    (%rax),%eax
mov    %eax,-0x150(%rbp)
mov    -0x158(%rbp),%rdi
mov    0x2c73(%rip),%rax
mov    (%rax),%esi
mov    0x2c7a(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1040 <colorbox@plt>
mov    -0x158(%rbp),%rdi
mov    0x2c73(%rip),%rax
mov    (%rax),%esi
call   1090 <keypad@plt>
mov    $0x1,%edi
call   1150 <curs_set@plt>
cmpl   $0x0,-0x138(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    139f <weditstr+0x16f>
jmp    18eb <weditstr+0x6bb>
xor    %eax,%eax
call   10c0 <idle@plt>
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     1556 <weditstr+0x326>
jmp    13e8 <weditstr+0x1b8>
mov    -0x160(%rbp),%eax
sub    $0xa,%eax
je     14c0 <weditstr+0x290>
jmp    13fc <weditstr+0x1cc>
mov    -0x160(%rbp),%eax
sub    $0x1b,%eax
je     149c <weditstr+0x26c>
jmp    1410 <weditstr+0x1e0>
mov    -0x160(%rbp),%eax
sub    $0x80,%eax
je     14c0 <weditstr+0x290>
jmp    1426 <weditstr+0x1f6>
mov    -0x160(%rbp),%eax
sub    $0x81,%eax
je     14fc <weditstr+0x2cc>
jmp    143c <weditstr+0x20c>
mov    -0x160(%rbp),%eax
sub    $0x82,%eax
je     14d4 <weditstr+0x2a4>
jmp    1452 <weditstr+0x222>
mov    -0x160(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x2,%eax
jb     1556 <weditstr+0x326>
jmp    146b <weditstr+0x23b>
mov    -0x160(%rbp),%eax
sub    $0x85,%eax
je     14c0 <weditstr+0x290>
jmp    1481 <weditstr+0x251>
mov    -0x160(%rbp),%eax
sub    $0x86,%eax
jne    159c <weditstr+0x36c>
jmp    1497 <weditstr+0x267>
jmp    18e6 <weditstr+0x6b6>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
mov    0x2b35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18e6 <weditstr+0x6b6>
mov    0x2b21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18e6 <weditstr+0x6b6>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    14f7 <weditstr+0x2c7>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18e6 <weditstr+0x6b6>
mov    0x2acd(%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    %rax,%rcx
mov    -0x168(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    1551 <weditstr+0x321>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    18e6 <weditstr+0x6b6>
mov    0x2a73(%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)
mov    -0x13c(%rbp),%ecx
mov    $0x1,%edi
mov    $0x2,%eax
cmp    $0x0,%ecx
cmovne %eax,%edi
call   1150 <curs_set@plt>
jmp    18e6 <weditstr+0x6b6>
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    162d <weditstr+0x3fd>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1628 <weditstr+0x3f8>
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    %rax,%rdx
add    $0x1,%rdx
call   1110 <memmove@plt>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18e1 <weditstr+0x6b1>
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    166a <weditstr+0x43a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
jmp    18dc <weditstr+0x6ac>
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    179b <weditstr+0x56b>
mov    -0x130(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x189(%rbp)
jbe    16cb <weditstr+0x49b>
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    16de <weditstr+0x4ae>
jmp    16f5 <weditstr+0x4c5>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    169b <weditstr+0x46b>
jmp    16fa <weditstr+0x4ca>
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x18a(%rbp)
jbe    172a <weditstr+0x4fa>
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    173d <weditstr+0x50d>
jmp    1754 <weditstr+0x524>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    16fa <weditstr+0x4ca>
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    %rax,%rdx
add    $0x1,%rdx
call   1110 <memmove@plt>
jmp    18d7 <weditstr+0x6a7>
mov    -0x15c(%rbp),%edi
call   1100 <isprint@plt>
cmp    $0x0,%eax
je     18d2 <weditstr+0x6a2>
cmpl   $0x0,-0x134(%rbp)
je     17e0 <weditstr+0x5b0>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
mov    0x27f8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
cmpl   $0x0,-0x13c(%rbp)
je     186e <weditstr+0x63e>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1869 <weditstr+0x639>
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    %rax,%rdx
add    $0x1,%rdx
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    18cd <weditstr+0x69d>
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    18c8 <weditstr+0x698>
mov    -0x130(%rbp),%rax
cmpb   $0x0,(%rax)
jne    18a9 <weditstr+0x679>
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    18cd <weditstr+0x69d>
jmp    18d2 <weditstr+0x6a2>
jmp    18d7 <weditstr+0x6a7>
jmp    18dc <weditstr+0x6ac>
jmp    18e1 <weditstr+0x6b1>
jmp    18e6 <weditstr+0x6b6>
jmp    1386 <weditstr+0x156>
xor    %edi,%edi
call   1150 <curs_set@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   10e0 <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
mov    $0x86,%ebp
test   %rsi,%rsi
je     15c2 <weditstr+0x392>
mov    %edx,%r13d
cmp    $0xff,%edx
jg     15c2 <weditstr+0x392>
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x2d7d(%rip),%r14
mov    (%r14),%r15d
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %rsi,%rdi
call   1060 <strlen@plt>
cmp    %r13d,%eax
jge    15c2 <weditstr+0x392>
mov    %r15d,0x4(%rsp)
lea    0x20(%rsp),%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1080 <wrefresh@plt>
mov    %rbx,%rdi
call   1070 <getyx@plt>
mov    %rbx,%rdi
call   10d0 <getbegyx@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
call   10a0 <subwin@plt>
mov    %rax,%rbx
mov    %r14,%r15
mov    (%rax),%r14d
mov    0x2cf3(%rip),%rax
mov    0x2cfc(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %edx,%edx
call   1040 <colorbox@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1090 <keypad@plt>
mov    $0x1,%edi
call   1150 <curs_set@plt>
mov    %r12,%r15
cmpl   $0x0,(%rsp)
jne    1597 <weditstr+0x367>
mov    %r14d,0x14(%rsp)
add    $0xffffffff,%r13d
mov    %r13d,0x10(%rsp)
movslq %r13d,%rax
mov    %rax,0x18(%rsp)
mov    %r12,%r15
movl   $0x0,(%rsp)
mov    %rbx,0x8(%rsp)
jmp    1355 <weditstr+0x125>
mov    %r12,%rdi
lea    0x20(%rsp),%rsi
call   1030 <strcpy@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%r14d
test   %r14d,%r14d
jne    1592 <weditstr+0x362>
xor    %eax,%eax
call   10c0 <idle@plt>
mov    %r15,%r13
sub    %r12,%r13
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12,%rdx
call   1140 <repainteditbox@plt>
mov    %rbx,%rdi
call   1120 <wgetch@plt>
mov    %eax,%ebp
cmp    $0x7f,%eax
jle    13d0 <weditstr+0x1a0>
lea    -0x80(%rbp),%eax
cmp    $0x6,%eax
ja     13e7 <weditstr+0x1b7>
lea    0xc72(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
xor    %r14d,%r14d
jmp    *%rax
mov    0x2c2f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r12,%rdi
call   1060 <strlen@plt>
cltq
xor    %ecx,%ecx
cmp    %rax,%r13
setl   %cl
add    %rcx,%r15
xor    %r14d,%r14d
jmp    134c <weditstr+0x11c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x9,%ebp
je     1420 <weditstr+0x1f0>
cmp    $0xa,%ebp
je     1342 <weditstr+0x112>
cmp    $0x1b,%ebp
je     1335 <weditstr+0x105>
xor    %eax,%eax
call   1130 <erasechar@plt>
cmp    %eax,%ebp
jne    145f <weditstr+0x22f>
cmp    %r12,%r15
jbe    14da <weditstr+0x2aa>
mov    %r15,%rbx
add    $0xffffffffffffffff,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
jmp    14d5 <weditstr+0x2a5>
nopl   0x0(%rax)
mov    0x2ba9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
xor    %ebx,%ebx
cmpl   $0x0,(%rsp)
sete   %bl
lea    0x1(%rbx),%edi
call   1150 <curs_set@plt>
mov    %ebx,%eax
mov    %ebx,(%rsp)
mov    0x8(%rsp),%rbx
xor    %r14d,%r14d
jmp    134c <weditstr+0x11c>
cmp    %r15,%r12
sbb    $0x0,%r15
xor    %r14d,%r14d
jmp    134c <weditstr+0x11c>
xor    %eax,%eax
call   10f0 <killchar@plt>
cmp    %eax,%ebp
jne    147a <weditstr+0x24a>
movb   $0x0,(%r12)
xor    %r14d,%r14d
mov    %r12,%r15
jmp    134c <weditstr+0x11c>
mov    %r15,%r13
xor    %eax,%eax
call   10b0 <wordchar@plt>
cmp    %eax,%ebp
jne    14e7 <weditstr+0x2b7>
mov    %r13,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
cmp    %r12,%rcx
jbe    14b0 <weditstr+0x280>
lea    -0x1(%rax),%rcx
cmpb   $0x20,-0x1(%rax)
je     1490 <weditstr+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rax,%r15
cmp    %r12,%rax
jbe    14c3 <weditstr+0x293>
lea    -0x1(%r15),%rax
cmpb   $0x20,-0x1(%r15)
jne    14b0 <weditstr+0x280>
mov    %r13,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r13,%rsi
call   1110 <memmove@plt>
xor    %r14d,%r14d
mov    0x8(%rsp),%rbx
jmp    134c <weditstr+0x11c>
mov    %ebp,%edi
call   1100 <isprint@plt>
test   %eax,%eax
je     1510 <weditstr+0x2e0>
cmpl   $0x0,0x4(%rsp)
je     1518 <weditstr+0x2e8>
movb   $0x0,(%r12)
mov    0x2acb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r12,%r13
jmp    1520 <weditstr+0x2f0>
xor    %r14d,%r14d
jmp    134c <weditstr+0x11c>
movl   $0x0,0x4(%rsp)
mov    0x10(%rsp),%ebx
cmpl   $0x0,(%rsp)
je     155a <weditstr+0x32a>
mov    %r12,%rdi
call   1060 <strlen@plt>
xor    %r14d,%r14d
cmp    %eax,%ebx
jle    158a <weditstr+0x35a>
lea    0x1(%r13),%r15
mov    %r13,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r13,%rsi
call   1110 <memmove@plt>
mov    %bpl,0x0(%r13)
jmp    14dd <weditstr+0x2ad>
mov    %r13,%rax
sub    %r12,%rax
movl   $0x0,(%rsp)
cmp    0x18(%rsp),%rax
jge    1582 <weditstr+0x352>
cmpb   $0x0,0x0(%r13)
jne    157a <weditstr+0x34a>
movb   $0x0,0x1(%r13)
mov    %bpl,0x0(%r13)
add    $0x1,%r13
mov    %r13,%r15
jmp    14da <weditstr+0x2aa>
mov    %r13,%r15
jmp    14dd <weditstr+0x2ad>
mov    0x14(%rsp),%r14d
xor    %edi,%edi
call   1150 <curs_set@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <wattrset@plt>
sub    %r12d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12,%rdx
call   1140 <repainteditbox@plt>
mov    %rbx,%rdi
call   10e0 <delwin@plt>
mov    %ebp,%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 }
@TRUE = global i32 0
@FALSE = 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 %37, label %27
27: ; preds = %3
%28 = load i8*, i8** %6
%29 = icmp eq i8* %28, null
br i1 %29, label %37, label %30
30: ; preds = %27
%31 = load i8*, i8** %6
%32 = call i64 @strlen(i8* %31)
%33 = trunc i64 %32 to i32
%34 = load i32, i32* %7
%35 = sub nsw i32 %34, 1
%36 = icmp sgt i32 %33, %35
br i1 %36, label %37, label %38
37: ; preds = %30, %27, %3
store i32 134, i32* %4
br label %283
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 = load i32, i32* %16
%50 = load i32, i32* %17
%51 = call i32 @getbegyx(%struct.TYPE_14__* %48, i32 %49, i32 %50)
%52 = load %struct.TYPE_14__*, %struct.TYPE_14__** %5
%53 = load i32, i32* %7
%54 = load i32, i32* %16
%55 = load i32, i32* %14
%56 = add nsw i32 %54, %55
%57 = load i32, i32* %17
%58 = load i32, i32* %15
%59 = add nsw i32 %57, %58
%60 = call %struct.TYPE_14__* @subwin(%struct.TYPE_14__* %52, i32 1, i32 %53, i32 %56, i32 %59)
store %struct.TYPE_14__* %60, %struct.TYPE_14__** %19
%61 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%62 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %61, i32 0, i32 0
%63 = load i32, i32* %62
store i32 %63, i32* %18
%64 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%65 = load i32, i32* @A_BOLD
%66 = load i32, i32* @A_REVERSE
%67 = or i32 %65, %66
%68 = call i32 @colorbox(%struct.TYPE_14__* %64, i32 %67, i32 0)
%69 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%70 = load i32, i32* @TRUE
%71 = call i32 @keypad(%struct.TYPE_14__* %69, i32 %70)
%72 = call i32 @curs_set(i32 1)
br label %73
73: ; preds = %265, %38
%74 = load i32, i32* %12
%75 = icmp ne i32 %74, 0
%76 = xor i1 %75, true
br i1 %76, label %77, label %266
77: ; preds = %73
%78 = call i32 (...) @idle()
%79 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%80 = load i8*, i8** %10
%81 = load i8*, i8** %6
%82 = ptrtoint i8* %80 to i64
%83 = ptrtoint i8* %81 to i64
%84 = sub i64 %82, %83
%85 = trunc i64 %84 to i32
%86 = load i8*, i8** %6
%87 = call i32 @repainteditbox(%struct.TYPE_14__* %79, i32 %85, i8* %86)
%88 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%89 = call i32 @wgetch(%struct.TYPE_14__* %88)
store i32 %89, i32* %20
switch i32 %89, label %133 [
i32 134, label %90
i32 27, label %91
i32 10, label %96
i32 128, label %96
i32 133, label %96
i32 130, label %98
i32 129, label %106
i32 9, label %122
i32 131, label %122
i32 132, label %122
]
90: ; preds = %77
br label %265
91: ; preds = %77
%92 = load i8*, i8** %6
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%94 = call i32 @strcpy(i8* %92, i8* %93)
%95 = load i32, i32* @TRUE
store i32 %95, i32* %12
br label %265
96: ; preds = %77, %77, %77
%97 = load i32, i32* @TRUE
store i32 %97, i32* %12
br label %265
98: ; preds = %77
%99 = load i8*, i8** %10
%100 = load i8*, i8** %6
%101 = icmp ugt i8* %99, %100
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = load i8*, i8** %10
%104 = getelementptr inbounds i8, i8* %103, i32 -1
store i8* %104, i8** %10
br label %105
105: ; preds = %102, %98
br label %265
106: ; preds = %77
%107 = load i32, i32* @FALSE
store i32 %107, i32* %11
%108 = load i8*, i8** %10
%109 = load i8*, i8** %6
%110 = ptrtoint i8* %108 to i64
%111 = ptrtoint i8* %109 to i64
%112 = sub i64 %110, %111
%113 = load i8*, i8** %6
%114 = call i64 @strlen(i8* %113)
%115 = trunc i64 %114 to i32
%116 = sext i32 %115 to i64
%117 = icmp slt i64 %112, %116
br i1 %117, label %118, label %121
118: ; preds = %106
%119 = load i8*, i8** %10
%120 = getelementptr inbounds i8, i8* %119, i32 1
store i8* %120, i8** %10
br label %121
121: ; preds = %118, %106
br label %265
122: ; preds = %77, %77, %77
%123 = load i32, i32* @FALSE
store i32 %123, i32* %11
%124 = load i32, i32* %13
%125 = icmp ne i32 %124, 0
%126 = xor i1 %125, true
%127 = zext i1 %126 to i32
store i32 %127, i32* %13
%128 = load i32, i32* %13
%129 = icmp ne i32 %128, 0
%130 = zext i1 %129 to i64
%131 = select i1 %129, i32 2, i32 1
%132 = call i32 @curs_set(i32 %131)
br label %265
133: ; preds = %77
%134 = load i32, i32* %20
%135 = call i32 (...) @erasechar()
%136 = icmp eq i32 %134, %135
br i1 %136, label %137, label %152
137: ; preds = %133
%138 = load i8*, i8** %10
%139 = load i8*, i8** %6
%140 = icmp ugt i8* %138, %139
br i1 %140, label %141, label %151
141: ; preds = %137
%142 = load i8*, i8** %10
%143 = getelementptr inbounds i8, i8* %142, i64 -1
%144 = load i8*, i8** %10
%145 = load i8*, i8** %10
%146 = call i64 @strlen(i8* %145)
%147 = add nsw i64 %146, 1
%148 = call i32 @memmove(i8* %143, i8* %144, i64 %147)
%149 = load i8*, i8** %10
%150 = getelementptr inbounds i8, i8* %149, i32 -1
store i8* %150, i8** %10
br label %151
151: ; preds = %141, %137
br label %264
152: ; preds = %133
%153 = load i32, i32* %20
%154 = call i32 (...) @killchar()
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %159
156: ; preds = %152
%157 = load i8*, i8** %6
store i8* %157, i8** %10
%158 = load i8*, i8** %10
store i8 0, i8* %158
br label %263
159: ; preds = %152
%160 = load i32, i32* %20
%161 = call i32 (...) @wordchar()
%162 = icmp eq i32 %160, %161
br i1 %162, label %163, label %203
163: ; preds = %159
%164 = load i8*, i8** %10
store i8* %164, i8** %9
br label %165
165: ; preds = %177, %163
%166 = load i8*, i8** %10
%167 = load i8*, i8** %6
%168 = icmp ugt i8* %166, %167
br i1 %168, label %169, label %175
169: ; preds = %165
%170 = load i8*, i8** %10
%171 = getelementptr inbounds i8, i8* %170, i64 -1
%172 = load i8, i8* %171
%173 = sext i8 %172 to i32
%174 = icmp eq i32 %173, 32
br label %175
175: ; preds = %169, %165
%176 = phi i1 [ false, %165 ], [ %174, %169 ]
br i1 %176, label %177, label %180
177: ; preds = %175
%178 = load i8*, i8** %10
%179 = getelementptr inbounds i8, i8* %178, i32 -1
store i8* %179, i8** %10
br label %165
180: ; preds = %175
br label %181
181: ; preds = %193, %180
%182 = load i8*, i8** %10
%183 = load i8*, i8** %6
%184 = icmp ugt i8* %182, %183
br i1 %184, label %185, label %191
185: ; preds = %181
%186 = load i8*, i8** %10
%187 = getelementptr inbounds i8, i8* %186, i64 -1
%188 = load i8, i8* %187
%189 = sext i8 %188 to i32
%190 = icmp ne i32 %189, 32
br label %191
191: ; preds = %185, %181
%192 = phi i1 [ false, %181 ], [ %190, %185 ]
br i1 %192, label %193, label %196
193: ; preds = %191
%194 = load i8*, i8** %10
%195 = getelementptr inbounds i8, i8* %194, i32 -1
store i8* %195, i8** %10
br label %181
196: ; preds = %191
%197 = load i8*, i8** %10
%198 = load i8*, i8** %9
%199 = load i8*, i8** %9
%200 = call i64 @strlen(i8* %199)
%201 = add nsw i64 %200, 1
%202 = call i32 @memmove(i8* %197, i8* %198, i64 %201)
br label %262
203: ; preds = %159
%204 = load i32, i32* %20
%205 = call i32 @isprint(i32 %204)
%206 = icmp ne i32 %205, 0
br i1 %206, label %207, label %261
207: ; preds = %203
%208 = load i32, i32* %11
%209 = icmp ne i32 %208, 0
br i1 %209, label %210, label %214
210: ; preds = %207
%211 = load i8*, i8** %6
store i8* %211, i8** %10
%212 = load i8*, i8** %10
store i8 0, i8* %212
%213 = load i32, i32* @FALSE
store i32 %213, i32* %11
br label %214
214: ; preds = %210, %207
%215 = load i32, i32* %13
%216 = icmp ne i32 %215, 0
br i1 %216, label %217, label %237
217: ; preds = %214
%218 = load i8*, i8** %6
%219 = call i64 @strlen(i8* %218)
%220 = trunc i64 %219 to i32
%221 = load i32, i32* %7
%222 = sub nsw i32 %221, 1
%223 = icmp slt i32 %220, %222
br i1 %223, label %224, label %236
224: ; preds = %217
%225 = load i8*, i8** %10
%226 = getelementptr inbounds i8, i8* %225, i64 1
%227 = load i8*, i8** %10
%228 = load i8*, i8** %10
%229 = call i64 @strlen(i8* %228)
%230 = add nsw i64 %229, 1
%231 = call i32 @memmove(i8* %226, i8* %227, i64 %230)
%232 = load i32, i32* %20
%233 = trunc i32 %232 to i8
%234 = load i8*, i8** %10
%235 = getelementptr inbounds i8, i8* %234, i32 1
store i8* %235, i8** %10
store i8 %233, i8* %234
br label %236
236: ; preds = %224, %217
br label %260
237: ; preds = %214
%238 = load i8*, i8** %10
%239 = load i8*, i8** %6
%240 = ptrtoint i8* %238 to i64
%241 = ptrtoint i8* %239 to i64
%242 = sub i64 %240, %241
%243 = load i32, i32* %7
%244 = sub nsw i32 %243, 1
%245 = sext i32 %244 to i64
%246 = icmp slt i64 %242, %245
br i1 %246, label %247, label %259
247: ; preds = %237
%248 = load i8*, i8** %10
%249 = load i8, i8* %248
%250 = icmp ne i8 %249, 0
br i1 %250, label %254, label %251
251: ; preds = %247
%252 = load i8*, i8** %10
%253 = getelementptr inbounds i8, i8* %252, i64 1
store i8 0, i8* %253
br label %254
254: ; preds = %251, %247
%255 = load i32, i32* %20
%256 = trunc i32 %255 to i8
%257 = load i8*, i8** %10
%258 = getelementptr inbounds i8, i8* %257, i32 1
store i8* %258, i8** %10
store i8 %256, i8* %257
br label %259
259: ; preds = %254, %237
br label %260
260: ; preds = %259, %236
br label %261
261: ; preds = %260, %203
br label %262
262: ; preds = %261, %196
br label %263
263: ; preds = %262, %156
br label %264
264: ; preds = %263, %151
br label %265
265: ; preds = %264, %122, %121, %105, %96, %91, %90
br label %73
266: ; preds = %73
%267 = call i32 @curs_set(i32 0)
%268 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%269 = load i32, i32* %18
%270 = call i32 @wattrset(%struct.TYPE_14__* %268, i32 %269)
%271 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%272 = load i8*, i8** %10
%273 = load i8*, i8** %6
%274 = ptrtoint i8* %272 to i64
%275 = ptrtoint i8* %273 to i64
%276 = sub i64 %274, %275
%277 = trunc i64 %276 to i32
%278 = load i8*, i8** %6
%279 = call i32 @repainteditbox(%struct.TYPE_14__* %271, i32 %277, i8* %278)
%280 = load %struct.TYPE_14__*, %struct.TYPE_14__** %19
%281 = call i32 @delwin(%struct.TYPE_14__* %280)
%282 = load i32, i32* %20
store i32 %282, i32* %4
br label %283
283: ; preds = %266, %37
%284 = load i32, i32* %4
ret i32 %284
}

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