#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 char *text;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
int rastreadfile(char *filename, int islock, char *tag, char *value) {
  FILE *fp = (FILE *)NULL, *rastopenfile();
  char texfile[1024] = "\000", text[(4096 - 1) + 1];
  char *tagp, tag1[1024], tag2[1024];
  int vallen = 0, maxvallen = (65536 - 1);
  int status = (-1);
  int tagnum = 0;
  if (value == (char *)NULL)
    goto end_of_job;
  *value = '\000';
  if (filename != (char *)NULL) {
    strncpy(texfile, filename, 1023);
    texfile[1023] = '\000';
    fp = rastopenfile(texfile, (islock ? "r+" : "r"));
  }
  if (fp == (FILE *)NULL) {
    sprintf(value, "{\\normalsize\\rm[file %s?]}", texfile);
    goto end_of_job;
  }
  status = 0;
  if (islock)
    rewind(fp);
  if (tag != (char *)NULL)
    if (*tag != '\000') {
      strcpy(tag1, "<");
      strcpy(tag2, "</");
      strcat(tag1, tag);
      strcat(tag2, tag);
      strcat(tag1, ">");
      strcat(tag2, ">");
      if ((tag1) != NULL) {
        char *p;
        while ((p = strchr((tag1), (' '))) != NULL) {
          if ((1) != 0) {
            if (!(((p)) == NULL ? 1 : (*((p)) == '\000' ? 1 : 0))) {
              int thislen3 = strlen(p);
              if ((1) >= thislen3)
                *(p) = '\000';
              else
                memmove(p, p + (1), 1 + thislen3 - (1));
            }
          } else
            ;
        }
      } else
        ;
      if ((tag2) != NULL) {
        char *p;
        while ((p = strchr((tag2), (' '))) != NULL) {
          if ((1) != 0) {
            if (!(((p)) == NULL ? 1 : (*((p)) == '\000' ? 1 : 0))) {
              int thislen3 = strlen(p);
              if ((1) >= thislen3)
                *(p) = '\000';
              else
                memmove(p, p + (1), 1 + thislen3 - (1));
            }
          } else
            ;
        }
      } else
        ;
      tagnum = 1;
    }
  while (fgets(text, (4096 - 1) - 1, fp) != (char *)NULL) {
    switch (tagnum) {
    case 0:
      status = 1;
      break;
    case 1:
      if ((tagp = strstr(text, tag1)) == NULL)
        break;
      tagp += strlen(tag1);
      if (!(((text)) == NULL ? 1 : (*((text)) == '\000' ? 1 : 0)) &&
          !(((tagp)) == NULL ? 1 : (*((tagp)) == '\000' ? 1 : 0))) {
        int sqlen = strlen((text)) - strlen((tagp));
        if (sqlen > 0 && sqlen <= 999) {
          if ((sqlen) != 0) {
            if (!((((text))) == NULL ? 1 : (*(((text))) == '\000' ? 1 : 0))) {
              int thislen3 = strlen((text));
              if ((sqlen) >= thislen3)
                *((text)) = '\000';
              else
                memmove((text), (text) + (sqlen), 1 + thislen3 - (sqlen));
            }
          } else
            ;
        }
      } else
        ;
      tagnum = 2;
    case 2:
      if ((tagp = strstr(text, tag2)) == NULL)
        break;
      *tagp = '\000';
      tagnum = 3;
      status = 1;
      break;
    }
    if (tagnum != 1) {
      int textlen = strlen(text);
      if (vallen + textlen > maxvallen)
        break;
      strcat(value, text);
      vallen += textlen;
      if (tagnum > 2)
        break;
    }
  }
  if (tagnum < 1 || tagnum > 2)
    status = 1;
  fclose(fp);
end_of_job:
  return (status);
}


x86 assembly (clang, -O0):
<rastreadfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
movl   $0x0,-0x1c44(%rbp)
movl   $0xffff,-0x1c48(%rbp)
movl   $0xffffffff,-0x1c4c(%rbp)
ff ff ff
movl   $0x0,-0x1c50(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123d <rastreadfile+0x6d>
jmp    1882 <rastreadfile+0x6b2>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x8(%rbp)
je     1292 <rastreadfile+0xc2>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3ff,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x31(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xd8a(%rip),%rsi
lea    0xd80(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    $0x0,%al
call   10b0 <rastopenfile@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12b9 <rastreadfile+0xe9>
mov    -0x20(%rbp),%rdi
lea    -0x430(%rbp),%rdx
lea    0xd56(%rip),%rsi
call   10e0 <sprintf@plt>
jmp    1882 <rastreadfile+0x6b2>
movl   $0x0,-0x1c4c(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     12d6 <rastreadfile+0x106>
mov    -0x28(%rbp),%rdi
call   1080 <rewind@plt>
cmpq   $0x0,-0x18(%rbp)
je     150f <rastreadfile+0x33f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     150a <rastreadfile+0x33a>
lea    -0x1840(%rbp),%rdi
lea    0xd21(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x1c40(%rbp),%rdi
lea    0xd10(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x1840(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x1c40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x1840(%rbp),%rdi
lea    0xce0(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1c40(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1840(%rbp),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,-0x1c58(%rbp)
cmp    $0x0,%rax
je     142c <rastreadfile+0x25c>
cmpq   $0x0,-0x1c58(%rbp)
jne    139c <rastreadfile+0x1cc>
mov    $0x1,%al
test   $0x1,%al
jne    1427 <rastreadfile+0x257>
jmp    13cd <rastreadfile+0x1fd>
mov    -0x1c58(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    13be <rastreadfile+0x1ee>
mov    $0x1,%al
test   $0x1,%al
jne    1427 <rastreadfile+0x257>
jmp    13cd <rastreadfile+0x1fd>
xor    %eax,%eax
test   $0x1,%al
jne    1427 <rastreadfile+0x257>
jmp    13cd <rastreadfile+0x1fd>
mov    -0x1c58(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c5c(%rbp)
mov    $0x1,%eax
cmp    -0x1c5c(%rbp),%eax
jl     13ff <rastreadfile+0x22f>
mov    -0x1c58(%rbp),%rax
movb   $0x0,(%rax)
jmp    1422 <rastreadfile+0x252>
mov    -0x1c58(%rbp),%rdi
mov    -0x1c58(%rbp),%rsi
add    $0x1,%rsi
mov    -0x1c5c(%rbp),%edx
add    $0x1,%edx
sub    $0x1,%edx
call   10c0 <memmove@plt>
jmp    1427 <rastreadfile+0x257>
jmp    135d <rastreadfile+0x18d>
jmp    1431 <rastreadfile+0x261>
lea    -0x1c40(%rbp),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,-0x1c68(%rbp)
cmp    $0x0,%rax
je     1500 <rastreadfile+0x330>
cmpq   $0x0,-0x1c68(%rbp)
jne    1470 <rastreadfile+0x2a0>
mov    $0x1,%al
test   $0x1,%al
jne    14fb <rastreadfile+0x32b>
jmp    14a1 <rastreadfile+0x2d1>
mov    -0x1c68(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1492 <rastreadfile+0x2c2>
mov    $0x1,%al
test   $0x1,%al
jne    14fb <rastreadfile+0x32b>
jmp    14a1 <rastreadfile+0x2d1>
xor    %eax,%eax
test   $0x1,%al
jne    14fb <rastreadfile+0x32b>
jmp    14a1 <rastreadfile+0x2d1>
mov    -0x1c68(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c6c(%rbp)
mov    $0x1,%eax
cmp    -0x1c6c(%rbp),%eax
jl     14d3 <rastreadfile+0x303>
mov    -0x1c68(%rbp),%rax
movb   $0x0,(%rax)
jmp    14f6 <rastreadfile+0x326>
mov    -0x1c68(%rbp),%rdi
mov    -0x1c68(%rbp),%rsi
add    $0x1,%rsi
mov    -0x1c6c(%rbp),%edx
add    $0x1,%edx
sub    $0x1,%edx
call   10c0 <memmove@plt>
jmp    14fb <rastreadfile+0x32b>
jmp    1431 <rastreadfile+0x261>
movl   $0x1,-0x1c50(%rbp)
jmp    150f <rastreadfile+0x33f>
jmp    1514 <rastreadfile+0x344>
lea    -0x1430(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0xffe,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     1855 <rastreadfile+0x685>
mov    -0x1c50(%rbp),%eax
mov    %eax,-0x1c7c(%rbp)
test   %eax,%eax
je     1574 <rastreadfile+0x3a4>
jmp    154c <rastreadfile+0x37c>
mov    -0x1c7c(%rbp),%eax
sub    $0x1,%eax
je     1583 <rastreadfile+0x3b3>
jmp    1560 <rastreadfile+0x390>
mov    -0x1c7c(%rbp),%eax
sub    $0x2,%eax
je     1794 <rastreadfile+0x5c4>
jmp    17db <rastreadfile+0x60b>
movl   $0x1,-0x1c4c(%rbp)
jmp    17db <rastreadfile+0x60b>
lea    -0x1430(%rbp),%rdi
lea    -0x1840(%rbp),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1438(%rbp)
cmp    $0x0,%rax
jne    15ac <rastreadfile+0x3dc>
jmp    17db <rastreadfile+0x60b>
lea    -0x1840(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1438(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1438(%rbp)
lea    -0x1430(%rbp),%rax
cmp    $0x0,%rax
jne    15ee <rastreadfile+0x41e>
mov    $0x1,%al
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    161c <rastreadfile+0x44c>
movsbl -0x1430(%rbp),%eax
cmp    $0x0,%eax
jne    160d <rastreadfile+0x43d>
mov    $0x1,%al
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    161c <rastreadfile+0x44c>
xor    %eax,%eax
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    161c <rastreadfile+0x44c>
cmpq   $0x0,-0x1438(%rbp)
jne    1639 <rastreadfile+0x469>
mov    $0x1,%al
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    166a <rastreadfile+0x49a>
mov    -0x1438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    165b <rastreadfile+0x48b>
mov    $0x1,%al
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    166a <rastreadfile+0x49a>
xor    %eax,%eax
test   $0x1,%al
jne    1785 <rastreadfile+0x5b5>
jmp    166a <rastreadfile+0x49a>
lea    -0x1430(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c80(%rbp)
mov    -0x1438(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c80(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c70(%rbp)
cmpl   $0x0,-0x1c70(%rbp)
jle    1780 <rastreadfile+0x5b0>
cmpl   $0x3e7,-0x1c70(%rbp)
jg     1780 <rastreadfile+0x5b0>
cmpl   $0x0,-0x1c70(%rbp)
je     1776 <rastreadfile+0x5a6>
lea    -0x1430(%rbp),%rax
cmp    $0x0,%rax
jne    16e2 <rastreadfile+0x512>
mov    $0x1,%al
test   $0x1,%al
jne    1771 <rastreadfile+0x5a1>
jmp    1710 <rastreadfile+0x540>
movsbl -0x1430(%rbp),%eax
cmp    $0x0,%eax
jne    1701 <rastreadfile+0x531>
mov    $0x1,%al
test   $0x1,%al
jne    1771 <rastreadfile+0x5a1>
jmp    1710 <rastreadfile+0x540>
xor    %eax,%eax
test   $0x1,%al
jne    1771 <rastreadfile+0x5a1>
jmp    1710 <rastreadfile+0x540>
lea    -0x1430(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c74(%rbp)
mov    -0x1c70(%rbp),%eax
cmp    -0x1c74(%rbp),%eax
jl     1740 <rastreadfile+0x570>
movb   $0x0,-0x1430(%rbp)
jmp    176c <rastreadfile+0x59c>
lea    -0x1430(%rbp),%rdi
lea    -0x1430(%rbp),%rsi
movslq -0x1c70(%rbp),%rax
add    %rax,%rsi
mov    -0x1c74(%rbp),%edx
add    $0x1,%edx
sub    -0x1c70(%rbp),%edx
call   10c0 <memmove@plt>
jmp    1771 <rastreadfile+0x5a1>
jmp    177b <rastreadfile+0x5ab>
jmp    177b <rastreadfile+0x5ab>
jmp    1780 <rastreadfile+0x5b0>
jmp    178a <rastreadfile+0x5ba>
jmp    178a <rastreadfile+0x5ba>
movl   $0x2,-0x1c50(%rbp)
lea    -0x1430(%rbp),%rdi
lea    -0x1c40(%rbp),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1438(%rbp)
cmp    $0x0,%rax
jne    17bd <rastreadfile+0x5ed>
jmp    17db <rastreadfile+0x60b>
mov    -0x1438(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x3,-0x1c50(%rbp)
movl   $0x1,-0x1c4c(%rbp)
cmpl   $0x1,-0x1c50(%rbp)
je     1850 <rastreadfile+0x680>
lea    -0x1430(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c78(%rbp)
mov    -0x1c44(%rbp),%eax
add    -0x1c78(%rbp),%eax
cmp    -0x1c48(%rbp),%eax
jle    1817 <rastreadfile+0x647>
jmp    1855 <rastreadfile+0x685>
mov    -0x20(%rbp),%rdi
lea    -0x1430(%rbp),%rsi
call   10d0 <strcat@plt>
mov    -0x1c78(%rbp),%eax
add    -0x1c44(%rbp),%eax
mov    %eax,-0x1c44(%rbp)
cmpl   $0x2,-0x1c50(%rbp)
jle    184b <rastreadfile+0x67b>
jmp    1855 <rastreadfile+0x685>
jmp    1850 <rastreadfile+0x680>
jmp    1514 <rastreadfile+0x344>
cmpl   $0x1,-0x1c50(%rbp)
jl     186f <rastreadfile+0x69f>
cmpl   $0x2,-0x1c50(%rbp)
jle    1879 <rastreadfile+0x6a9>
movl   $0x1,-0x1c4c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x1c4c(%rbp),%eax
add    $0x1c80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rastreadfile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c18,%rsp
mov    %rcx,%r15
mov    %rdx,%r12
mov    %esi,%r13d
mov    %rdi,%rbx
lea    0x410(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    $0xffffffff,%ebp
test   %r15,%r15
je     158a <rastreadfile+0x3ba>
movb   $0x0,(%r15)
test   %rbx,%rbx
je     135c <rastreadfile+0x18c>
lea    0x410(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3ff,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x80f(%rsp)
test   %r13d,%r13d
lea    0xdbd(%rip),%rax
lea    0xdb3(%rip),%rsi
cmove  %rax,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   10b0 <rastopenfile@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     135c <rastreadfile+0x18c>
test   %r13d,%r13d
je     1278 <rastreadfile+0xa8>
mov    0x8(%rsp),%rdi
call   1080 <rewind@plt>
mov    $0x0,%r13d
test   %r12,%r12
je     13dc <rastreadfile+0x20c>
cmpb   $0x0,(%r12)
mov    $0x0,%r13d
je     13dc <rastreadfile+0x20c>
lea    0xd81(%rip),%rsi
lea    0x810(%rsp),%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xd6c(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10d0 <strcat@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10d0 <strcat@plt>
lea    0xd45(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
mov    %r14,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1378 <rastreadfile+0x1a8>
mov    %rax,%rbp
lea    0x810(%rsp),%rbx
jmp    1343 <rastreadfile+0x173>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbp),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
call   10c0 <memmove@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1378 <rastreadfile+0x1a8>
cmpb   $0x0,0x0(%rbp)
je     132e <rastreadfile+0x15e>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jg     1320 <rastreadfile+0x150>
movb   $0x0,0x0(%rbp)
jmp    132e <rastreadfile+0x15e>
lea    0xca2(%rip),%rsi
lea    0x410(%rsp),%rdx
mov    %r15,%rdi
call   10e0 <sprintf@plt>
jmp    158a <rastreadfile+0x3ba>
lea    0x10(%rsp),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    $0x1,%r13d
test   %rax,%rax
je     13dc <rastreadfile+0x20c>
mov    %rax,%rbp
lea    0x10(%rsp),%rbx
jmp    13c3 <rastreadfile+0x1f3>
nopl   0x0(%rax)
lea    0x1(%rbp),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
call   10c0 <memmove@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     13dc <rastreadfile+0x20c>
cmpb   $0x0,0x0(%rbp)
je     13ae <rastreadfile+0x1de>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jg     13a0 <rastreadfile+0x1d0>
movb   $0x0,0x0(%rbp)
jmp    13ae <rastreadfile+0x1de>
lea    0xc10(%rsp),%rdi
mov    $0xffe,%esi
mov    0x8(%rsp),%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1566 <rastreadfile+0x396>
xor    %r14d,%r14d
lea    0xc10(%rsp),%rbx
movl   $0x0,0x4(%rsp)
nop
cmp    $0x2,%r13d
je     14f0 <rastreadfile+0x320>
cmp    $0x1,%r13d
je     1440 <rastreadfile+0x270>
test   %r13d,%r13d
jne    1520 <rastreadfile+0x350>
movl   $0x1,0x4(%rsp)
xor    %r13d,%r13d
jmp    1520 <rastreadfile+0x350>
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0x810(%rsp),%rbp
mov    %rbp,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     14d2 <rastreadfile+0x302>
mov    %rax,%r12
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmpb   $0x0,0xc10(%rsp)
je     14f0 <rastreadfile+0x320>
cltq
add    %rax,%r12
cmpb   $0x0,(%r12)
je     14f0 <rastreadfile+0x320>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1060 <strlen@plt>
sub    %eax,%ebp
lea    -0x3e8(%rbp),%eax
cmp    $0xfffffc19,%eax
jb     14f0 <rastreadfile+0x320>
cmpb   $0x0,0xc10(%rsp)
je     14f0 <rastreadfile+0x320>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebp
jge    14dd <rastreadfile+0x30d>
mov    %ebp,%ecx
lea    (%rsp,%rcx,1),%rsi
add    $0xc10,%rsi
sub    %ebp,%eax
add    $0x1,%eax
mov    %rbx,%rdi
mov    %eax,%edx
call   10c0 <memmove@plt>
jmp    14f0 <rastreadfile+0x320>
mov    $0x1,%r13d
mov    %r14d,%ebp
jmp    1546 <rastreadfile+0x376>
movb   $0x0,0xc10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     1515 <rastreadfile+0x345>
movb   $0x0,(%rax)
movl   $0x1,0x4(%rsp)
mov    $0x3,%r13d
jmp    1520 <rastreadfile+0x350>
mov    $0x2,%r13d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
add    %r14d,%ebp
cmp    $0xffff,%ebp
jg     156e <rastreadfile+0x39e>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
cmp    $0x2,%r13d
jg     156e <rastreadfile+0x39e>
mov    %rbx,%rdi
mov    $0xffe,%esi
mov    0x8(%rsp),%rdx
call   10a0 <fgets@plt>
mov    %ebp,%r14d
test   %rax,%rax
jne    1410 <rastreadfile+0x240>
jmp    156e <rastreadfile+0x39e>
movl   $0x0,0x4(%rsp)
add    $0xfffffffd,%r13d
cmp    $0xfffffffe,%r13d
mov    $0x1,%ebp
cmovae 0x4(%rsp),%ebp
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
mov    %ebp,%eax
add    $0x1c18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"r+\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"{\\normalsize\\rm[file %s?]}\00"
@.str.3 = [2 x i8] c"<\00"
@.str.4 = [3 x i8] c"</\00"
@.str.5 = [2 x i8] c">\00"
define i32 @rastreadfile(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = alloca [4096 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%13 = icmp eq i8* %3, null
br i1 %13, label %139, label %14
14: ; preds = %4
store i8 0, i8* %3
%15 = icmp eq i8* %0, null
br i1 %15, label %23, label %16
16: ; preds = %14
%17 = call i32 @strncpy(i8* %9, i8* %0, i32 1023)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 1023
store i8 0, i8* %18
%19 = icmp eq i32 %1, 0
%20 = select i1 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%21 = call i32* (i8*, i8*, ...) bitcast (i32* (...)* @rastopenfile to i32* (i8*, i8*, ...)*)(i8* %9, i8* %20)
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %14, %16
%24 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %139
25: ; preds = %16
br i1 %19, label %28, label %26
26: ; preds = %25
%27 = call i32 @rewind(i32* %21)
br label %28
28: ; preds = %26, %25
%29 = icmp eq i8* %2, null
br i1 %29, label %73, label %30
30: ; preds = %28
%31 = load i8, i8* %2
%32 = icmp eq i8 %31, 0
br i1 %32, label %73, label %33
33: ; preds = %30
%34 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 @strcat(i8* %11, i8* %2)
%37 = call i32 @strcat(i8* %12, i8* %2)
%38 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = call i8* @strchr(i8* %11, i8 signext 32)
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %56, %33
%43 = call i8* @strchr(i8* %12, i8 signext 32)
%44 = icmp eq i8* %43, null
br i1 %44, label %73, label %59
45: ; preds = %33, %56
%46 = phi i8* [ %57, %56 ], [ %40, %33 ]
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 0
br i1 %48, label %56, label %49
49: ; preds = %45
%50 = call i32 @strlen(i8* %46)
%51 = icmp slt i32 %50, 2
br i1 %51, label %52, label %53
52: ; preds = %49
store i8 0, i8* %46
br label %56
53: ; preds = %49
%54 = getelementptr inbounds i8, i8* %46, i64 1
%55 = call i32 @memmove(i8* %46, i8* %54, i32 %50)
br label %56
56: ; preds = %52, %53, %45
%57 = call i8* @strchr(i8* %11, i8 signext 32)
%58 = icmp eq i8* %57, null
br i1 %58, label %42, label %45
59: ; preds = %42, %70
%60 = phi i8* [ %71, %70 ], [ %43, %42 ]
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %59
%64 = call i32 @strlen(i8* %60)
%65 = icmp slt i32 %64, 2
br i1 %65, label %66, label %67
66: ; preds = %63
store i8 0, i8* %60
br label %70
67: ; preds = %63
%68 = getelementptr inbounds i8, i8* %60, i64 1
%69 = call i32 @memmove(i8* %60, i8* %68, i32 %64)
br label %70
70: ; preds = %66, %67, %59
%71 = call i8* @strchr(i8* %12, i8 signext 32)
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %59
73: ; preds = %70, %42, %30, %28
%74 = phi i32 [ 0, %30 ], [ 0, %28 ], [ 1, %42 ], [ 1, %70 ]
%75 = call i8* @fgets(i8* %10, i32 4094, i32* %21)
%76 = icmp eq i8* %75, null
br i1 %76, label %132, label %77
77: ; preds = %73, %126
%78 = phi i32 [ %129, %126 ], [ 0, %73 ]
%79 = phi i32 [ %127, %126 ], [ 0, %73 ]
%80 = phi i32 [ %128, %126 ], [ %74, %73 ]
switch i32 %80, label %117 [
i32 0, label %81
i32 1, label %82
i32 2, label %113
]
81: ; preds = %77
br label %117
82: ; preds = %77
%83 = call i8* @strstr(i8* %10, i8* %11)
%84 = icmp eq i8* %83, null
br i1 %84, label %126, label %85
85: ; preds = %82
%86 = call i32 @strlen(i8* %11)
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %83, i64 %87
%89 = load i8, i8* %10
%90 = icmp eq i8 %89, 0
br i1 %90, label %113, label %91
91: ; preds = %85
%92 = load i8, i8* %88
%93 = icmp eq i8 %92, 0
br i1 %93, label %113, label %94
94: ; preds = %91
%95 = call i32 @strlen(i8* %10)
%96 = call i32 @strlen(i8* %88)
%97 = sub nsw i32 %95, %96
%98 = add i32 %97, -1000
%99 = icmp ult i32 %98, -999
%100 = load i8, i8* %10
%101 = icmp eq i8 %100, 0
%102 = select i1 %99, i1 true, i1 %101
br i1 %102, label %113, label %103
103: ; preds = %94
%104 = call i32 @strlen(i8* %10)
%105 = icmp slt i32 %97, %104
br i1 %105, label %107, label %106
106: ; preds = %103
store i8 0, i8* %10
br label %113
107: ; preds = %103
%108 = zext i32 %97 to i64
%109 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %108
%110 = sub nsw i32 1, %97
%111 = add i32 %110, %104
%112 = call i32 @memmove(i8* %10, i8* %109, i32 %111)
br label %113
113: ; preds = %91, %85, %106, %107, %94, %77
%114 = call i8* @strstr(i8* %10, i8* %12)
%115 = icmp eq i8* %114, null
br i1 %115, label %117, label %116
116: ; preds = %113
store i8 0, i8* %114
br label %117
117: ; preds = %77, %113, %116, %81
%118 = phi i32 [ 0, %81 ], [ 3, %116 ], [ 2, %113 ], [ %80, %77 ]
%119 = phi i32 [ 1, %81 ], [ 1, %116 ], [ %79, %113 ], [ %79, %77 ]
%120 = call i32 @strlen(i8* %10)
%121 = add nsw i32 %120, %78
%122 = icmp sgt i32 %121, 65535
br i1 %122, label %132, label %123
123: ; preds = %117
%124 = call i32 @strcat(i8* %3, i8* %10)
%125 = icmp sgt i32 %118, 2
br i1 %125, label %132, label %126
126: ; preds = %123, %82
%127 = phi i32 [ %79, %82 ], [ %119, %123 ]
%128 = phi i32 [ 1, %82 ], [ %118, %123 ]
%129 = phi i32 [ %78, %82 ], [ %121, %123 ]
%130 = call i8* @fgets(i8* %10, i32 4094, i32* %21)
%131 = icmp eq i8* %130, null
br i1 %131, label %132, label %77
132: ; preds = %126, %117, %123, %73
%133 = phi i32 [ %74, %73 ], [ %118, %123 ], [ %118, %117 ], [ %128, %126 ]
%134 = phi i32 [ 0, %73 ], [ %119, %123 ], [ %119, %117 ], [ %127, %126 ]
%135 = add i32 %133, -3
%136 = icmp ult i32 %135, -2
%137 = select i1 %136, i32 1, i32 %134
%138 = call i32 @fclose(i32* %21)
br label %139
139: ; preds = %4, %132, %23
%140 = phi i32 [ -1, %4 ], [ -1, %23 ], [ %137, %132 ]
ret i32 %140
}