#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 CopyOrSkip(char *, char *, int *, int *);
int /*<<< orphan*/ SafeFree(char *, char *, int);
char *SafeMalloc(int, char *, int);
char *SafeRealloc(char *, int, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, unsigned int);
char *rtf(char *c, int verbatim) {
  static char safe[4][256], *malloced[4] = {NULL, NULL, NULL, NULL};
  static int which = 0;
  int copy = 0, skip = 0;
  int i = 0, j = 0, delta = 4, len = 256 - delta;
  char *ret;
  which = (which + 1) % 4;
  ret = safe[which];
  safe[which][0] = 0;
  if (malloced[which]) {
    SafeFree(malloced[which],
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/farhi/idl2matlab/refs/heads/master/"
             "cxref/rtf.c",
             935);
    malloced[which] = NULL;
  }
  if (c) {
    i = CopyOrSkip(c, "rtf", &copy, &skip);
    while (1) {
      for (; j < len && c[i]; i++) {
        if (copy) {
          ret[j++] = c[i];
          if (c[i] == '\n')
            copy = 0;
        } else if (skip) {
          if (c[i] == '\n')
            skip = 0;
        } else if (!verbatim && (j == 0 || ret[j - 1] == ' ') &&
                   (c[i] == ' ' || c[i] == '\t' || c[i] == '\n'))
          ;
        else
          switch (c[i]) {
          case '\\':
          case '{':
          case '}':
            ret[j++] = '\\';
            ret[j++] = c[i];
            break;
          case '\t':
            if (!verbatim)
              ret[j++] = c[i];
            else
              ret[j++] = ' ';
            break;
          case '\n':
            if (verbatim)
              ret[j++] = '\\', ret[j++] = 'p', ret[j++] = 'a', ret[j++] = 'r';
            else
              ret[j++] = ' ';
            break;
          default:
            ret[j++] = c[i];
          }
        if (c[i] == '\n')
          i += CopyOrSkip(c + i, "rtf", &copy, &skip);
      }
      if (c[i]) {
        if (malloced[which])
          malloced[which] =
              SafeRealloc(malloced[which], len + delta + 256,
                          "/scratch/repos/new/home/jordi_armengol_estape/"
                          "c-scraper/outputs/2022-01-22/02-19-57/repos/farhi/"
                          "idl2matlab/refs/heads/master/cxref/rtf.c",
                          982);
        else {
          malloced[which] =
              SafeMalloc(len + delta + 256,
                         "/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/farhi/"
                         "idl2matlab/refs/heads/master/cxref/rtf.c",
                         984);
          strncpy(malloced[which], ret, (unsigned)j);
        }
        ret = malloced[which];
        len += 256;
      } else {
        ret[j] = 0;
        if (!verbatim && j--)
          while (ret[j] == ' ')
            ret[j--] = 0;
        break;
      }
    }
  }
  return (ret);
}


x86 assembly (clang, -O0):
<rtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x4,-0x20(%rbp)
mov    $0x100,%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x32ed(%rip),%eax
add    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,0x32dc(%rip)
movslq 0x32d5(%rip),%rcx
lea    0x2eae(%rip),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movslq 0x32bc(%rip),%rcx
lea    0x2e95(%rip),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
movslq 0x32a4(%rip),%rcx
lea    0x327d(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     1227 <rtf+0xd7>
movslq 0x328b(%rip),%rcx
lea    0x3264(%rip),%rax
mov    (%rax,%rcx,8),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x3a7,%edx
call   1060 <SafeFree@plt>
movslq 0x3268(%rip),%rcx
lea    0x3241(%rip),%rax
movq   $0x0,(%rax,%rcx,8)
cmpq   $0x0,-0x8(%rbp)
je     16b1 <rtf+0x561>
mov    -0x8(%rbp),%rdi
lea    0xe4c(%rip),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1070 <CopyOrSkip@plt>
mov    %eax,-0x18(%rbp)
jmp    1252 <rtf+0x102>
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x24(%rbp),%ecx
mov    %al,-0x31(%rbp)
jge    1278 <rtf+0x128>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    1288 <rtf+0x138>
jmp    1554 <rtf+0x404>
cmpl   $0x0,-0x10(%rbp)
je     12d3 <rtf+0x183>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    12ce <rtf+0x17e>
movl   $0x0,-0x10(%rbp)
jmp    1507 <rtf+0x3b7>
cmpl   $0x0,-0x14(%rbp)
je     12fe <rtf+0x1ae>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    12f9 <rtf+0x1a9>
movl   $0x0,-0x14(%rbp)
jmp    1502 <rtf+0x3b2>
cmpl   $0x0,-0xc(%rbp)
jne    1370 <rtf+0x220>
cmpl   $0x0,-0x1c(%rbp)
je     132c <rtf+0x1dc>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1370 <rtf+0x220>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     136b <rtf+0x21b>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     136b <rtf+0x21b>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1370 <rtf+0x220>
jmp    14fd <rtf+0x3ad>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x38(%rbp)
sub    $0x9,%eax
je     140c <rtf+0x2bc>
jmp    138d <rtf+0x23d>
mov    -0x38(%rbp),%eax
sub    $0xa,%eax
je     1456 <rtf+0x306>
jmp    139e <rtf+0x24e>
mov    -0x38(%rbp),%eax
sub    $0x5c,%eax
je     13d1 <rtf+0x281>
jmp    13af <rtf+0x25f>
mov    -0x38(%rbp),%eax
sub    $0x7b,%eax
je     13d1 <rtf+0x281>
jmp    13c0 <rtf+0x270>
mov    -0x38(%rbp),%eax
sub    $0x7d,%eax
jne    14d8 <rtf+0x388>
jmp    13d1 <rtf+0x281>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    14f8 <rtf+0x3a8>
cmpl   $0x0,-0xc(%rbp)
jne    143b <rtf+0x2eb>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1451 <rtf+0x301>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    14f8 <rtf+0x3a8>
cmpl   $0x0,-0xc(%rbp)
je     14bd <rtf+0x36d>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x70,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x61,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x72,(%rax,%rcx,1)
jmp    14d3 <rtf+0x383>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    14f8 <rtf+0x3a8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    14fd <rtf+0x3ad>
jmp    1502 <rtf+0x3b2>
jmp    1507 <rtf+0x3b7>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1541 <rtf+0x3f1>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
lea    0xb5b(%rip),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1070 <CopyOrSkip@plt>
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1546 <rtf+0x3f6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1252 <rtf+0x102>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     163e <rtf+0x4ee>
movslq 0x2f13(%rip),%rcx
lea    0x2eec(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     15c8 <rtf+0x478>
movslq 0x2efa(%rip),%rcx
lea    0x2ed3(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    -0x24(%rbp),%esi
add    -0x20(%rbp),%esi
add    $0x100,%esi
lea    0xa5c(%rip),%rdx
mov    $0x3d6,%ecx
call   1040 <SafeRealloc@plt>
mov    %rax,%rdx
movslq 0x2ec8(%rip),%rcx
lea    0x2ea1(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
jmp    1618 <rtf+0x4c8>
mov    -0x24(%rbp),%edi
add    -0x20(%rbp),%edi
add    $0x100,%edi
lea    0xa25(%rip),%rsi
mov    $0x3d8,%edx
call   1050 <SafeMalloc@plt>
mov    %rax,%rdx
movslq 0x2e91(%rip),%rcx
lea    0x2e6a(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
movslq 0x2e7f(%rip),%rcx
lea    0x2e58(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
movslq 0x2e61(%rip),%rcx
lea    0x2e3a(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x100,%eax
mov    %eax,-0x24(%rbp)
jmp    16a7 <rtf+0x557>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0xc(%rbp)
jne    16a2 <rtf+0x552>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     16a2 <rtf+0x552>
jmp    166d <rtf+0x51d>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    169d <rtf+0x54d>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    166d <rtf+0x51d>
jmp    16a2 <rtf+0x552>
jmp    16ac <rtf+0x55c>
jmp    124d <rtf+0xfd>
jmp    16b1 <rtf+0x561>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0xc(%rsp)
mov    %rdi,%rbx
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
mov    0x3305(%rip),%eax
lea    0x1(%rax),%ecx
lea    0x4(%rax),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
and    $0xfffffffc,%edx
neg    %edx
lea    (%rax,%rdx,1),%r14d
add    $0x1,%r14d
mov    %r14d,0x32e6(%rip)
lea    0x32bf(%rip),%r15
mov    (%r15,%r14,8),%rdi
shl    $0x8,%r14
lea    0x2eb0(%rip),%rbp
movb   $0x0,(%r14,%rbp,1)
test   %rdi,%rdi
je     11d9 <rtf+0x89>
lea    0xe3f(%rip),%rsi
mov    $0x3a7,%edx
call   1060 <SafeFree@plt>
mov    0x32af(%rip),%eax
movq   $0x0,(%r15,%rax,8)
add    %r14,%rbp
test   %rbx,%rbx
je     148d <rtf+0x33d>
lea    0xe9d(%rip),%r13
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <CopyOrSkip@plt>
mov    %eax,%r14d
mov    $0xfc,%r12d
xor    %r15d,%r15d
cmp    %r12d,%r15d
jl     1242 <rtf+0xf2>
jmp    13b3 <rtf+0x263>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1070 <CopyOrSkip@plt>
add    %eax,%r14d
add    $0x1,%r14d
cmp    %r12d,%r15d
jge    13b3 <rtf+0x263>
movslq %r14d,%rdi
movsbl (%rbx,%rdi,1),%eax
test   %eax,%eax
je     13b3 <rtf+0x263>
add    %rbx,%rdi
cmpl   $0x0,0x14(%rsp)
je     1280 <rtf+0x130>
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,0x0(%rbp,%rcx,1)
cmpb   $0xa,(%rdi)
jne    1235 <rtf+0xe5>
movl   $0x0,0x14(%rsp)
jmp    1220 <rtf+0xd0>
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,0x10(%rsp)
je     129e <rtf+0x14e>
cmp    $0xa,%al
jne    1390 <rtf+0x240>
movl   $0x0,0x10(%rsp)
cmpb   $0xa,(%rdi)
je     1220 <rtf+0xd0>
jmp    1235 <rtf+0xe5>
cmpl   $0x0,0xc(%rsp)
je     131d <rtf+0x1cd>
lea    -0x5c(%rax),%ecx
cmp    $0x21,%ecx
ja     12de <rtf+0x18e>
movabs $0x280000001,%rdx
bt     %rcx,%rdx
jae    12de <rtf+0x18e>
movslq %r15d,%rax
movb   $0x5c,0x0(%rbp,%rax,1)
movzbl (%rdi),%ecx
add    $0x2,%r15d
mov    %cl,0x1(%rbp,%rax,1)
cmpb   $0xa,(%rdi)
je     1220 <rtf+0xd0>
jmp    1235 <rtf+0xe5>
cmp    $0x9,%eax
je     1350 <rtf+0x200>
cmp    $0xa,%eax
jne    1365 <rtf+0x215>
movslq %r15d,%rax
lea    0x1(%rax),%rcx
cmpl   $0x0,0xc(%rsp)
je     137e <rtf+0x22e>
movb   $0x5c,0x0(%rbp,%rax,1)
movb   $0x70,0x0(%rbp,%rcx,1)
movw   $0x7261,0x2(%rax,%rbp,1)
add    $0x4,%r15d
cmpb   $0xa,(%rdi)
je     1220 <rtf+0xd0>
jmp    1235 <rtf+0xe5>
test   %r15d,%r15d
je     1330 <rtf+0x1e0>
movslq %r15d,%rcx
cmpb   $0x20,-0x1(%rcx,%rbp,1)
jne    12a5 <rtf+0x155>
cmp    $0x20,%al
ja     12a5 <rtf+0x155>
movzbl %al,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jb     1390 <rtf+0x240>
jmp    12a5 <rtf+0x155>
lea    0x1(%r15),%ecx
movslq %r15d,%rdx
cmpl   $0x0,0xc(%rsp)
je     139e <rtf+0x24e>
movb   $0x20,0x0(%rbp,%rdx,1)
jmp    13a2 <rtf+0x252>
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,0x0(%rbp,%rcx,1)
cmpb   $0xa,(%rdi)
jne    1235 <rtf+0xe5>
jmp    1220 <rtf+0xd0>
movb   $0x20,0x0(%rbp,%rax,1)
mov    %ecx,%r15d
cs nopw 0x0(%rax,%rax,1)
cmpb   $0xa,(%rdi)
je     1220 <rtf+0xd0>
jmp    1235 <rtf+0xe5>
mov    %al,0x0(%rbp,%rdx,1)
mov    %ecx,%r15d
cmpb   $0xa,(%rdi)
je     1220 <rtf+0xd0>
jmp    1235 <rtf+0xe5>
movslq %r14d,%rax
cmpb   $0x0,(%rbx,%rax,1)
je     1453 <rtf+0x303>
mov    0x30ba(%rip),%eax
lea    0x3093(%rip),%r13
mov    0x0(%r13,%rax,8),%rdi
lea    0x104(%r12),%esi
test   %rdi,%rdi
je     1400 <rtf+0x2b0>
lea    0xc1a(%rip),%rdx
mov    $0x3d6,%ecx
call   1040 <SafeRealloc@plt>
mov    %rax,%rbp
mov    0x3087(%rip),%eax
mov    %rbp,0x0(%r13,%rax,8)
jmp    1437 <rtf+0x2e7>
mov    %esi,%edi
lea    0xbf7(%rip),%rsi
mov    $0x3d8,%edx
call   1050 <SafeMalloc@plt>
mov    0x3067(%rip),%ecx
mov    %rax,0x0(%r13,%rcx,8)
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
mov    0x304e(%rip),%eax
mov    0x0(%r13,%rax,8),%rbp
add    $0x100,%r12d
lea    0xc44(%rip),%r13
cmp    %r12d,%r15d
jl     1242 <rtf+0xf2>
jmp    13b3 <rtf+0x263>
movslq %r15d,%rax
movb   $0x0,0x0(%rbp,%rax,1)
cmpl   $0x0,0xc(%rsp)
jne    148d <rtf+0x33d>
test   %r15d,%r15d
je     148d <rtf+0x33d>
cmpb   $0x20,-0x1(%rax,%rbp,1)
jne    148d <rtf+0x33d>
add    %rbp,%rax
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,(%rax)
cmpb   $0x20,-0x1(%rax)
lea    -0x1(%rax),%rax
je     1480 <rtf+0x330>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@rtf.safe = internal global [4 x [256 x i8]] zeroinitializer
@rtf.malloced = internal global [4 x i8*] zeroinitializer
@rtf.which = internal global i32 0
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/farhi/idl2matlab/refs/heads/master/cxref/rtf.c\00"
@.str.1 = [4 x i8] c"rtf\00"
define i8* @rtf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 4, i32* %9
%12 = load i32, i32* %9
%13 = sub nsw i32 256, %12
store i32 %13, i32* %10
%14 = load i32, i32* @rtf.which
%15 = add nsw i32 %14, 1
%16 = srem i32 %15, 4
store i32 %16, i32* @rtf.which
%17 = load i32, i32* @rtf.which
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x [256 x i8]], [4 x [256 x i8]]* @rtf.safe, i64 0, i64 %18
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
store i8* %20, i8** %11
%21 = load i32, i32* @rtf.which
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [4 x [256 x i8]], [4 x [256 x i8]]* @rtf.safe, i64 0, i64 %22
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %23, i64 0, i64 0
store i8 0, i8* %24
%25 = load i32, i32* @rtf.which
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %39
30: ; preds = %2
%31 = load i32, i32* @rtf.which
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @SafeFree(i8* %34, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 935)
%36 = load i32, i32* @rtf.which
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %37
store i8* null, i8** %38
br label %39
39: ; preds = %30, %2
%40 = load i8*, i8** %3
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %324
42: ; preds = %39
%43 = load i8*, i8** %3
%44 = call i32 @CopyOrSkip(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
store i32 %44, i32* %7
br label %45
45: ; preds = %42, %322
br label %46
46: ; preds = %242, %45
%47 = load i32, i32* %8
%48 = load i32, i32* %10
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %58
50: ; preds = %46
%51 = load i8*, i8** %3
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 0
br label %58
58: ; preds = %50, %46
%59 = phi i1 [ false, %46 ], [ %57, %50 ]
br i1 %59, label %60, label %245
60: ; preds = %58
%61 = load i32, i32* %5
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %83
63: ; preds = %60
%64 = load i8*, i8** %3
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %64, i64 %66
%68 = load i8, i8* %67
%69 = load i8*, i8** %11
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
%72 = sext i32 %70 to i64
%73 = getelementptr inbounds i8, i8* %69, i64 %72
store i8 %68, i8* %73
%74 = load i8*, i8** %3
%75 = load i32, i32* %7
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 10
br i1 %80, label %81, label %82
81: ; preds = %63
store i32 0, i32* %5
br label %82
82: ; preds = %81, %63
br label %225
83: ; preds = %60
%84 = load i32, i32* %6
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %96
86: ; preds = %83
%87 = load i8*, i8** %3
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 10
br i1 %93, label %94, label %95
94: ; preds = %86
store i32 0, i32* %6
br label %95
95: ; preds = %94, %86
br label %224
96: ; preds = %83
%97 = load i32, i32* %4
%98 = icmp ne i32 %97, 0
br i1 %98, label %136, label %99
99: ; preds = %96
%100 = load i32, i32* %8
%101 = icmp eq i32 %100, 0
br i1 %101, label %111, label %102
102: ; preds = %99
%103 = load i8*, i8** %11
%104 = load i32, i32* %8
%105 = sub nsw i32 %104, 1
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %103, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 32
br i1 %110, label %111, label %136
111: ; preds = %102, %99
%112 = load i8*, i8** %3
%113 = load i32, i32* %7
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %112, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 32
br i1 %118, label %135, label %119
119: ; preds = %111
%120 = load i8*, i8** %3
%121 = load i32, i32* %7
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 9
br i1 %126, label %135, label %127
127: ; preds = %119
%128 = load i8*, i8** %3
%129 = load i32, i32* %7
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 10
br i1 %134, label %135, label %136
135: ; preds = %127, %119, %111
br label %223
136: ; preds = %127, %102, %96
%137 = load i8*, i8** %3
%138 = load i32, i32* %7
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8, i8* %137, i64 %139
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
switch i32 %142, label %211 [
i32 92, label %143
i32 123, label %143
i32 125, label %143
i32 9, label %159
i32 10, label %180
]
143: ; preds = %136, %136, %136
%144 = load i8*, i8** %11
%145 = load i32, i32* %8
%146 = add nsw i32 %145, 1
store i32 %146, i32* %8
%147 = sext i32 %145 to i64
%148 = getelementptr inbounds i8, i8* %144, i64 %147
store i8 92, i8* %148
%149 = load i8*, i8** %3
%150 = load i32, i32* %7
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i8, i8* %149, i64 %151
%153 = load i8, i8* %152
%154 = load i8*, i8** %11
%155 = load i32, i32* %8
%156 = add nsw i32 %155, 1
store i32 %156, i32* %8
%157 = sext i32 %155 to i64
%158 = getelementptr inbounds i8, i8* %154, i64 %157
store i8 %153, i8* %158
br label %222
159: ; preds = %136
%160 = load i32, i32* %4
%161 = icmp ne i32 %160, 0
br i1 %161, label %173, label %162
162: ; preds = %159
%163 = load i8*, i8** %3
%164 = load i32, i32* %7
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
%167 = load i8, i8* %166
%168 = load i8*, i8** %11
%169 = load i32, i32* %8
%170 = add nsw i32 %169, 1
store i32 %170, i32* %8
%171 = sext i32 %169 to i64
%172 = getelementptr inbounds i8, i8* %168, i64 %171
store i8 %167, i8* %172
br label %179
173: ; preds = %159
%174 = load i8*, i8** %11
%175 = load i32, i32* %8
%176 = add nsw i32 %175, 1
store i32 %176, i32* %8
%177 = sext i32 %175 to i64
%178 = getelementptr inbounds i8, i8* %174, i64 %177
store i8 32, i8* %178
br label %179
179: ; preds = %173, %162
br label %222
180: ; preds = %136
%181 = load i32, i32* %4
%182 = icmp ne i32 %181, 0
br i1 %182, label %183, label %204
183: ; preds = %180
%184 = load i8*, i8** %11
%185 = load i32, i32* %8
%186 = add nsw i32 %185, 1
store i32 %186, i32* %8
%187 = sext i32 %185 to i64
%188 = getelementptr inbounds i8, i8* %184, i64 %187
store i8 92, i8* %188
%189 = load i8*, i8** %11
%190 = load i32, i32* %8
%191 = add nsw i32 %190, 1
store i32 %191, i32* %8
%192 = sext i32 %190 to i64
%193 = getelementptr inbounds i8, i8* %189, i64 %192
store i8 112, i8* %193
%194 = load i8*, i8** %11
%195 = load i32, i32* %8
%196 = add nsw i32 %195, 1
store i32 %196, i32* %8
%197 = sext i32 %195 to i64
%198 = getelementptr inbounds i8, i8* %194, i64 %197
store i8 97, i8* %198
%199 = load i8*, i8** %11
%200 = load i32, i32* %8
%201 = add nsw i32 %200, 1
store i32 %201, i32* %8
%202 = sext i32 %200 to i64
%203 = getelementptr inbounds i8, i8* %199, i64 %202
store i8 114, i8* %203
br label %210
204: ; preds = %180
%205 = load i8*, i8** %11
%206 = load i32, i32* %8
%207 = add nsw i32 %206, 1
store i32 %207, i32* %8
%208 = sext i32 %206 to i64
%209 = getelementptr inbounds i8, i8* %205, i64 %208
store i8 32, i8* %209
br label %210
210: ; preds = %204, %183
br label %222
211: ; preds = %136
%212 = load i8*, i8** %3
%213 = load i32, i32* %7
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds i8, i8* %212, i64 %214
%216 = load i8, i8* %215
%217 = load i8*, i8** %11
%218 = load i32, i32* %8
%219 = add nsw i32 %218, 1
store i32 %219, i32* %8
%220 = sext i32 %218 to i64
%221 = getelementptr inbounds i8, i8* %217, i64 %220
store i8 %216, i8* %221
br label %222
222: ; preds = %211, %210, %179, %143
br label %223
223: ; preds = %222, %135
br label %224
224: ; preds = %223, %95
br label %225
225: ; preds = %224, %82
%226 = load i8*, i8** %3
%227 = load i32, i32* %7
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds i8, i8* %226, i64 %228
%230 = load i8, i8* %229
%231 = sext i8 %230 to i32
%232 = icmp eq i32 %231, 10
br i1 %232, label %233, label %241
233: ; preds = %225
%234 = load i8*, i8** %3
%235 = load i32, i32* %7
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i8, i8* %234, i64 %236
%238 = call i32 @CopyOrSkip(i8* %237, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%239 = load i32, i32* %7
%240 = add nsw i32 %239, %238
store i32 %240, i32* %7
br label %241
241: ; preds = %233, %225
br label %242
242: ; preds = %241
%243 = load i32, i32* %7
%244 = add nsw i32 %243, 1
store i32 %244, i32* %7
br label %46
245: ; preds = %58
%246 = load i8*, i8** %3
%247 = load i32, i32* %7
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds i8, i8* %246, i64 %248
%250 = load i8, i8* %249
%251 = icmp ne i8 %250, 0
br i1 %251, label %252, label %294
252: ; preds = %245
%253 = load i32, i32* @rtf.which
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %254
%256 = load i8*, i8** %255
%257 = icmp ne i8* %256, null
br i1 %257, label %258, label %271
258: ; preds = %252
%259 = load i32, i32* @rtf.which
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %260
%262 = load i8*, i8** %261
%263 = load i32, i32* %10
%264 = load i32, i32* %9
%265 = add nsw i32 %263, %264
%266 = add nsw i32 %265, 256
%267 = call i8* @SafeRealloc(i8* %262, i32 %266, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 982)
%268 = load i32, i32* @rtf.which
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %269
store i8* %267, i8** %270
br label %287
271: ; preds = %252
%272 = load i32, i32* %10
%273 = load i32, i32* %9
%274 = add nsw i32 %272, %273
%275 = add nsw i32 %274, 256
%276 = call i8* @SafeMalloc(i32 %275, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 984)
%277 = load i32, i32* @rtf.which
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %278
store i8* %276, i8** %279
%280 = load i32, i32* @rtf.which
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %281
%283 = load i8*, i8** %282
%284 = load i8*, i8** %11
%285 = load i32, i32* %8
%286 = call i32 @strncpy(i8* %283, i8* %284, i32 %285)
br label %287
287: ; preds = %271, %258
%288 = load i32, i32* @rtf.which
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %289
%291 = load i8*, i8** %290
store i8* %291, i8** %11
%292 = load i32, i32* %10
%293 = add nsw i32 %292, 256
store i32 %293, i32* %10
br label %322
294: ; preds = %245
%295 = load i8*, i8** %11
%296 = load i32, i32* %8
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds i8, i8* %295, i64 %297
store i8 0, i8* %298
%299 = load i32, i32* %4
%300 = icmp ne i32 %299, 0
br i1 %300, label %321, label %301
301: ; preds = %294
%302 = load i32, i32* %8
%303 = add nsw i32 %302, -1
store i32 %303, i32* %8
%304 = icmp ne i32 %302, 0
br i1 %304, label %305, label %321
305: ; preds = %301
br label %306
306: ; preds = %314, %305
%307 = load i8*, i8** %11
%308 = load i32, i32* %8
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds i8, i8* %307, i64 %309
%311 = load i8, i8* %310
%312 = sext i8 %311 to i32
%313 = icmp eq i32 %312, 32
br i1 %313, label %314, label %320
314: ; preds = %306
%315 = load i8*, i8** %11
%316 = load i32, i32* %8
%317 = add nsw i32 %316, -1
store i32 %317, i32* %8
%318 = sext i32 %316 to i64
%319 = getelementptr inbounds i8, i8* %315, i64 %318
store i8 0, i8* %319
br label %306
320: ; preds = %306
br label %321
321: ; preds = %320, %301, %294
br label %323
322: ; preds = %287
br label %45
323: ; preds = %321
br label %324
324: ; preds = %323, %39
%325 = load i8*, i8** %11
ret i8* %325
}

LLVM IR (-O2):
@rtf.safe = internal global [4 x [256 x i8]] zeroinitializer
@rtf.malloced = internal unnamed_addr global [4 x i8*] zeroinitializer
@rtf.which = internal unnamed_addr global i32 0
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/farhi/idl2matlab/refs/heads/master/cxref/rtf.c\00"
@.str.1 = [4 x i8] c"rtf\00"
define i8* @rtf(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = load i32, i32* @rtf.which
%8 = add nsw i32 %7, 1
%9 = srem i32 %8, 4
store i32 %9, i32* @rtf.which
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [4 x [256 x i8]], [4 x [256 x i8]]* @rtf.safe, i64 0, i64 %10, i64 0
store i8 0, i8* %11
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %10
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %2
%16 = tail call i32 @SafeFree(i8* %13, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 935)
%17 = load i32, i32* @rtf.which
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %18
store i8* null, i8** %19
br label %20
20: ; preds = %15, %2
%21 = icmp eq i8* %0, null
br i1 %21, label %163, label %22
22: ; preds = %20
%23 = call i32 @CopyOrSkip(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%24 = icmp eq i32 %1, 0
br label %25
25: ; preds = %141, %22
%26 = phi i32 [ 0, %22 ], [ %113, %141 ]
%27 = phi i32 [ %23, %22 ], [ %114, %141 ]
%28 = phi i32 [ 252, %22 ], [ %143, %141 ]
%29 = phi i8* [ %11, %22 ], [ %142, %141 ]
%30 = icmp slt i32 %26, %28
br i1 %30, label %31, label %112
31: ; preds = %25, %107
%32 = phi i32 [ %110, %107 ], [ %27, %25 ]
%33 = phi i32 [ %108, %107 ], [ %26, %25 ]
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %112, label %38
38: ; preds = %31
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %38
%42 = add nsw i32 %33, 1
%43 = sext i32 %33 to i64
%44 = getelementptr inbounds i8, i8* %29, i64 %43
store i8 %36, i8* %44
%45 = load i8, i8* %35
%46 = icmp eq i8 %45, 10
br i1 %46, label %47, label %107
47: ; preds = %41
store i32 0, i32* %3
br label %103
48: ; preds = %38
%49 = load i32, i32* %4
%50 = icmp eq i32 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = icmp eq i8 %36, 10
br i1 %52, label %53, label %99
53: ; preds = %51
store i32 0, i32* %4
br label %99
54: ; preds = %48
br i1 %24, label %55, label %64
55: ; preds = %54
%56 = icmp eq i32 %33, 0
br i1 %56, label %63, label %57
57: ; preds = %55
%58 = add nsw i32 %33, -1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %29, i64 %59
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 32
br i1 %62, label %63, label %64
63: ; preds = %57, %55
switch i8 %36, label %64 [
i8 32, label %99
i8 9, label %99
i8 10, label %99
]
64: ; preds = %63, %57, %54
%65 = sext i8 %36 to i32
switch i32 %65, label %95 [
i32 92, label %66
i32 123, label %66
i32 125, label %66
i32 9, label %74
i32 10, label %80
]
66: ; preds = %64, %64, %64
%67 = add nsw i32 %33, 1
%68 = sext i32 %33 to i64
%69 = getelementptr inbounds i8, i8* %29, i64 %68
store i8 92, i8* %69
%70 = load i8, i8* %35
%71 = add nsw i32 %33, 2
%72 = sext i32 %67 to i64
%73 = getelementptr inbounds i8, i8* %29, i64 %72
store i8 %70, i8* %73
br label %99
74: ; preds = %64
%75 = add nsw i32 %33, 1
%76 = sext i32 %33 to i64
%77 = getelementptr inbounds i8, i8* %29, i64 %76
br i1 %24, label %78, label %79
78: ; preds = %74
store i8 %36, i8* %77
br label %99
79: ; preds = %74
store i8 32, i8* %77
br label %99
80: ; preds = %64
%81 = add nsw i32 %33, 1
%82 = sext i32 %33 to i64
%83 = getelementptr inbounds i8, i8* %29, i64 %82
br i1 %24, label %94, label %84
84: ; preds = %80
store i8 92, i8* %83
%85 = add nsw i32 %33, 2
%86 = sext i32 %81 to i64
%87 = getelementptr inbounds i8, i8* %29, i64 %86
store i8 112, i8* %87
%88 = add nsw i32 %33, 3
%89 = sext i32 %85 to i64
%90 = getelementptr inbounds i8, i8* %29, i64 %89
store i8 97, i8* %90
%91 = add nsw i32 %33, 4
%92 = sext i32 %88 to i64
%93 = getelementptr inbounds i8, i8* %29, i64 %92
store i8 114, i8* %93
br label %99
94: ; preds = %80
store i8 32, i8* %83
br label %99
95: ; preds = %64
%96 = add nsw i32 %33, 1
%97 = sext i32 %33 to i64
%98 = getelementptr inbounds i8, i8* %29, i64 %97
store i8 %36, i8* %98
br label %99
99: ; preds = %63, %63, %63, %53, %51, %66, %95, %79, %78, %94, %84
%100 = phi i32 [ %33, %63 ], [ %33, %63 ], [ %33, %63 ], [ %71, %66 ], [ %75, %78 ], [ %75, %79 ], [ %81, %94 ], [ %91, %84 ], [ %96, %95 ], [ %33, %51 ], [ %33, %53 ]
%101 = load i8, i8* %35
%102 = icmp eq i8 %101, 10
br i1 %102, label %103, label %107
103: ; preds = %47, %99
%104 = phi i32 [ %42, %47 ], [ %100, %99 ]
%105 = call i32 @CopyOrSkip(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%106 = add nsw i32 %105, %32
br label %107
107: ; preds = %41, %99, %103
%108 = phi i32 [ %104, %103 ], [ %100, %99 ], [ %42, %41 ]
%109 = phi i32 [ %106, %103 ], [ %32, %99 ], [ %32, %41 ]
%110 = add nsw i32 %109, 1
%111 = icmp slt i32 %108, %28
br i1 %111, label %31, label %112
112: ; preds = %31, %107, %25
%113 = phi i32 [ %26, %25 ], [ %108, %107 ], [ %33, %31 ]
%114 = phi i32 [ %27, %25 ], [ %110, %107 ], [ %32, %31 ]
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %0, i64 %115
%117 = load i8, i8* %116
%118 = icmp eq i8 %117, 0
br i1 %118, label %144, label %119
119: ; preds = %112
%120 = load i32, i32* @rtf.which
%121 = zext i32 %120 to i64
%122 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %121
%123 = load i8*, i8** %122
%124 = icmp eq i8* %123, null
%125 = add nuw nsw i32 %28, 260
br i1 %124, label %131, label %126
126: ; preds = %119
%127 = call i8* @SafeRealloc(i8* %123, i32 %125, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 982)
%128 = load i32, i32* @rtf.which
%129 = zext i32 %128 to i64
%130 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %129
store i8* %127, i8** %130
br label %141
131: ; preds = %119
%132 = call i8* @SafeMalloc(i32 %125, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 984)
%133 = load i32, i32* @rtf.which
%134 = zext i32 %133 to i64
%135 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %134
store i8* %132, i8** %135
%136 = call i32 @strncpy(i8* %132, i8* %29, i32 %113)
%137 = load i32, i32* @rtf.which
%138 = zext i32 %137 to i64
%139 = getelementptr inbounds [4 x i8*], [4 x i8*]* @rtf.malloced, i64 0, i64 %138
%140 = load i8*, i8** %139
br label %141
141: ; preds = %131, %126
%142 = phi i8* [ %140, %131 ], [ %127, %126 ]
%143 = add nuw nsw i32 %28, 256
br label %25
144: ; preds = %112
%145 = sext i32 %113 to i64
%146 = getelementptr inbounds i8, i8* %29, i64 %145
store i8 0, i8* %146
%147 = icmp ne i32 %1, 0
%148 = icmp eq i32 %113, 0
%149 = select i1 %147, i1 true, i1 %148
br i1 %149, label %163, label %150
150: ; preds = %144
%151 = add nsw i32 %113, -1
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8, i8* %29, i64 %152
%154 = load i8, i8* %153
%155 = icmp eq i8 %154, 32
br i1 %155, label %156, label %163
156: ; preds = %150, %156
%157 = phi i64 [ %159, %156 ], [ %152, %150 ]
%158 = phi i8* [ %160, %156 ], [ %153, %150 ]
store i8 0, i8* %158
%159 = add i64 %157, -1
%160 = getelementptr inbounds i8, i8* %29, i64 %159
%161 = load i8, i8* %160
%162 = icmp eq i8 %161, 32
br i1 %162, label %156, label %163
163: ; preds = %156, %150, %144, %20
%164 = phi i8* [ %29, %144 ], [ %11, %20 ], [ %29, %150 ], [ %29, %156 ]
ret i8* %164
}