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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ nl_catd;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ catopen(char *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
char *index(char *, char);
char *my_malloc(int);
int open(char *, int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
nl_catd my_catopenpath(char *name, char *nlspath) {
  int fd;
  nl_catd cfd = (nl_catd)-1;
  char *path0, *path, *s, *file, *lang, *lang_l, *lang_t, *lang_c;
  int langsz, namesz, sz, lang_l_sz, lang_t_sz, lang_c_sz;
  namesz = strlen(name);
  lang = getenv("LANG");
  if (!lang)
    lang = "";
  langsz = strlen(lang);
  lang_l = lang;
  s = index(lang_l, '_');
  if (!s) {
    lang_t = lang_c = "";
    lang_l_sz = langsz;
    lang_t_sz = lang_c_sz = 0;
  } else {
    lang_l_sz = s - lang_l;
    lang_t = s + 1;
    s = index(lang_t, '.');
    if (!s) {
      lang_c = "";
      lang_t_sz = langsz - lang_l_sz - 1;
      lang_c_sz = 0;
    } else {
      lang_t_sz = s - lang_t;
      lang_c = s + 1;
      lang_c_sz = langsz - lang_l_sz - lang_t_sz - 2;
    }
  }
  sz = 0;
  s = nlspath;
  while (*s) {
    if (*s == '%') {
      s++;
      switch (*s) {
      case '%':
        sz++;
        break;
      case 'N':
        sz += namesz;
        break;
      case 'L':
        sz += langsz;
        break;
      case 'l':
        sz += lang_l_sz;
        break;
      case 't':
        sz += lang_t_sz;
        break;
      case 'c':
        sz += lang_c_sz;
        break;
      default:
        break;
      }
    } else if (*s == ':' && (s == nlspath || s[-1] == ':')) {
      sz += (namesz + 1);
    } else
      sz++;
    s++;
  }
  path0 = my_malloc(sz + 1);
  path = path0;
  s = nlspath;
  while (*s) {
    if (*s == '%') {
      s++;
      switch (*s) {
      case '%':
        *path++ = '%';
        break;
      case 'N':
        strncpy(path, name, namesz);
        path += namesz;
        break;
      case 'L':
        strncpy(path, lang, langsz);
        path += langsz;
        break;
      case 'l':
        strncpy(path, lang_l, lang_l_sz);
        path += lang_l_sz;
        break;
      case 't':
        strncpy(path, lang_t, lang_t_sz);
        path += lang_t_sz;
        break;
      case 'c':
        strncpy(path, lang_c, lang_c_sz);
        path += lang_c_sz;
        break;
      default:
        break;
      }
    } else if (*s == ':' && (s == nlspath || s[-1] == ':')) {
      strncpy(path, name, namesz);
      path += namesz;
      *path++ = ':';
    } else
      *path++ = *s;
    s++;
  }
  *path = 0;
  path = path0;
  while (path) {
    file = path;
    s = index(path, ':');
    if (s) {
      *s = 0;
      path = s + 1;
    } else
      path = 0;
    fd = open(file, O_RDONLY);
    if (fd != -1) {
      close(fd);
      cfd = catopen(file, 0);
      break;
    }
  }
  free(path0);
  return cfd;
}


x86 assembly (clang, -O0):
<my_catopenpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x60(%rbp)
lea    0xe43(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11dc <my_catopenpath+0x4c>
lea    0xe2c(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    $0x5f,%esi
call   1080 <index@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    123c <my_catopenpath+0xac>
lea    0xdf0(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xde5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x6c(%rbp)
jmp    12c4 <my_catopenpath+0x134>
mov    -0x30(%rbp),%rax
mov    -0x48(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x68(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    $0x2e,%esi
call   1080 <index@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1296 <my_catopenpath+0x106>
lea    0xd8a(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
sub    -0x68(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
jmp    12bf <my_catopenpath+0x12f>
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
sub    -0x68(%rbp),%eax
sub    -0x6c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x70(%rbp)
jmp    12c4 <my_catopenpath+0x134>
movl   $0x0,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     1426 <my_catopenpath+0x296>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    13c7 <my_catopenpath+0x237>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x74(%rbp)
sub    $0x25,%eax
je     1369 <my_catopenpath+0x1d9>
jmp    1314 <my_catopenpath+0x184>
mov    -0x74(%rbp),%eax
sub    $0x4c,%eax
je     1385 <my_catopenpath+0x1f5>
jmp    1325 <my_catopenpath+0x195>
mov    -0x74(%rbp),%eax
sub    $0x4e,%eax
je     1377 <my_catopenpath+0x1e7>
jmp    1336 <my_catopenpath+0x1a6>
mov    -0x74(%rbp),%eax
sub    $0x63,%eax
je     13af <my_catopenpath+0x21f>
jmp    1347 <my_catopenpath+0x1b7>
mov    -0x74(%rbp),%eax
sub    $0x6c,%eax
je     1393 <my_catopenpath+0x203>
jmp    1358 <my_catopenpath+0x1c8>
mov    -0x74(%rbp),%eax
sub    $0x74,%eax
je     13a1 <my_catopenpath+0x211>
jmp    13bd <my_catopenpath+0x22d>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
mov    -0x60(%rbp),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
mov    -0x5c(%rbp),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
mov    -0x68(%rbp),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
mov    -0x6c(%rbp),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
mov    -0x70(%rbp),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    13c2 <my_catopenpath+0x232>
jmp    13c2 <my_catopenpath+0x232>
jmp    1415 <my_catopenpath+0x285>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1407 <my_catopenpath+0x277>
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     13f6 <my_catopenpath+0x266>
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x3a,%eax
jne    1407 <my_catopenpath+0x277>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    1410 <my_catopenpath+0x280>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1415 <my_catopenpath+0x285>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12d3 <my_catopenpath+0x143>
mov    -0x64(%rbp),%edi
add    $0x1,%edi
call   1050 <my_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     164e <my_catopenpath+0x4be>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    15ba <my_catopenpath+0x42a>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x78(%rbp)
sub    $0x25,%eax
je     14db <my_catopenpath+0x34b>
jmp    1486 <my_catopenpath+0x2f6>
mov    -0x78(%rbp),%eax
sub    $0x4c,%eax
je     1518 <my_catopenpath+0x388>
jmp    1497 <my_catopenpath+0x307>
mov    -0x78(%rbp),%eax
sub    $0x4e,%eax
je     14f2 <my_catopenpath+0x362>
jmp    14a8 <my_catopenpath+0x318>
mov    -0x78(%rbp),%eax
sub    $0x63,%eax
je     158a <my_catopenpath+0x3fa>
jmp    14b9 <my_catopenpath+0x329>
mov    -0x78(%rbp),%eax
sub    $0x6c,%eax
je     153e <my_catopenpath+0x3ae>
jmp    14ca <my_catopenpath+0x33a>
mov    -0x78(%rbp),%eax
sub    $0x74,%eax
je     1564 <my_catopenpath+0x3d4>
jmp    15b0 <my_catopenpath+0x420>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x25,(%rax)
jmp    15b5 <my_catopenpath+0x425>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x60(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x60(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    15b5 <my_catopenpath+0x425>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x5c(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x5c(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    15b5 <my_catopenpath+0x425>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x68(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    15b5 <my_catopenpath+0x425>
mov    -0x28(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x6c(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x6c(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    15b5 <my_catopenpath+0x425>
mov    -0x28(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x70(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x70(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    15b5 <my_catopenpath+0x425>
jmp    15b5 <my_catopenpath+0x425>
jmp    163d <my_catopenpath+0x4ad>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1621 <my_catopenpath+0x491>
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     15e9 <my_catopenpath+0x459>
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x3a,%eax
jne    1621 <my_catopenpath+0x491>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x60(%rbp),%edx
call   1060 <strncpy@plt>
mov    -0x60(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x3a,(%rax)
jmp    1638 <my_catopenpath+0x4a8>
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    163d <my_catopenpath+0x4ad>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1445 <my_catopenpath+0x2b5>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     16ec <my_catopenpath+0x55c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x3a,%esi
call   1080 <index@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     16a5 <my_catopenpath+0x515>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    16ad <my_catopenpath+0x51d>
movq   $0x0,-0x28(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x2930(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     16e7 <my_catopenpath+0x557>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
call   10a0 <catopen@plt>
mov    %eax,-0x18(%rbp)
jmp    16ec <my_catopenpath+0x55c>
jmp    165d <my_catopenpath+0x4cd>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_catopenpath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,0x30(%rsp)
call   1070 <strlen@plt>
mov    %eax,%r15d
lea    0xf91(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
lea    0xf83(%rip),%r14
cmove  %r14,%rbx
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x5f,%esi
call   1080 <index@plt>
xor    %r13d,%r13d
test   %rax,%rax
mov    %rbx,0x28(%rsp)
mov    %r12d,0x4(%rsp)
je     123b <my_catopenpath+0xab>
mov    %eax,%ebp
sub    %ebx,%ebp
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x2e,%esi
mov    %rax,%r12
call   1080 <index@plt>
test   %rax,%rax
mov    %r12,0x20(%rsp)
je     124f <my_catopenpath+0xbf>
mov    %eax,%ebx
sub    %r12d,%ebx
add    $0x1,%rax
mov    0x4(%rsp),%r12d
mov    %r12d,%r9d
sub    %ebp,%r9d
sub    %ebx,%r9d
add    $0xfffffffe,%r9d
mov    %rax,0x10(%rsp)
jmp    1263 <my_catopenpath+0xd3>
mov    %r14,0x10(%rsp)
mov    %r14,0x20(%rsp)
mov    %r12d,%r8d
xor    %ebx,%ebx
xor    %r9d,%r9d
jmp    1266 <my_catopenpath+0xd6>
mov    %r14,0x10(%rsp)
mov    %ebp,%ebx
not    %ebx
mov    0x4(%rsp),%r12d
add    %r12d,%ebx
xor    %r9d,%r9d
mov    %rbp,%r8
mov    0x8(%rsp),%rbp
lea    0xd8e(%rip),%rax
mov    %rbp,%rcx
jmp    1290 <my_catopenpath+0x100>
nopw   0x0(%rax,%rax,1)
test   %dl,%dl
je     1310 <my_catopenpath+0x180>
add    $0x1,%r13d
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x25,%dl
je     12c0 <my_catopenpath+0x130>
cmp    $0x3a,%dl
jne    1280 <my_catopenpath+0xf0>
cmp    %rbp,%rcx
je     12a8 <my_catopenpath+0x118>
cmpb   $0x3a,-0x1(%rcx)
jne    1288 <my_catopenpath+0xf8>
add    %r15d,%r13d
add    $0x1,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rcx),%edx
add    $0x1,%rcx
lea    -0x4c(%rdx),%esi
cmp    $0x28,%esi
ja     12e2 <my_catopenpath+0x152>
movslq (%rax,%rsi,4),%rdx
add    %rax,%rdx
jmp    *%rdx
add    %r12d,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
cmp    $0x25,%edx
je     1288 <my_catopenpath+0xf8>
jmp    12af <my_catopenpath+0x11f>
add    %r15d,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
add    %r9d,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
add    %r8d,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
add    %ebx,%r13d
add    $0x1,%rcx
jmp    1290 <my_catopenpath+0x100>
add    $0x1,%r13d
mov    %r8,0x18(%rsp)
mov    %r12d,%ebp
mov    %r13d,%edi
mov    %r9d,%r12d
call   1050 <my_malloc@plt>
mov    %rax,%r13
mov    %ebp,%eax
movslq %r15d,%r14
movslq %r12d,%rcx
mov    %rcx,0x50(%rsp)
movslq %ebx,%rcx
mov    %rcx,0x48(%rsp)
movslq 0x18(%rsp),%rcx
mov    %rcx,0x18(%rsp)
mov    0x8(%rsp),%r12
movslq %ebp,%rax
mov    %rax,0x40(%rsp)
lea    0xd47(%rip),%rbp
mov    %r12,%rbx
mov    %r13,0x38(%rsp)
jmp    1384 <my_catopenpath+0x1f4>
nopw   0x0(%rax,%rax,1)
test   %al,%al
je     148b <my_catopenpath+0x2fb>
mov    %al,0x0(%r13)
add    $0x1,%r13
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x25,%al
je     13c0 <my_catopenpath+0x230>
cmp    $0x3a,%al
jne    1370 <my_catopenpath+0x1e0>
cmp    %r12,%rbx
je     139a <my_catopenpath+0x20a>
cmpb   $0x3a,-0x1(%rbx)
jne    1378 <my_catopenpath+0x1e8>
mov    %r13,%rdi
mov    0x30(%rsp),%rsi
mov    %r15d,%edx
call   1060 <strncpy@plt>
movb   $0x3a,0x0(%r13,%r14,1)
add    %r14,%r13
add    $0x1,%r13
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
nopl   (%rax)
movsbl 0x1(%rbx),%eax
add    $0x1,%rbx
lea    -0x4c(%rax),%ecx
cmp    $0x28,%ecx
ja     13f6 <my_catopenpath+0x266>
movslq 0x0(%rbp,%rcx,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    %r13,%rdi
mov    0x28(%rsp),%rsi
mov    0x4(%rsp),%edx
call   1060 <strncpy@plt>
add    0x40(%rsp),%r13
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
cmp    $0x25,%eax
jne    13b7 <my_catopenpath+0x227>
movb   $0x25,0x0(%r13)
add    $0x1,%r13
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
mov    %r13,%rdi
mov    0x30(%rsp),%rsi
mov    %r15d,%edx
call   1060 <strncpy@plt>
add    %r14,%r13
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
mov    %r13,%rdi
mov    0x10(%rsp),%rsi
mov    %r15,%r12
mov    0x50(%rsp),%r15
mov    %r15d,%edx
call   1060 <strncpy@plt>
add    %r15,%r13
mov    %r12,%r15
mov    0x8(%rsp),%r12
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
mov    %r13,%rdi
mov    0x28(%rsp),%rsi
mov    0x18(%rsp),%rbp
jmp    1471 <my_catopenpath+0x2e1>
mov    %r13,%rdi
mov    0x20(%rsp),%rsi
mov    0x48(%rsp),%rbp
mov    %ebp,%edx
call   1060 <strncpy@plt>
add    %rbp,%r13
lea    0xc22(%rip),%rbp
add    $0x1,%rbx
jmp    1384 <my_catopenpath+0x1f4>
movb   $0x0,0x0(%r13)
mov    0x2b51(%rip),%r14
mov    0x38(%rsp),%r15
mov    %r15,%rbx
jmp    14ca <my_catopenpath+0x33a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbx
mov    (%r14),%esi
mov    %rbp,%rdi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
jne    14ef <my_catopenpath+0x35f>
test   %rbx,%rbx
je     14e8 <my_catopenpath+0x358>
mov    %rbx,%rbp
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1080 <index@plt>
test   %rax,%rax
jne    14b0 <my_catopenpath+0x320>
xor    %ebx,%ebx
jmp    14ba <my_catopenpath+0x32a>
mov    $0xffffffff,%ebx
jmp    1502 <my_catopenpath+0x372>
mov    %eax,%edi
call   1090 <close@plt>
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <catopen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <free@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"LANG\00"
@.str.1 = [1 x i8] zeroinitializer
@O_RDONLY = global i32 0
define i32 @my_catopenpath(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %4
%7 = tail call i32 @strlen(i8* %6)
%8 = tail call i8* @index(i8* %6, i8 signext 95)
%9 = icmp eq i8* %8, null
br i1 %9, label %30, label %10
10: ; preds = %2
%11 = ptrtoint i8* %8 to i64
%12 = ptrtoint i8* %6 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds i8, i8* %8, i64 1
%16 = tail call i8* @index(i8* %15, i8 signext 46)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = xor i32 %14, -1
%20 = add i32 %7, %19
br label %30
21: ; preds = %10
%22 = ptrtoint i8* %16 to i64
%23 = ptrtoint i8* %15 to i64
%24 = sub i64 %22, %23
%25 = trunc i64 %24 to i32
%26 = getelementptr inbounds i8, i8* %16, i64 1
%27 = add i32 %7, -2
%28 = add i32 %14, %25
%29 = sub i32 %27, %28
br label %30
30: ; preds = %2, %18, %21
%31 = phi i8* [ %15, %21 ], [ %15, %18 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %2 ]
%32 = phi i8* [ %26, %21 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %18 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %2 ]
%33 = phi i32 [ %14, %21 ], [ %14, %18 ], [ %7, %2 ]
%34 = phi i32 [ %25, %21 ], [ %20, %18 ], [ 0, %2 ]
%35 = phi i32 [ %29, %21 ], [ 0, %18 ], [ 0, %2 ]
br label %36
36: ; preds = %67, %30
%37 = phi i8* [ %1, %30 ], [ %70, %67 ]
%38 = phi i32 [ 0, %30 ], [ %69, %67 ]
%39 = load i8, i8* %37
switch i8 %39, label %65 [
i8 0, label %71
i8 37, label %40
i8 58, label %56
]
40: ; preds = %36
%41 = getelementptr inbounds i8, i8* %37, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
switch i32 %43, label %67 [
i32 37, label %44
i32 78, label %46
i32 76, label %48
i32 108, label %50
i32 116, label %52
i32 99, label %54
]
44: ; preds = %40
%45 = add nsw i32 %38, 1
br label %67
46: ; preds = %40
%47 = add nsw i32 %38, %3
br label %67
48: ; preds = %40
%49 = add nsw i32 %38, %7
br label %67
50: ; preds = %40
%51 = add nsw i32 %38, %33
br label %67
52: ; preds = %40
%53 = add nsw i32 %38, %34
br label %67
54: ; preds = %40
%55 = add nsw i32 %38, %35
br label %67
56: ; preds = %36
%57 = icmp eq i8* %37, %1
br i1 %57, label %62, label %58
58: ; preds = %56
%59 = getelementptr inbounds i8, i8* %37, i64 -1
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 58
br i1 %61, label %62, label %65
62: ; preds = %58, %56
%63 = add i32 %38, 1
%64 = add i32 %63, %3
br label %67
65: ; preds = %36, %58
%66 = add nsw i32 %38, 1
br label %67
67: ; preds = %62, %65, %44, %46, %48, %50, %52, %54, %40
%68 = phi i8* [ %41, %40 ], [ %41, %54 ], [ %41, %52 ], [ %41, %50 ], [ %41, %48 ], [ %41, %46 ], [ %41, %44 ], [ %37, %62 ], [ %37, %65 ]
%69 = phi i32 [ %38, %40 ], [ %55, %54 ], [ %53, %52 ], [ %51, %50 ], [ %49, %48 ], [ %47, %46 ], [ %45, %44 ], [ %64, %62 ], [ %66, %65 ]
%70 = getelementptr inbounds i8, i8* %68, i64 1
br label %36
71: ; preds = %36
%72 = add nsw i32 %38, 1
%73 = tail call i8* @my_malloc(i32 %72)
%74 = sext i32 %3 to i64
%75 = sext i32 %35 to i64
%76 = sext i32 %34 to i64
%77 = sext i32 %33 to i64
%78 = sext i32 %7 to i64
br label %79
79: ; preds = %116, %71
%80 = phi i8* [ %1, %71 ], [ %119, %116 ]
%81 = phi i8* [ %73, %71 ], [ %118, %116 ]
%82 = load i8, i8* %80
switch i8 %82, label %114 [
i8 0, label %120
i8 37, label %83
i8 58, label %104
]
83: ; preds = %79
%84 = getelementptr inbounds i8, i8* %80, i64 1
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
switch i32 %86, label %116 [
i32 37, label %87
i32 78, label %89
i32 76, label %92
i32 108, label %95
i32 116, label %98
i32 99, label %101
]
87: ; preds = %83
%88 = getelementptr inbounds i8, i8* %81, i64 1
store i8 37, i8* %81
br label %116
89: ; preds = %83
%90 = tail call i32 @strncpy(i8* %81, i8* %0, i32 %3)
%91 = getelementptr inbounds i8, i8* %81, i64 %74
br label %116
92: ; preds = %83
%93 = tail call i32 @strncpy(i8* %81, i8* %6, i32 %7)
%94 = getelementptr inbounds i8, i8* %81, i64 %78
br label %116
95: ; preds = %83
%96 = tail call i32 @strncpy(i8* %81, i8* %6, i32 %33)
%97 = getelementptr inbounds i8, i8* %81, i64 %77
br label %116
98: ; preds = %83
%99 = tail call i32 @strncpy(i8* %81, i8* %31, i32 %34)
%100 = getelementptr inbounds i8, i8* %81, i64 %76
br label %116
101: ; preds = %83
%102 = tail call i32 @strncpy(i8* %81, i8* %32, i32 %35)
%103 = getelementptr inbounds i8, i8* %81, i64 %75
br label %116
104: ; preds = %79
%105 = icmp eq i8* %80, %1
br i1 %105, label %110, label %106
106: ; preds = %104
%107 = getelementptr inbounds i8, i8* %80, i64 -1
%108 = load i8, i8* %107
%109 = icmp eq i8 %108, 58
br i1 %109, label %110, label %114
110: ; preds = %106, %104
%111 = tail call i32 @strncpy(i8* %81, i8* %0, i32 %3)
%112 = getelementptr inbounds i8, i8* %81, i64 %74
%113 = getelementptr inbounds i8, i8* %112, i64 1
store i8 58, i8* %112
br label %116
114: ; preds = %79, %106
%115 = getelementptr inbounds i8, i8* %81, i64 1
store i8 %82, i8* %81
br label %116
116: ; preds = %110, %114, %87, %89, %92, %95, %98, %101, %83
%117 = phi i8* [ %84, %83 ], [ %84, %101 ], [ %84, %98 ], [ %84, %95 ], [ %84, %92 ], [ %84, %89 ], [ %84, %87 ], [ %80, %110 ], [ %80, %114 ]
%118 = phi i8* [ %81, %83 ], [ %103, %101 ], [ %100, %98 ], [ %97, %95 ], [ %94, %92 ], [ %91, %89 ], [ %88, %87 ], [ %113, %110 ], [ %115, %114 ]
%119 = getelementptr inbounds i8, i8* %117, i64 1
br label %79
120: ; preds = %79
store i8 0, i8* %81
br label %121
121: ; preds = %129, %120
%122 = phi i8* [ %73, %120 ], [ %130, %129 ]
%123 = icmp eq i8* %122, null
br i1 %123, label %137, label %124
124: ; preds = %121
%125 = tail call i8* @index(i8* %122, i8 signext 58)
%126 = icmp eq i8* %125, null
br i1 %126, label %129, label %127
127: ; preds = %124
store i8 0, i8* %125
%128 = getelementptr inbounds i8, i8* %125, i64 1
br label %129
129: ; preds = %124, %127
%130 = phi i8* [ %128, %127 ], [ null, %124 ]
%131 = load i32, i32* @O_RDONLY
%132 = tail call i32 @open(i8* %122, i32 %131)
%133 = icmp eq i32 %132, -1
br i1 %133, label %121, label %134
134: ; preds = %129
%135 = tail call i32 @close(i32 %132)
%136 = tail call i32 @catopen(i8* %122, i32 0)
br label %137
137: ; preds = %121, %134
%138 = phi i32 [ %136, %134 ], [ -1, %121 ]
%139 = tail call i32 @free(i8* %73)
ret i32 %138
}