#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 */
struct winsize {
  int dummy;
};
struct termios {
  int dummy;
};
struct group {
  int gr_gid;
};

/* Variables and functions */
scalar_t__ ENOENT;
int /*<<< orphan*/ O_RDWR;
int PATH_MAX;
int S_IRUSR;
int S_IWGRP;
int S_IWUSR;
int /*<<< orphan*/ TCSAFLUSH;
int /*<<< orphan*/ TIOCSWINSZ;
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ chown(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
struct group *getgrnam(char *);
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, char *);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int openpty(int *amaster, int *aslave, char *name, struct termios *termp,
            struct winsize *winp) {
  char line[PATH_MAX];
  const char *cp1, *cp2;
  int master, slave;
  struct group *gr = getgrnam("tty");
  strcpy(line, "/dev/ptyXX");
  for (cp1 = "pqrstuvwxyzPQRST"; *cp1; cp1++) {
    line[8] = *cp1;
    for (cp2 = "0123456789abcdef"; *cp2; cp2++) {
      line[9] = *cp2;
      if ((master = open(line, O_RDWR, 0)) == -1) {
        if (errno == ENOENT)
          return (-1);
      } else {
        line[5] = 't';
        (void)chown(line, getuid(), gr ? gr->gr_gid : -1);
        (void)chmod(line, S_IRUSR | S_IWUSR | S_IWGRP);
        if ((slave = open(line, O_RDWR, 0)) != -1) {
          *amaster = master;
          *aslave = slave;
          if (name)
            strcpy(name, line);
          if (termp)
            (void)tcsetattr(slave, TCSAFLUSH, termp);
          if (winp)
            (void)ioctl(slave, TIOCSWINSZ, (char *)winp);
          return 0;
        }
        (void)close(master);
        line[5] = 'p';
      }
    }
  }
  errno = ENOENT;
  return (-1);
}


x86 assembly (clang, -O0):
<openpty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
lea    0xe1e(%rip),%rdi
call   1070 <getgrnam@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,-0x60(%rbp)
lea    0xe0e(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xe0d(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmpb   $0x0,(%rax)
je     13d7 <openpty+0x247>
mov    -0x70(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%cl
mov    %cl,0x8(%rax)
lea    0xdf9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmpb   $0x0,(%rax)
je     13c1 <openpty+0x231>
mov    -0x70(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    (%rax),%al
mov    %al,0x9(%rdi)
mov    0x2d94(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <open@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
jne    1293 <openpty+0x103>
mov    0x2d48(%rip),%rax
mov    (%rax),%rax
mov    0x2d26(%rip),%rcx
cmp    (%rcx),%rax
jne    128e <openpty+0xfe>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    13f9 <openpty+0x269>
jmp    13ab <openpty+0x21b>
mov    -0x70(%rbp),%rax
movb   $0x74,0x5(%rax)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,-0x74(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     12be <openpty+0x12e>
mov    -0x60(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
jmp    12cb <openpty+0x13b>
mov    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
jmp    12cb <openpty+0x13b>
mov    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
mov    -0x78(%rbp),%edx
call   1080 <chown@plt>
mov    -0x70(%rbp),%rdi
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
mov    0x2cda(%rip),%rax
or     (%rax),%esi
mov    0x2cd9(%rip),%rax
or     (%rax),%esi
call   1090 <chmod@plt>
mov    -0x70(%rbp),%rdi
mov    0x2cd7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <open@plt>
mov    %eax,-0x58(%rbp)
cmp    $0xffffffff,%eax
je     139b <openpty+0x20b>
mov    -0x54(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1348 <openpty+0x1b8>
mov    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdi
call   1030 <strcpy@plt>
cmpq   $0x0,-0x28(%rbp)
je     1368 <openpty+0x1d8>
mov    -0x58(%rbp),%edi
mov    0x2c7b(%rip),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
call   10a0 <tcsetattr@plt>
cmpq   $0x0,-0x30(%rbp)
je     1388 <openpty+0x1f8>
mov    -0x58(%rbp),%edi
mov    0x2c43(%rip),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rdx
call   1050 <ioctl@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    13f9 <openpty+0x269>
mov    -0x54(%rbp),%edi
call   1060 <close@plt>
mov    -0x70(%rbp),%rax
movb   $0x70,0x5(%rax)
jmp    13b0 <openpty+0x220>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    122b <openpty+0x9b>
jmp    13c6 <openpty+0x236>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1206 <openpty+0x76>
mov    0x2bba(%rip),%rax
mov    (%rax),%rcx
mov    0x2bc8(%rip),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openpty>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdi,-0x30(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe2a(%rip),%rdi
call   1070 <getgrnam@plt>
mov    %rax,%r15
lea    0xe1f(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
lea    0xe1b(%rip),%rcx
mov    $0x70,%al
mov    0x2de3(%rip),%r13
mov    %r15,-0x60(%rbp)
mov    %rcx,-0x58(%rbp)
mov    %al,0x8(%r12)
mov    $0x30,%al
xor    %ebx,%ebx
jmp    1244 <openpty+0xb4>
mov    0x2d99(%rip),%rax
mov    (%rax),%rax
mov    0x2d77(%rip),%rcx
cmp    (%rcx),%rax
je     131f <openpty+0x18f>
lea    0xdef(%rip),%rax
movzbl 0x1(%rbx,%rax,1),%eax
add    $0x1,%rbx
cmp    $0x10,%rbx
je     12f0 <openpty+0x160>
mov    %al,0x9(%r12)
mov    0x0(%r13),%esi
mov    %r12,%rdi
xor    %edx,%edx
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     1210 <openpty+0x80>
mov    %eax,%r14d
movb   $0x74,0x5(%r12)
xor    %eax,%eax
call   1040 <getuid@plt>
test   %r15,%r15
je     1280 <openpty+0xf0>
mov    (%r15),%edx
jmp    1285 <openpty+0xf5>
cs nopw 0x0(%rax,%rax,1)
mov    $0xffffffff,%edx
mov    %r12,%rdi
mov    %eax,%esi
call   1080 <chown@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
mov    0x2d09(%rip),%rax
or     (%rax),%esi
mov    0x2d28(%rip),%rax
or     (%rax),%esi
mov    %r12,%rdi
call   1090 <chmod@plt>
mov    %r13,%r15
mov    0x0(%r13),%esi
mov    %r12,%rdi
xor    %edx,%edx
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
jne    1326 <openpty+0x196>
mov    %r14d,%edi
call   1060 <close@plt>
movb   $0x70,0x5(%r12)
mov    %r15,%r13
mov    -0x60(%rbp),%r15
jmp    122a <openpty+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x58(%rbp),%rcx
mov    0x1(%rcx),%al
add    $0x1,%rcx
lea    0xd1d(%rip),%rdx
cmp    %rdx,%rcx
jne    1201 <openpty+0x71>
mov    0x2c86(%rip),%rax
mov    (%rax),%rax
mov    0x2c94(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffff,%ebx
jmp    137e <openpty+0x1ee>
mov    %eax,%r13d
mov    -0x30(%rbp),%rax
mov    %r14d,(%rax)
mov    -0x38(%rbp),%rax
mov    %r13d,(%rax)
mov    -0x40(%rbp),%rdi
test   %rdi,%rdi
je     1348 <openpty+0x1b8>
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    -0x48(%rbp),%rdx
test   %rdx,%rdx
je     1362 <openpty+0x1d2>
mov    0x2c80(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
call   10a0 <tcsetattr@plt>
xor    %ebx,%ebx
mov    -0x50(%rbp),%rdx
test   %rdx,%rdx
je     137e <openpty+0x1ee>
mov    0x2c4c(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
call   1050 <ioctl@plt>
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
%struct.winsize = type { i32 }
%struct.group = type { i32 }
@PATH_MAX = global i32 0
@.str = [4 x i8] c"tty\00"
@.str.1 = [11 x i8] c"/dev/ptyXX\00"
@.str.2 = [17 x i8] c"pqrstuvwxyzPQRST\00"
@.str.3 = [17 x i8] c"0123456789abcdef\00"
@O_RDWR = global i32 0
@errno = global i64 0
@ENOENT = global i64 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IWGRP = global i32 0
@TCSAFLUSH = global i32 0
@TIOCSWINSZ = global i32 0
define i32 @openpty(i32* %0, i32* %1, i8* %2, %struct.termios* %3, %struct.winsize* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca %struct.termios*
%11 = alloca %struct.winsize*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.group*
%19 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i8* %2, i8** %9
store %struct.termios* %3, %struct.termios** %10
store %struct.winsize* %4, %struct.winsize** %11
%20 = load i32, i32* @PATH_MAX
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %12
%23 = alloca i8, i64 %21
store i64 %21, i64* %13
%24 = call %struct.group* @getgrnam(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store %struct.group* %24, %struct.group** %18
%25 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %14
br label %26
26: ; preds = %110, %5
%27 = load i8*, i8** %14
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %113
30: ; preds = %26
%31 = load i8*, i8** %14
%32 = load i8, i8* %31
%33 = getelementptr inbounds i8, i8* %23, i64 8
store i8 %32, i8* %33
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %15
br label %34
34: ; preds = %106, %30
%35 = load i8*, i8** %15
%36 = load i8, i8* %35
%37 = icmp ne i8 %36, 0
br i1 %37, label %38, label %109
38: ; preds = %34
%39 = load i8*, i8** %15
%40 = load i8, i8* %39
%41 = getelementptr inbounds i8, i8* %23, i64 9
store i8 %40, i8* %41
%42 = load i32, i32* @O_RDWR
%43 = call i32 @open(i8* %23, i32 %42, i32 0)
store i32 %43, i32* %16
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load i64, i64* @errno
%47 = load i64, i64* @ENOENT
%48 = icmp eq i64 %46, %47
br i1 %48, label %49, label %50
49: ; preds = %45
store i32 -1, i32* %6
store i32 1, i32* %19
br label %115
50: ; preds = %45
br label %105
51: ; preds = %38
%52 = getelementptr inbounds i8, i8* %23, i64 5
store i8 116, i8* %52
%53 = call i32 (...) @getuid()
%54 = load %struct.group*, %struct.group** %18
%55 = icmp ne %struct.group* %54, null
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = load %struct.group*, %struct.group** %18
%58 = getelementptr inbounds %struct.group, %struct.group* %57, i32 0, i32 0
%59 = load i32, i32* %58
br label %61
60: ; preds = %51
br label %61
61: ; preds = %60, %56
%62 = phi i32 [ %59, %56 ], [ -1, %60 ]
%63 = call i32 @chown(i8* %23, i32 %53, i32 %62)
%64 = load i32, i32* @S_IRUSR
%65 = load i32, i32* @S_IWUSR
%66 = or i32 %64, %65
%67 = load i32, i32* @S_IWGRP
%68 = or i32 %66, %67
%69 = call i32 @chmod(i8* %23, i32 %68)
%70 = load i32, i32* @O_RDWR
%71 = call i32 @open(i8* %23, i32 %70, i32 0)
store i32 %71, i32* %17
%72 = icmp ne i32 %71, -1
br i1 %72, label %73, label %101
73: ; preds = %61
%74 = load i32, i32* %16
%75 = load i32*, i32** %7
store i32 %74, i32* %75
%76 = load i32, i32* %17
%77 = load i32*, i32** %8
store i32 %76, i32* %77
%78 = load i8*, i8** %9
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %83
80: ; preds = %73
%81 = load i8*, i8** %9
%82 = call i32 @strcpy(i8* %81, i8* %23)
br label %83
83: ; preds = %80, %73
%84 = load %struct.termios*, %struct.termios** %10
%85 = icmp ne %struct.termios* %84, null
br i1 %85, label %86, label %91
86: ; preds = %83
%87 = load i32, i32* %17
%88 = load i32, i32* @TCSAFLUSH
%89 = load %struct.termios*, %struct.termios** %10
%90 = call i32 @tcsetattr(i32 %87, i32 %88, %struct.termios* %89)
br label %91
91: ; preds = %86, %83
%92 = load %struct.winsize*, %struct.winsize** %11
%93 = icmp ne %struct.winsize* %92, null
br i1 %93, label %94, label %100
94: ; preds = %91
%95 = load i32, i32* %17
%96 = load i32, i32* @TIOCSWINSZ
%97 = load %struct.winsize*, %struct.winsize** %11
%98 = bitcast %struct.winsize* %97 to i8*
%99 = call i32 @ioctl(i32 %95, i32 %96, i8* %98)
br label %100
100: ; preds = %94, %91
store i32 0, i32* %6
store i32 1, i32* %19
br label %115
101: ; preds = %61
%102 = load i32, i32* %16
%103 = call i32 @close(i32 %102)
%104 = getelementptr inbounds i8, i8* %23, i64 5
store i8 112, i8* %104
br label %105
105: ; preds = %101, %50
br label %106
106: ; preds = %105
%107 = load i8*, i8** %15
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %15
br label %34
109: ; preds = %34
br label %110
110: ; preds = %109
%111 = load i8*, i8** %14
%112 = getelementptr inbounds i8, i8* %111, i32 1
store i8* %112, i8** %14
br label %26
113: ; preds = %26
%114 = load i64, i64* @ENOENT
store i64 %114, i64* @errno
store i32 -1, i32* %6
store i32 1, i32* %19
br label %115
115: ; preds = %113, %100, %49
%116 = load i8*, i8** %12
%117 = load i32, i32* %6
ret i32 %117
}

LLVM IR (-O2):
%struct.termios = type { i32 }
%struct.winsize = type { i32 }
%struct.group = type { i32 }
@PATH_MAX = global i32 0
@.str = [4 x i8] c"tty\00"
@.str.1 = [11 x i8] c"/dev/ptyXX\00"
@.str.2 = [17 x i8] c"pqrstuvwxyzPQRST\00"
@.str.3 = [17 x i8] c"0123456789abcdef\00"
@O_RDWR = global i32 0
@errno = global i64 0
@ENOENT = global i64 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IWGRP = global i32 0
@TCSAFLUSH = global i32 0
@TIOCSWINSZ = global i32 0
define i32 @openpty(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i8* %2, %struct.termios* %3, %struct.winsize* %4) {
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = tail call %struct.group* @getgrnam(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds i8, i8* %8, i64 8
%12 = getelementptr inbounds i8, i8* %8, i64 9
%13 = getelementptr inbounds i8, i8* %8, i64 5
%14 = icmp eq %struct.group* %9, null
%15 = getelementptr inbounds %struct.group, %struct.group* %9, i64 0, i32 0
br label %16
16: ; preds = %5, %66
%17 = phi i8 [ 112, %5 ], [ %68, %66 ]
%18 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %5 ], [ %67, %66 ]
store i8 %17, i8* %11
br label %19
19: ; preds = %16, %62
%20 = phi i8 [ 48, %16 ], [ %64, %62 ]
%21 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %16 ], [ %63, %62 ]
store i8 %20, i8* %12
%22 = load i32, i32* @O_RDWR
%23 = call i32 @open(i8* %8, i32 %22, i32 0)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i64, i64* @errno
%27 = load i64, i64* @ENOENT
%28 = icmp eq i64 %26, %27
br i1 %28, label %72, label %62
29: ; preds = %19
store i8 116, i8* %13
%30 = call i32 (...) @getuid()
br i1 %14, label %33, label %31
31: ; preds = %29
%32 = load i32, i32* %15
br label %33
33: ; preds = %29, %31
%34 = phi i32 [ %32, %31 ], [ -1, %29 ]
%35 = call i32 @chown(i8* %8, i32 %30, i32 %34)
%36 = load i32, i32* @S_IRUSR
%37 = load i32, i32* @S_IWUSR
%38 = or i32 %37, %36
%39 = load i32, i32* @S_IWGRP
%40 = or i32 %38, %39
%41 = call i32 @chmod(i8* %8, i32 %40)
%42 = load i32, i32* @O_RDWR
%43 = call i32 @open(i8* %8, i32 %42, i32 0)
%44 = icmp eq i32 %43, -1
br i1 %44, label %60, label %45
45: ; preds = %33
store i32 %23, i32* %0
store i32 %43, i32* %1
%46 = icmp eq i8* %2, null
br i1 %46, label %49, label %47
47: ; preds = %45
%48 = call i32 @strcpy(i8* %2, i8* %8)
br label %49
49: ; preds = %47, %45
%50 = icmp eq %struct.termios* %3, null
br i1 %50, label %54, label %51
51: ; preds = %49
%52 = load i32, i32* @TCSAFLUSH
%53 = call i32 @tcsetattr(i32 %43, i32 %52, %struct.termios* %3)
br label %54
54: ; preds = %51, %49
%55 = icmp eq %struct.winsize* %4, null
br i1 %55, label %72, label %56
56: ; preds = %54
%57 = load i32, i32* @TIOCSWINSZ
%58 = bitcast %struct.winsize* %4 to i8*
%59 = call i32 @ioctl(i32 %43, i32 %57, i8* %58)
br label %72
60: ; preds = %33
%61 = call i32 @close(i32 %23)
store i8 112, i8* %13
br label %62
62: ; preds = %60, %25
%63 = getelementptr inbounds i8, i8* %21, i64 1
%64 = load i8, i8* %63
%65 = icmp eq i8* %63, getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 16)
br i1 %65, label %66, label %19
66: ; preds = %62
%67 = getelementptr inbounds i8, i8* %18, i64 1
%68 = load i8, i8* %67
%69 = icmp eq i8* %67, getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 16)
br i1 %69, label %70, label %16
70: ; preds = %66
%71 = load i64, i64* @ENOENT
store i64 %71, i64* @errno
br label %72
72: ; preds = %25, %54, %56, %70
%73 = phi i32 [ -1, %70 ], [ 0, %56 ], [ 0, %54 ], [ -1, %25 ]
ret i32 %73
}