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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ api_boxfilwin(int, int, int, int, int, int);
int /*<<< orphan*/ api_cmdline(char *, int);
int /*<<< orphan*/ api_end();
int /*<<< orphan*/ api_fclose(int);
int api_fopen(char *);
int /*<<< orphan*/ api_fread(char *, int, int);
int api_fsize(int, int /*<<< orphan*/);
char api_getkey(int);
int api_getlang();
int api_openwin(char *, int, int, int, char *);
int /*<<< orphan*/ api_putstr0(char *);
char *skipspace(char *);
int strtol(char *, char **, int /*<<< orphan*/);
int /*<<< orphan*/ textview(int, int, int, int, char *, int, int);
void HariMain(void) {
  char winbuf[1024 * 757], txtbuf[240 * 1024];
  int w = 30, h = 10, t = 4, spd_x = 1, spd_y = 1;
  int win, i, j, lang = api_getlang(), xskip = 0;
  char s[30], *p, *q = 0, *r = 0;
  api_cmdline(s, 30);
  for (p = s; *p > ' '; p++) {
  }
  for (; *p != 0;) {
    p = skipspace(p);
    if (*p == '-') {
      if (p[1] == 'w') {
        w = strtol(p + 2, &p, 0);
        if (w < 20) {
          w = 20;
        }
        if (w > 126) {
          w = 126;
        }
      } else if (p[1] == 'h') {
        h = strtol(p + 2, &p, 0);
        if (h < 1) {
          h = 1;
        }
        if (h > 45) {
          h = 45;
        }
      } else if (p[1] == 't') {
        t = strtol(p + 2, &p, 0);
        if (t < 1) {
          t = 4;
        }
      } else {
      err:
        api_putstr0(" >tview file [-w30 -h10 -t4]\n");
        api_end();
      }
    } else {
      if (q != 0) {
        goto err;
      }
      q = p;
      for (; *p > ' '; p++) {
      }
      r = p;
    }
  }
  if (q == 0) {
    goto err;
  }
  win = api_openwin(winbuf, w * 8 + 16, h * 16 + 37, -1, "tview");
  api_boxfilwin(win, 6, 27, w * 8 + 9, h * 16 + 30, 7);
  *r = 0;
  i = api_fopen(q);
  if (i == 0) {
    api_putstr0("file open error.\n");
    api_end();
  }
  j = api_fsize(i, 0);
  if (j >= 240 * 1024 - 1) {
    j = 240 * 1024 - 2;
  }
  txtbuf[0] = 0x0a;
  api_fread(txtbuf + 1, j, i);
  api_fclose(i);
  txtbuf[j + 1] = 0;
  q = txtbuf + 1;
  for (p = txtbuf + 1; *p != 0; p++) {
    if (*p != 0x0d) {
      *q = *p;
      q++;
    }
  }
  *q = 0;
  p = txtbuf + 1;
  for (;;) {
    textview(win, w, h, xskip, p, t, lang);
    i = api_getkey(1);
    if (i == 'Q' || i == 'q') {
      api_end();
    }
    if ('A' <= i && i <= 'F') {
      spd_x = 1 << (i - 'A');
    }
    if ('a' <= i && i <= 'f') {
      spd_y = 1 << (i - 'a');
    }
    if (i == '<' && t > 1) {
      t /= 2;
    }
    if (i == '>' && t < 256) {
      t *= 2;
    }
    if (i == '4') {
      for (;;) {
        xskip -= spd_x;
        if (xskip < 0) {
          xskip = 0;
        }
        if (api_getkey(0) != '4') {
          break;
        }
      }
    }
    if (i == '6') {
      for (;;) {
        xskip += spd_x;
        if (api_getkey(0) != '6') {
          break;
        }
      }
    }
    if (i == '8') {
      for (;;) {
        for (j = 0; j < spd_y; j++) {
          if (p == txtbuf + 1) {
            break;
          }
          for (p--; p[-1] != 0x0a; p--) {
          }
        }
        if (api_getkey(0) != '8') {
          break;
        }
      }
    }
    if (i == '2') {
      for (;;) {
        for (j = 0; j < spd_y; j++) {
          for (q = p; *q != 0 && *q != 0x0a; q++) {
          }
          if (*q == 0) {
            break;
          }
          p = q + 1;
        }
        if (api_getkey(0) != '2') {
          break;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf9480,%rsp
movl   $0x1e,-0xf9404(%rbp)
movl   $0xa,-0xf9408(%rbp)
movl   $0x4,-0xf940c(%rbp)
movl   $0x1,-0xf9410(%rbp)
movl   $0x1,-0xf9414(%rbp)
mov    $0x0,%al
call   10c0 <api_getlang@plt>
mov    %eax,-0xf9424(%rbp)
movl   $0x0,-0xf9428(%rbp)
movq   $0x0,-0xf9460(%rbp)
movq   $0x0,-0xf9468(%rbp)
lea    -0xf9450(%rbp),%rdi
mov    $0x1e,%esi
call   10b0 <api_cmdline@plt>
lea    -0xf9450(%rbp),%rax
mov    %rax,-0xf9458(%rbp)
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    1298 <HariMain+0xb8>
jmp    1281 <HariMain+0xa1>
mov    -0xf9458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
jmp    1269 <HariMain+0x89>
jmp    129d <HariMain+0xbd>
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     147b <HariMain+0x29b>
mov    -0xf9458(%rbp),%rdi
call   10f0 <skipspace@plt>
mov    %rax,-0xf9458(%rbp)
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1418 <HariMain+0x238>
mov    -0xf9458(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x77,%eax
jne    133c <HariMain+0x15c>
mov    -0xf9458(%rbp),%rdi
add    $0x2,%rdi
lea    -0xf9458(%rbp),%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
mov    %eax,-0xf9404(%rbp)
cmpl   $0x14,-0xf9404(%rbp)
jge    1320 <HariMain+0x140>
movl   $0x14,-0xf9404(%rbp)
cmpl   $0x7e,-0xf9404(%rbp)
jle    1337 <HariMain+0x157>
movl   $0x7e,-0xf9404(%rbp)
jmp    1413 <HariMain+0x233>
mov    -0xf9458(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x68,%eax
jne    13a2 <HariMain+0x1c2>
mov    -0xf9458(%rbp),%rdi
add    $0x2,%rdi
lea    -0xf9458(%rbp),%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
mov    %eax,-0xf9408(%rbp)
cmpl   $0x1,-0xf9408(%rbp)
jge    1386 <HariMain+0x1a6>
movl   $0x1,-0xf9408(%rbp)
cmpl   $0x2d,-0xf9408(%rbp)
jle    139d <HariMain+0x1bd>
movl   $0x2d,-0xf9408(%rbp)
jmp    140e <HariMain+0x22e>
mov    -0xf9458(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x74,%eax
jne    13f1 <HariMain+0x211>
mov    -0xf9458(%rbp),%rdi
add    $0x2,%rdi
lea    -0xf9458(%rbp),%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
mov    %eax,-0xf940c(%rbp)
cmpl   $0x1,-0xf940c(%rbp)
jge    13ec <HariMain+0x20c>
movl   $0x4,-0xf940c(%rbp)
jmp    1409 <HariMain+0x229>
jmp    13f6 <HariMain+0x216>
lea    0xc03(%rip),%rdi
call   10e0 <api_putstr0@plt>
mov    $0x0,%al
call   1030 <api_end@plt>
jmp    140e <HariMain+0x22e>
jmp    1413 <HariMain+0x233>
jmp    1476 <HariMain+0x296>
cmpq   $0x0,-0xf9460(%rbp)
je     142b <HariMain+0x24b>
jmp    13f6 <HariMain+0x216>
mov    -0xf9458(%rbp),%rax
mov    %rax,-0xf9460(%rbp)
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    1468 <HariMain+0x288>
jmp    1451 <HariMain+0x271>
mov    -0xf9458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
jmp    1439 <HariMain+0x259>
mov    -0xf9458(%rbp),%rax
mov    %rax,-0xf9468(%rbp)
jmp    129d <HariMain+0xbd>
cmpq   $0x0,-0xf9460(%rbp)
jne    148e <HariMain+0x2ae>
jmp    13f6 <HariMain+0x216>
lea    -0xbd400(%rbp),%rdi
mov    -0xf9404(%rbp),%esi
shl    $0x3,%esi
add    $0x10,%esi
mov    -0xf9408(%rbp),%edx
shl    $0x4,%edx
add    $0x25,%edx
mov    $0xffffffff,%ecx
lea    0xb65(%rip),%r8
call   10d0 <api_openwin@plt>
mov    %eax,-0xf9418(%rbp)
mov    -0xf9418(%rbp),%edi
mov    -0xf9404(%rbp),%ecx
shl    $0x3,%ecx
add    $0x9,%ecx
mov    -0xf9408(%rbp),%r8d
shl    $0x4,%r8d
add    $0x1e,%r8d
mov    $0x6,%esi
mov    $0x1b,%edx
mov    $0x7,%r9d
call   1100 <api_boxfilwin@plt>
mov    -0xf9468(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xf9460(%rbp),%rdi
call   1050 <api_fopen@plt>
mov    %eax,-0xf941c(%rbp)
cmpl   $0x0,-0xf941c(%rbp)
jne    1536 <HariMain+0x356>
lea    0xafa(%rip),%rdi
call   10e0 <api_putstr0@plt>
mov    $0x0,%al
call   1030 <api_end@plt>
mov    -0xf941c(%rbp),%edi
xor    %esi,%esi
call   1060 <api_fsize@plt>
mov    %eax,-0xf9420(%rbp)
cmpl   $0x3bfff,-0xf9420(%rbp)
jl     1563 <HariMain+0x383>
movl   $0x3bffe,-0xf9420(%rbp)
movb   $0xa,-0xf9400(%rbp)
lea    -0xf9400(%rbp),%rdi
add    $0x1,%rdi
mov    -0xf9420(%rbp),%esi
mov    -0xf941c(%rbp),%edx
call   1080 <api_fread@plt>
mov    -0xf941c(%rbp),%edi
call   1070 <api_fclose@plt>
mov    -0xf9420(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0xf9400(%rbp,%rax,1)
lea    -0xf9400(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9460(%rbp)
lea    -0xf9400(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     162e <HariMain+0x44e>
mov    -0xf9458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     1612 <HariMain+0x432>
mov    -0xf9458(%rbp),%rax
mov    (%rax),%cl
mov    -0xf9460(%rbp),%rax
mov    %cl,(%rax)
mov    -0xf9460(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9460(%rbp)
jmp    1617 <HariMain+0x437>
mov    -0xf9458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
jmp    15c8 <HariMain+0x3e8>
mov    -0xf9460(%rbp),%rax
movb   $0x0,(%rax)
lea    -0xf9400(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
mov    -0xf9418(%rbp),%edi
mov    -0xf9404(%rbp),%esi
mov    -0xf9408(%rbp),%edx
mov    -0xf9428(%rbp),%ecx
mov    -0xf9458(%rbp),%r8
mov    -0xf940c(%rbp),%r9d
mov    -0xf9424(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <textview@plt>
mov    $0x1,%edi
call   1090 <api_getkey@plt>
movsbl %al,%eax
mov    %eax,-0xf941c(%rbp)
cmpl   $0x51,-0xf941c(%rbp)
je     16ab <HariMain+0x4cb>
cmpl   $0x71,-0xf941c(%rbp)
jne    16b2 <HariMain+0x4d2>
mov    $0x0,%al
call   1030 <api_end@plt>
mov    $0x41,%eax
cmp    -0xf941c(%rbp),%eax
jg     16e6 <HariMain+0x506>
cmpl   $0x46,-0xf941c(%rbp)
jg     16e6 <HariMain+0x506>
mov    -0xf941c(%rbp),%ecx
sub    $0x41,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xf9410(%rbp)
mov    $0x61,%eax
cmp    -0xf941c(%rbp),%eax
jg     171a <HariMain+0x53a>
cmpl   $0x66,-0xf941c(%rbp)
jg     171a <HariMain+0x53a>
mov    -0xf941c(%rbp),%ecx
sub    $0x61,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xf9414(%rbp)
cmpl   $0x3c,-0xf941c(%rbp)
jne    1748 <HariMain+0x568>
cmpl   $0x1,-0xf940c(%rbp)
jle    1748 <HariMain+0x568>
mov    -0xf940c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xf940c(%rbp)
cmpl   $0x3e,-0xf941c(%rbp)
jne    1774 <HariMain+0x594>
cmpl   $0x100,-0xf940c(%rbp)
jge    1774 <HariMain+0x594>
mov    -0xf940c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xf940c(%rbp)
cmpl   $0x34,-0xf941c(%rbp)
jne    17d3 <HariMain+0x5f3>
jmp    1786 <HariMain+0x5a6>
mov    -0xf9410(%rbp),%ecx
mov    -0xf9428(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xf9428(%rbp)
cmpl   $0x0,-0xf9428(%rbp)
jge    17b1 <HariMain+0x5d1>
movl   $0x0,-0xf9428(%rbp)
xor    %edi,%edi
call   1090 <api_getkey@plt>
movsbl %al,%eax
cmp    $0x34,%eax
je     17c9 <HariMain+0x5e9>
jmp    17ce <HariMain+0x5ee>
jmp    1786 <HariMain+0x5a6>
jmp    17d3 <HariMain+0x5f3>
cmpl   $0x36,-0xf941c(%rbp)
jne    1819 <HariMain+0x639>
jmp    17e5 <HariMain+0x605>
mov    -0xf9410(%rbp),%eax
add    -0xf9428(%rbp),%eax
mov    %eax,-0xf9428(%rbp)
xor    %edi,%edi
call   1090 <api_getkey@plt>
movsbl %al,%eax
cmp    $0x36,%eax
je     180f <HariMain+0x62f>
jmp    1814 <HariMain+0x634>
jmp    17e5 <HariMain+0x605>
jmp    1819 <HariMain+0x639>
cmpl   $0x38,-0xf941c(%rbp)
jne    18e4 <HariMain+0x704>
jmp    182b <HariMain+0x64b>
movl   $0x0,-0xf9420(%rbp)
mov    -0xf9420(%rbp),%eax
cmp    -0xf9414(%rbp),%eax
jge    18c2 <HariMain+0x6e2>
mov    -0xf9458(%rbp),%rax
lea    -0xf9400(%rbp),%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1867 <HariMain+0x687>
jmp    18c2 <HariMain+0x6e2>
mov    -0xf9458(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xf9458(%rbp)
mov    -0xf9458(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0xa,%eax
je     18a9 <HariMain+0x6c9>
jmp    1892 <HariMain+0x6b2>
mov    -0xf9458(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xf9458(%rbp)
jmp    1879 <HariMain+0x699>
jmp    18ae <HariMain+0x6ce>
mov    -0xf9420(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf9420(%rbp)
jmp    1835 <HariMain+0x655>
xor    %edi,%edi
call   1090 <api_getkey@plt>
movsbl %al,%eax
cmp    $0x38,%eax
je     18da <HariMain+0x6fa>
jmp    18df <HariMain+0x6ff>
jmp    182b <HariMain+0x64b>
jmp    18e4 <HariMain+0x704>
cmpl   $0x32,-0xf941c(%rbp)
jne    19e0 <HariMain+0x800>
jmp    18f6 <HariMain+0x716>
movl   $0x0,-0xf9420(%rbp)
mov    -0xf9420(%rbp),%eax
cmp    -0xf9414(%rbp),%eax
jge    19be <HariMain+0x7de>
mov    -0xf9458(%rbp),%rax
mov    %rax,-0xf9460(%rbp)
mov    -0xf9460(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xf9469(%rbp)
je     1951 <HariMain+0x771>
mov    -0xf9460(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xf9469(%rbp)
mov    -0xf9469(%rbp),%al
test   $0x1,%al
jne    1964 <HariMain+0x784>
jmp    1980 <HariMain+0x7a0>
jmp    1969 <HariMain+0x789>
mov    -0xf9460(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9460(%rbp)
jmp    1920 <HariMain+0x740>
mov    -0xf9460(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1998 <HariMain+0x7b8>
jmp    19be <HariMain+0x7de>
mov    -0xf9460(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf9458(%rbp)
mov    -0xf9420(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf9420(%rbp)
jmp    1900 <HariMain+0x720>
xor    %edi,%edi
call   1090 <api_getkey@plt>
movsbl %al,%eax
cmp    $0x32,%eax
je     19d6 <HariMain+0x7f6>
jmp    19db <HariMain+0x7fb>
jmp    18f6 <HariMain+0x716>
jmp    19e0 <HariMain+0x800>
jmp    164a <HariMain+0x46a>

x86 assembly (clang, -O2):
<HariMain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf9458,%rsp
xor    %eax,%eax
call   10c0 <api_getlang@plt>
mov    %eax,0x2c(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x1e,%esi
call   10b0 <api_cmdline@plt>
lea    0x2f(%rsp),%rdi
movzbl 0x1(%rdi),%eax
add    $0x1,%rdi
cmp    $0x20,%al
jg     1210 <HariMain+0x30>
mov    %rdi,0x10(%rsp)
mov    $0x1e,%ecx
mov    %rcx,0x20(%rsp)
movl   $0xa,0x1c(%rsp)
lea    0xdc6(%rip),%r14
lea    0x10(%rsp),%r15
mov    $0x14,%r13d
mov    $0x7e,%r12d
movl   $0x4,0x18(%rsp)
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    127f <HariMain+0x9f>
nopl   0x0(%rax)
test   %rbp,%rbp
jne    134d <HariMain+0x16d>
mov    %r14,%rdi
call   10e0 <api_putstr0@plt>
xor    %eax,%eax
call   1030 <api_end@plt>
mov    0x10(%rsp),%rdi
mov    (%rdi),%al
test   %al,%al
je     1260 <HariMain+0x80>
call   10f0 <skipspace@plt>
mov    %rax,0x10(%rsp)
mov    (%rax),%cl
cmp    $0x2d,%cl
jne    12d0 <HariMain+0xf0>
mov    0x1(%rax),%cl
cmp    $0x68,%cl
je     12fa <HariMain+0x11a>
cmp    $0x74,%cl
je     1329 <HariMain+0x149>
cmp    $0x77,%cl
jne    1269 <HariMain+0x89>
add    $0x2,%rax
mov    %rax,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
cmp    $0x15,%eax
cmovl  %r13d,%eax
cmp    $0x7e,%eax
cmovae %r12d,%eax
mov    %rax,0x20(%rsp)
jmp    1278 <HariMain+0x98>
test   %rbp,%rbp
jne    1269 <HariMain+0x89>
mov    %rax,%rbx
cmp    $0x21,%cl
jl     12ed <HariMain+0x10d>
mov    %rax,%rcx
lea    0x1(%rcx),%rbx
cmpb   $0x20,0x1(%rcx)
mov    %rbx,%rcx
jg     12e0 <HariMain+0x100>
mov    %rbx,0x10(%rsp)
mov    %rax,%rbp
jmp    1278 <HariMain+0x98>
add    $0x2,%rax
mov    %rax,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
test   %eax,%eax
mov    $0x1,%ecx
cmovle %ecx,%eax
cmp    $0x2d,%eax
mov    $0x2d,%ecx
cmovae %ecx,%eax
mov    %eax,0x1c(%rsp)
jmp    1278 <HariMain+0x98>
add    $0x2,%rax
mov    %rax,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   10a0 <strtol@plt>
test   %eax,%eax
mov    $0x4,%ecx
cmovle %ecx,%eax
mov    %eax,0x18(%rsp)
jmp    1278 <HariMain+0x98>
mov    0x20(%rsp),%r15
lea    0x10(,%r15,8),%esi
mov    0x1c(%rsp),%eax
mov    %eax,%r14d
shl    $0x4,%r14d
lea    0x25(%r14),%edx
lea    0xcae(%rip),%r8
lea    0x3c050(%rsp),%rdi
mov    $0xffffffff,%ecx
call   10d0 <api_openwin@plt>
lea    0x9(,%r15,8),%ecx
add    $0x1e,%r14d
mov    %eax,0x28(%rsp)
mov    %eax,%edi
mov    $0x6,%esi
mov    $0x1b,%edx
mov    %r14d,%r8d
mov    $0x7,%r9d
call   1100 <api_boxfilwin@plt>
movb   $0x0,(%rbx)
mov    %rbp,%rdi
call   1050 <api_fopen@plt>
mov    %eax,%r14d
test   %eax,%eax
jne    13d1 <HariMain+0x1f1>
lea    0xc5f(%rip),%rdi
call   10e0 <api_putstr0@plt>
xor    %eax,%eax
call   1030 <api_end@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <api_fsize@plt>
cmp    $0x3bffe,%eax
mov    $0x3bffe,%ebx
cmovl  %eax,%ebx
movb   $0xa,0x50(%rsp)
lea    0x51(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1080 <api_fread@plt>
mov    %r14d,%edi
call   1070 <api_fclose@plt>
movslq %ebx,%rax
lea    0x50(%rsp),%rcx
movb   $0x0,0x1(%rax,%rcx,1)
mov    %rbp,%rcx
mov    %rbp,%rax
jmp    142f <HariMain+0x24f>
nopl   0x0(%rax)
mov    %dl,(%rax)
add    $0x1,%rax
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,0x10(%rsp)
movzbl (%rcx),%edx
cmp    $0xd,%dl
je     142b <HariMain+0x24b>
test   %dl,%dl
jne    1420 <HariMain+0x240>
movb   $0x0,(%rax)
mov    %rbp,0x10(%rsp)
xor    %r13d,%r13d
mov    $0x1,%ebx
mov    $0x1,%r15d
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    0x2c(%rsp),%eax
mov    %eax,(%rsp)
mov    0x28(%rsp),%edi
mov    0x20(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    %r14d,%ecx
mov    %rbp,%r8
mov    0x18(%rsp),%r9d
call   1040 <textview@plt>
mov    $0x1,%edi
call   1090 <api_getkey@plt>
mov    %eax,%r12d
and    $0xdf,%al
cmp    $0x51,%al
jne    149e <HariMain+0x2be>
xor    %eax,%eax
call   1030 <api_end@plt>
lea    -0x41(%r12),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x6,%cl
cmovb  %eax,%ebx
lea    -0x61(%r12),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x6,%cl
cmovb  %eax,%r15d
mov    0x18(%rsp),%edx
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
cmp    $0x3c,%r12b
cmovne %edx,%eax
cmp    $0x2,%edx
cmovge %eax,%edx
cmp    $0x3e,%r12b
sete   %al
cmp    $0x100,%edx
setl   %cl
and    %al,%cl
shl    %cl,%edx
mov    %edx,0x18(%rsp)
cmp    $0x34,%r12b
jne    1512 <HariMain+0x332>
nopl   0x0(%rax,%rax,1)
sub    %ebx,%r14d
cmovs  %r13d,%r14d
xor    %edi,%edi
call   1090 <api_getkey@plt>
cmp    $0x34,%al
je     1500 <HariMain+0x320>
cmp    $0x36,%r12b
jne    152e <HariMain+0x34e>
nopl   0x0(%rax,%rax,1)
add    %ebx,%r14d
xor    %edi,%edi
call   1090 <api_getkey@plt>
cmp    $0x36,%al
je     1520 <HariMain+0x340>
cmp    $0x32,%r12b
je     15a7 <HariMain+0x3c7>
cmp    $0x38,%r12b
jne    1460 <HariMain+0x280>
lea    0x51(%rsp),%r12
jmp    1564 <HariMain+0x384>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,0x10(%rsp)
xor    %edi,%edi
call   1090 <api_getkey@plt>
cmp    $0x38,%al
jne    1460 <HariMain+0x280>
test   %r15d,%r15d
jle    1550 <HariMain+0x370>
cmp    %r12,%rbp
je     1550 <HariMain+0x370>
xor    %eax,%eax
cmpb   $0xa,-0x2(%rbp)
lea    -0x1(%rbp),%rbp
jne    1570 <HariMain+0x390>
add    $0x1,%eax
cmp    %r15d,%eax
jge    1550 <HariMain+0x370>
cmp    %r12,%rbp
jne    1570 <HariMain+0x390>
jmp    1550 <HariMain+0x370>
nopl   0x0(%rax)
mov    %rcx,%rbp
mov    %rbp,0x10(%rsp)
xor    %edi,%edi
call   1090 <api_getkey@plt>
cmp    $0x32,%al
jne    1460 <HariMain+0x280>
test   %r15d,%r15d
jle    1593 <HariMain+0x3b3>
xor    %eax,%eax
mov    %rbp,%rcx
lea    0x1(%rcx),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
movzbl -0x1(%rbp),%edx
test   %dl,%dl
je     1590 <HariMain+0x3b0>
cmp    $0xa,%dl
je     15e0 <HariMain+0x400>
add    $0x1,%rbp
jmp    15c0 <HariMain+0x3e0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%eax
mov    %rbp,%rcx
cmp    %r15d,%eax
jne    15b1 <HariMain+0x3d1>
jmp    1593 <HariMain+0x3b3>

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

LLVM IR (-O2):
@.str = [30 x i8] c" >tview file [-w30 -h10 -t4]\0A\00"
@.str.1 = [6 x i8] c"tview\00"
@.str.2 = [18 x i8] c"file open error.\0A\00"
define void @HariMain() {
%1 = alloca [775168 x i8]
%2 = alloca [245760 x i8]
%3 = alloca [30 x i8]
%4 = alloca i8*
%5 = getelementptr inbounds [775168 x i8], [775168 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [245760 x i8], [245760 x i8]* %2, i64 0, i64 0
%7 = tail call i32 (...) @api_getlang()
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = bitcast i8** %4 to i8*
%10 = call i32 @api_cmdline(i8* %8, i32 30)
br label %11
11: ; preds = %11, %0
%12 = phi i8* [ %8, %0 ], [ %15, %11 ]
%13 = load i8, i8* %12
%14 = icmp sgt i8 %13, 32
%15 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %14, label %11, label %16
16: ; preds = %11
store i8* %12, i8** %4
br label %17
17: ; preds = %16, %66
%18 = phi i8 [ %73, %66 ], [ %13, %16 ]
%19 = phi i8* [ %72, %66 ], [ %12, %16 ]
%20 = phi i32 [ %67, %66 ], [ 4, %16 ]
%21 = phi i32 [ %68, %66 ], [ 10, %16 ]
%22 = phi i32 [ %69, %66 ], [ 30, %16 ]
%23 = phi i8* [ %70, %66 ], [ null, %16 ]
%24 = phi i8* [ %71, %66 ], [ null, %16 ]
%25 = icmp eq i8 %18, 0
br i1 %25, label %74, label %26
26: ; preds = %17
%27 = call i8* @skipspace(i8* %19)
store i8* %27, i8** %4
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 45
br i1 %29, label %30, label %55
30: ; preds = %26
%31 = getelementptr inbounds i8, i8* %27, i64 1
%32 = load i8, i8* %31
switch i8 %32, label %52 [
i8 119, label %33
i8 104, label %40
i8 116, label %47
]
33: ; preds = %30
%34 = getelementptr inbounds i8, i8* %27, i64 2
%35 = call i32 @strtol(i8* %34, i8** %4, i32 0)
%36 = icmp sgt i32 %35, 20
%37 = select i1 %36, i32 %35, i32 20
%38 = icmp ult i32 %37, 126
%39 = select i1 %38, i32 %37, i32 126
br label %66
40: ; preds = %30
%41 = getelementptr inbounds i8, i8* %27, i64 2
%42 = call i32 @strtol(i8* %41, i8** %4, i32 0)
%43 = icmp sgt i32 %42, 1
%44 = select i1 %43, i32 %42, i32 1
%45 = icmp ult i32 %44, 45
%46 = select i1 %45, i32 %44, i32 45
br label %66
47: ; preds = %30
%48 = getelementptr inbounds i8, i8* %27, i64 2
%49 = call i32 @strtol(i8* %48, i8** %4, i32 0)
%50 = icmp slt i32 %49, 1
%51 = select i1 %50, i32 4, i32 %49
br label %66
52: ; preds = %30, %74, %55
%53 = call i32 @api_putstr0(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%54 = call i32 (...) @api_end()
br label %66
55: ; preds = %26
%56 = icmp eq i8* %23, null
br i1 %56, label %57, label %52
57: ; preds = %55
%58 = icmp sgt i8 %28, 32
br i1 %58, label %59, label %64
59: ; preds = %57, %59
%60 = phi i8* [ %61, %59 ], [ %27, %57 ]
%61 = getelementptr inbounds i8, i8* %60, i64 1
%62 = load i8, i8* %61
%63 = icmp sgt i8 %62, 32
br i1 %63, label %59, label %64
64: ; preds = %59, %57
%65 = phi i8* [ %27, %57 ], [ %61, %59 ]
store i8* %65, i8** %4
br label %66
66: ; preds = %64, %40, %33, %47, %52
%67 = phi i32 [ %20, %33 ], [ %20, %40 ], [ %51, %47 ], [ %20, %52 ], [ %20, %64 ]
%68 = phi i32 [ %21, %33 ], [ %46, %40 ], [ %21, %47 ], [ %21, %52 ], [ %21, %64 ]
%69 = phi i32 [ %39, %33 ], [ %22, %40 ], [ %22, %47 ], [ %22, %52 ], [ %22, %64 ]
%70 = phi i8* [ %23, %33 ], [ %23, %40 ], [ %23, %47 ], [ %23, %52 ], [ %27, %64 ]
%71 = phi i8* [ %24, %33 ], [ %24, %40 ], [ %24, %47 ], [ %24, %52 ], [ %65, %64 ]
%72 = load i8*, i8** %4
%73 = load i8, i8* %72
br label %17
74: ; preds = %17
%75 = icmp eq i8* %23, null
br i1 %75, label %52, label %76
76: ; preds = %74
%77 = shl nsw i32 %22, 3
%78 = add nsw i32 %77, 16
%79 = shl nsw i32 %21, 4
%80 = add nsw i32 %79, 37
%81 = call i32 @api_openwin(i8* %5, i32 %78, i32 %80, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%82 = add nsw i32 %77, 9
%83 = add nsw i32 %79, 30
%84 = call i32 @api_boxfilwin(i32 %81, i32 6, i32 27, i32 %82, i32 %83, i32 7)
store i8 0, i8* %24
%85 = call i32 @api_fopen(i8* %23)
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %76
%88 = call i32 @api_putstr0(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%89 = call i32 (...) @api_end()
br label %90
90: ; preds = %87, %76
%91 = call i32 @api_fsize(i32 %85, i32 0)
%92 = icmp slt i32 %91, 245758
%93 = select i1 %92, i32 %91, i32 245758
store i8 10, i8* %6
%94 = getelementptr inbounds [245760 x i8], [245760 x i8]* %2, i64 0, i64 1
%95 = call i32 @api_fread(i8* %94, i32 %93, i32 %85)
%96 = call i32 @api_fclose(i32 %85)
%97 = add nsw i32 %93, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [245760 x i8], [245760 x i8]* %2, i64 0, i64 %98
store i8 0, i8* %99
br label %100
100: ; preds = %107, %90
%101 = phi i8* [ %94, %90 ], [ %110, %107 ]
%102 = phi i8* [ %94, %90 ], [ %109, %107 ]
store i8* %101, i8** %4
%103 = load i8, i8* %101
switch i8 %103, label %104 [
i8 0, label %111
i8 13, label %107
]
104: ; preds = %100
store i8 %103, i8* %102
%105 = getelementptr inbounds i8, i8* %102, i64 1
%106 = load i8*, i8** %4
br label %107
107: ; preds = %100, %104
%108 = phi i8* [ %106, %104 ], [ %101, %100 ]
%109 = phi i8* [ %105, %104 ], [ %102, %100 ]
%110 = getelementptr inbounds i8, i8* %108, i64 1
br label %100
111: ; preds = %100
store i8 0, i8* %102
store i8* %94, i8** %4
br label %114
112: ; preds = %211, %191
%113 = phi i8* [ %192, %191 ], [ %212, %211 ]
br label %114
114: ; preds = %112, %111
%115 = phi i8* [ %94, %111 ], [ %113, %112 ]
%116 = phi i32 [ %20, %111 ], [ %152, %112 ]
%117 = phi i32 [ 1, %111 ], [ %137, %112 ]
%118 = phi i32 [ 1, %111 ], [ %142, %112 ]
%119 = phi i32 [ 0, %111 ], [ %170, %112 ]
br label %120
120: ; preds = %114, %169
%121 = phi i32 [ %152, %169 ], [ %116, %114 ]
%122 = phi i32 [ %137, %169 ], [ %117, %114 ]
%123 = phi i32 [ %142, %169 ], [ %118, %114 ]
%124 = phi i32 [ %170, %169 ], [ %119, %114 ]
%125 = call i32 @textview(i32 %81, i32 %22, i32 %21, i32 %124, i8* %115, i32 %121, i32 %7)
%126 = call signext i8 @api_getkey(i32 1)
%127 = sext i8 %126 to i32
%128 = and i8 %126, -33
%129 = icmp eq i8 %128, 81
br i1 %129, label %130, label %132
130: ; preds = %120
%131 = call i32 (...) @api_end()
br label %132
132: ; preds = %120, %130
%133 = add i8 %126, -65
%134 = icmp ult i8 %133, 6
%135 = add nsw i32 %127, -65
%136 = shl nuw i32 1, %135
%137 = select i1 %134, i32 %136, i32 %122
%138 = add i8 %126, -97
%139 = icmp ult i8 %138, 6
%140 = add nsw i32 %127, -97
%141 = shl nuw nsw i32 1, %140
%142 = select i1 %139, i32 %141, i32 %123
%143 = icmp eq i8 %126, 60
%144 = icmp sgt i32 %121, 1
%145 = and i1 %144, %143
%146 = sdiv i32 %121, 2
%147 = select i1 %145, i32 %146, i32 %121
%148 = icmp eq i8 %126, 62
%149 = icmp slt i32 %147, 256
%150 = and i1 %148, %149
%151 = zext i1 %150 to i32
%152 = shl nsw i32 %147, %151
%153 = icmp eq i8 %126, 52
br i1 %153, label %154, label %161
154: ; preds = %132, %154
%155 = phi i32 [ %158, %154 ], [ %124, %132 ]
%156 = sub nsw i32 %155, %137
%157 = icmp sgt i32 %156, 0
%158 = select i1 %157, i32 %156, i32 0
%159 = call signext i8 @api_getkey(i32 0)
%160 = icmp eq i8 %159, 52
br i1 %160, label %154, label %161
161: ; preds = %154, %132
%162 = phi i32 [ %124, %132 ], [ %158, %154 ]
%163 = icmp eq i8 %126, 54
br i1 %163, label %164, label %169
164: ; preds = %161, %164
%165 = phi i32 [ %166, %164 ], [ %162, %161 ]
%166 = add nsw i32 %165, %137
%167 = call signext i8 @api_getkey(i32 0)
%168 = icmp eq i8 %167, 54
br i1 %168, label %164, label %169
169: ; preds = %164, %161
%170 = phi i32 [ %162, %161 ], [ %166, %164 ]
switch i8 %126, label %120 [
i8 56, label %171
i8 50, label %195
]
171: ; preds = %169
%172 = icmp slt i32 %142, 1
br label %173
173: ; preds = %171, %191
%174 = phi i8* [ %115, %171 ], [ %192, %191 ]
%175 = icmp eq i8* %174, %94
%176 = select i1 %172, i1 true, i1 %175
br i1 %176, label %191, label %177
177: ; preds = %173, %186
%178 = phi i32 [ %187, %186 ], [ 0, %173 ]
%179 = phi i8* [ %182, %186 ], [ %174, %173 ]
br label %180
180: ; preds = %177, %180
%181 = phi i8* [ %182, %180 ], [ %179, %177 ]
%182 = getelementptr inbounds i8, i8* %181, i64 -1
%183 = getelementptr inbounds i8, i8* %181, i64 -2
%184 = load i8, i8* %183
%185 = icmp eq i8 %184, 10
br i1 %185, label %186, label %180
186: ; preds = %180
%187 = add nuw nsw i32 %178, 1
%188 = icmp sge i32 %187, %142
%189 = icmp eq i8* %182, %94
%190 = select i1 %188, i1 true, i1 %189
br i1 %190, label %191, label %177
191: ; preds = %186, %173
%192 = phi i8* [ %174, %173 ], [ %182, %186 ]
store i8* %192, i8** %4
%193 = call signext i8 @api_getkey(i32 0)
%194 = icmp eq i8 %193, 56
br i1 %194, label %173, label %112
195: ; preds = %169
%196 = icmp sgt i32 %142, 0
br label %197
197: ; preds = %195, %211
%198 = phi i8* [ %115, %195 ], [ %212, %211 ]
br i1 %196, label %199, label %211
199: ; preds = %197, %207
%200 = phi i32 [ %209, %207 ], [ 0, %197 ]
%201 = phi i8* [ %208, %207 ], [ %198, %197 ]
br label %202
202: ; preds = %205, %199
%203 = phi i8* [ %201, %199 ], [ %206, %205 ]
%204 = load i8, i8* %203
switch i8 %204, label %205 [
i8 0, label %211
i8 10, label %207
]
205: ; preds = %202
%206 = getelementptr inbounds i8, i8* %203, i64 1
br label %202
207: ; preds = %202
%208 = getelementptr inbounds i8, i8* %203, i64 1
%209 = add nuw nsw i32 %200, 1
%210 = icmp eq i32 %209, %142
br i1 %210, label %211, label %199
211: ; preds = %207, %202, %197
%212 = phi i8* [ %198, %197 ], [ %201, %202 ], [ %208, %207 ]
store i8* %212, i8** %4
%213 = call signext i8 @api_getkey(i32 0)
%214 = icmp eq i8 %213, 50
br i1 %214, label %197, label %112
}