#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ chtype;
typedef int /*<<< orphan*/ 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(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ curs_set(int);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int erasechar();
int /*<<< orphan*/ getattrs(int /*<<< orphan*/ *);
int /*<<< orphan*/ getbegyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ getyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ idle();
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int);
int killchar();
int /*<<< orphan*/ memmove(void *, void const *, scalar_t__);
int /*<<< orphan*/ repainteditbox(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ *subwin(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int wgetch(int /*<<< orphan*/ *);
int wordchar();
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
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;
  chtype 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 = getattrs(wedit);
  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    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
mov    0x2d4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x13c(%rbp)
movl   $0x0,-0x15c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    12c7 <weditstr+0x87>
cmpq   $0x0,-0x18(%rbp)
je     12c7 <weditstr+0x87>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    12d3 <weditstr+0x93>
movl   $0x86,-0x4(%rbp)
jmp    194c <weditstr+0x70c>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1090 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
mov    -0x140(%rbp),%esi
mov    -0x144(%rbp),%edx
call   1080 <getyx@plt>
mov    -0x10(%rbp),%rdi
mov    -0x148(%rbp),%esi
mov    -0x14c(%rbp),%edx
call   10e0 <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   10b0 <subwin@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
call   1030 <getattrs@plt>
mov    %eax,-0x150(%rbp)
mov    -0x158(%rbp),%rdi
mov    0x2c60(%rip),%rax
mov    (%rax),%esi
mov    0x2c67(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1050 <colorbox@plt>
mov    -0x158(%rbp),%rdi
mov    0x2c60(%rip),%rax
mov    (%rax),%esi
call   10a0 <keypad@plt>
mov    $0x1,%edi
call   1160 <curs_set@plt>
cmpl   $0x0,-0x138(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13b2 <weditstr+0x172>
jmp    18fe <weditstr+0x6be>
xor    %eax,%eax
call   10d0 <idle@plt>
mov    -0x158(%rbp),%rdi
mov    -0x130(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    %edx,%eax
sub    %eax,%esi
call   1150 <repainteditbox@plt>
mov    -0x158(%rbp),%rdi
call   1130 <wgetch@plt>
mov    %eax,-0x15c(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x160(%rbp)
sub    $0x9,%eax
je     1569 <weditstr+0x329>
jmp    13fb <weditstr+0x1bb>
mov    -0x160(%rbp),%eax
sub    $0xa,%eax
je     14d3 <weditstr+0x293>
jmp    140f <weditstr+0x1cf>
mov    -0x160(%rbp),%eax
sub    $0x1b,%eax
je     14af <weditstr+0x26f>
jmp    1423 <weditstr+0x1e3>
mov    -0x160(%rbp),%eax
sub    $0x80,%eax
je     14d3 <weditstr+0x293>
jmp    1439 <weditstr+0x1f9>
mov    -0x160(%rbp),%eax
sub    $0x81,%eax
je     150f <weditstr+0x2cf>
jmp    144f <weditstr+0x20f>
mov    -0x160(%rbp),%eax
sub    $0x82,%eax
je     14e7 <weditstr+0x2a7>
jmp    1465 <weditstr+0x225>
mov    -0x160(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x2,%eax
jb     1569 <weditstr+0x329>
jmp    147e <weditstr+0x23e>
mov    -0x160(%rbp),%eax
sub    $0x85,%eax
je     14d3 <weditstr+0x293>
jmp    1494 <weditstr+0x254>
mov    -0x160(%rbp),%eax
sub    $0x86,%eax
jne    15af <weditstr+0x36f>
jmp    14aa <weditstr+0x26a>
jmp    18f9 <weditstr+0x6b9>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <strcpy@plt>
mov    0x2b22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18f9 <weditstr+0x6b9>
mov    0x2b0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
jmp    18f9 <weditstr+0x6b9>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    150a <weditstr+0x2ca>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18f9 <weditstr+0x6b9>
mov    0x2aba(%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   1070 <strlen@plt>
mov    %rax,%rcx
mov    -0x168(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    1564 <weditstr+0x324>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    18f9 <weditstr+0x6b9>
mov    0x2a60(%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   1160 <curs_set@plt>
jmp    18f9 <weditstr+0x6b9>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
mov    $0x0,%al
call   1140 <erasechar@plt>
mov    %eax,%ecx
mov    -0x16c(%rbp),%eax
cmp    %ecx,%eax
jne    1640 <weditstr+0x400>
mov    -0x130(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    163b <weditstr+0x3fb>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x180(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x130(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x180(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1120 <memmove@plt>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    18f4 <weditstr+0x6b4>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    $0x0,%al
call   1100 <killchar@plt>
mov    %eax,%ecx
mov    -0x184(%rbp),%eax
cmp    %ecx,%eax
jne    167d <weditstr+0x43d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
jmp    18ef <weditstr+0x6af>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x188(%rbp)
mov    $0x0,%al
call   10c0 <wordchar@plt>
mov    %eax,%ecx
mov    -0x188(%rbp),%eax
cmp    %ecx,%eax
jne    17ae <weditstr+0x56e>
mov    -0x130(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x189(%rbp)
jbe    16de <weditstr+0x49e>
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    16f1 <weditstr+0x4b1>
jmp    1708 <weditstr+0x4c8>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    16ae <weditstr+0x46e>
jmp    170d <weditstr+0x4cd>
mov    -0x130(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x18a(%rbp)
jbe    173d <weditstr+0x4fd>
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    1750 <weditstr+0x510>
jmp    1767 <weditstr+0x527>
mov    -0x130(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x130(%rbp)
jmp    170d <weditstr+0x4cd>
mov    -0x130(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x128(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x128(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1a0(%rbp),%rdi
mov    -0x198(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1120 <memmove@plt>
jmp    18ea <weditstr+0x6aa>
mov    -0x15c(%rbp),%edi
call   1110 <isprint@plt>
cmp    $0x0,%eax
je     18e5 <weditstr+0x6a5>
cmpl   $0x0,-0x134(%rbp)
je     17f3 <weditstr+0x5b3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
movb   $0x0,(%rax)
mov    0x27e5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
cmpl   $0x0,-0x13c(%rbp)
je     1881 <weditstr+0x641>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    187c <weditstr+0x63c>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x130(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1b0(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1120 <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    18e0 <weditstr+0x6a0>
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    18db <weditstr+0x69b>
mov    -0x130(%rbp),%rax
cmpb   $0x0,(%rax)
jne    18bc <weditstr+0x67c>
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    18e0 <weditstr+0x6a0>
jmp    18e5 <weditstr+0x6a5>
jmp    18ea <weditstr+0x6aa>
jmp    18ef <weditstr+0x6af>
jmp    18f4 <weditstr+0x6b4>
jmp    18f9 <weditstr+0x6b9>
jmp    1399 <weditstr+0x159>
xor    %edi,%edi
call   1160 <curs_set@plt>
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%esi
call   1060 <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   1150 <repainteditbox@plt>
mov    -0x158(%rbp),%rdi
call   10f0 <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     15d2 <weditstr+0x392>
mov    %edx,%r13d
cmp    $0xff,%edx
jg     15d2 <weditstr+0x392>
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x2d6d(%rip),%r14
mov    (%r14),%r15d
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %rsi,%rdi
call   1070 <strlen@plt>
cmp    %r13d,%eax
jge    15d2 <weditstr+0x392>
mov    %r15d,0x4(%rsp)
lea    0x20(%rsp),%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1090 <wrefresh@plt>
mov    %rbx,%rdi
call   1080 <getyx@plt>
mov    %rbx,%rdi
call   10e0 <getbegyx@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
call   10b0 <subwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <getattrs@plt>
mov    %r14,%r15
mov    %eax,%r14d
mov    0x2cdb(%rip),%rax
mov    0x2ce4(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <colorbox@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   10a0 <keypad@plt>
mov    $0x1,%edi
call   1160 <curs_set@plt>
mov    %r12,%r15
cmpl   $0x0,(%rsp)
jne    15a7 <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    136d <weditstr+0x12d>
mov    %r12,%rdi
lea    0x20(%rsp),%rsi
call   1040 <strcpy@plt>
mov    0x2c87(%rip),%rax
mov    (%rax),%r14d
test   %r14d,%r14d
jne    15a2 <weditstr+0x362>
xor    %eax,%eax
call   10d0 <idle@plt>
mov    %r15,%r13
sub    %r12,%r13
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12,%rdx
call   1150 <repainteditbox@plt>
mov    %rbx,%rdi
call   1130 <wgetch@plt>
mov    %eax,%ebp
cmp    $0x7f,%eax
jle    13e0 <weditstr+0x1a0>
lea    -0x80(%rbp),%eax
cmp    $0x6,%eax
ja     13f7 <weditstr+0x1b7>
lea    0xc5a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
xor    %r14d,%r14d
jmp    *%rax
mov    0x2c17(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r12,%rdi
call   1070 <strlen@plt>
cltq
xor    %ecx,%ecx
cmp    %rax,%r13
setl   %cl
add    %rcx,%r15
xor    %r14d,%r14d
jmp    1364 <weditstr+0x124>
nopl   0x0(%rax)
cmp    $0x9,%ebp
je     1430 <weditstr+0x1f0>
cmp    $0xa,%ebp
je     135a <weditstr+0x11a>
cmp    $0x1b,%ebp
je     134d <weditstr+0x10d>
xor    %eax,%eax
call   1140 <erasechar@plt>
cmp    %eax,%ebp
jne    146f <weditstr+0x22f>
cmp    %r12,%r15
jbe    14ea <weditstr+0x2aa>
mov    %r15,%rbx
add    $0xffffffffffffffff,%r15
mov    %rbx,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
jmp    14e5 <weditstr+0x2a5>
nopl   0x0(%rax)
mov    0x2b99(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
xor    %ebx,%ebx
cmpl   $0x0,(%rsp)
sete   %bl
lea    0x1(%rbx),%edi
call   1160 <curs_set@plt>
mov    %ebx,%eax
mov    %ebx,(%rsp)
mov    0x8(%rsp),%rbx
xor    %r14d,%r14d
jmp    1364 <weditstr+0x124>
cmp    %r15,%r12
sbb    $0x0,%r15
xor    %r14d,%r14d
jmp    1364 <weditstr+0x124>
xor    %eax,%eax
call   1100 <killchar@plt>
cmp    %eax,%ebp
jne    148a <weditstr+0x24a>
movb   $0x0,(%r12)
xor    %r14d,%r14d
mov    %r12,%r15
jmp    1364 <weditstr+0x124>
mov    %r15,%r13
xor    %eax,%eax
call   10c0 <wordchar@plt>
cmp    %eax,%ebp
jne    14f7 <weditstr+0x2b7>
mov    %r13,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
cmp    %r12,%rcx
jbe    14c0 <weditstr+0x280>
lea    -0x1(%rax),%rcx
cmpb   $0x20,-0x1(%rax)
je     14a0 <weditstr+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rax,%r15
cmp    %r12,%rax
jbe    14d3 <weditstr+0x293>
lea    -0x1(%r15),%rax
cmpb   $0x20,-0x1(%r15)
jne    14c0 <weditstr+0x280>
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r13,%rsi
call   1120 <memmove@plt>
xor    %r14d,%r14d
mov    0x8(%rsp),%rbx
jmp    1364 <weditstr+0x124>
mov    %ebp,%edi
call   1110 <isprint@plt>
test   %eax,%eax
je     1520 <weditstr+0x2e0>
cmpl   $0x0,0x4(%rsp)
je     1528 <weditstr+0x2e8>
movb   $0x0,(%r12)
mov    0x2abb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %r12,%r13
jmp    1530 <weditstr+0x2f0>
xor    %r14d,%r14d
jmp    1364 <weditstr+0x124>
movl   $0x0,0x4(%rsp)
mov    0x10(%rsp),%ebx
cmpl   $0x0,(%rsp)
je     156a <weditstr+0x32a>
mov    %r12,%rdi
call   1070 <strlen@plt>
xor    %r14d,%r14d
cmp    %eax,%ebx
jle    159a <weditstr+0x35a>
lea    0x1(%r13),%r15
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r13,%rsi
call   1120 <memmove@plt>
mov    %bpl,0x0(%r13)
jmp    14ed <weditstr+0x2ad>
mov    %r13,%rax
sub    %r12,%rax
movl   $0x0,(%rsp)
cmp    0x18(%rsp),%rax
jge    1592 <weditstr+0x352>
cmpb   $0x0,0x0(%r13)
jne    158a <weditstr+0x34a>
movb   $0x0,0x1(%r13)
mov    %bpl,0x0(%r13)
add    $0x1,%r13
mov    %r13,%r15
jmp    14ea <weditstr+0x2aa>
mov    %r13,%r15
jmp    14ed <weditstr+0x2ad>
mov    0x14(%rsp),%r14d
xor    %edi,%edi
call   1160 <curs_set@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <wattrset@plt>
sub    %r12d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12,%rdx
call   1150 <repainteditbox@plt>
mov    %rbx,%rdi
call   10f0 <delwin@plt>
mov    %ebp,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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