#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*/ tmpstring;
typedef int /*<<< orphan*/ tmpstr;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ *strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int check_tty(char *string1, char *string2, int fromfile) {
  int i;
  static char tmpstring[256];
  static char tmpstr[256];
  int slen1 = strlen(string1);
  int slen2 = strlen(string2);
  strncpy(tmpstr, string2, slen2);
  if (fromfile) {
    if (!strcmp(string1, tmpstr))
      return 0;
    if (slen2 < slen1)
      if (!strchr(string1, '*'))
        return -1;
    strncpy(tmpstring, string2, slen2);
    for (i = 0; i < slen2; i++) {
      if (string1[i] == '*')
        if (!strncmp(string1, tmpstr, i)) {
          bzero(tmpstr, slen2);
          strncpy(tmpstr, string1, i);
          break;
        }
      if (string1[i] == '?') {
        if (!strncmp(string1, tmpstr, i)) {
          if (!(slen1 < i + 1))
            if (string1[i + 1] != '?' && string1[i + 1] != tmpstr[i + 1])
              continue;
          if (!(slen1 < slen2))
            tmpstr[i] = '?';
        }
      } else {
        if (strncmp(string1, tmpstr, i))
          strncpy(tmpstr, tmpstring, slen2);
      }
    }
    if (strchr(string1, '*'))
      *strchr(string1, '*') = 0;
    bzero(tmpstring, sizeof(tmpstring));
  }
  if (!strcmp(string1, tmpstr)) {
    bzero(tmpstr, sizeof(tmpstr));
    return 0;
  }
  bzero(tmpstr, sizeof(tmpstr));
  return -1;
}


x86 assembly (clang, -O0):
<check_tty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%edx
lea    0x2fc7(%rip),%rdi
call   1030 <strncpy@plt>
cmpl   $0x0,-0x1c(%rbp)
je     13c8 <check_tty+0x268>
mov    -0x10(%rbp),%rdi
lea    0x2fad(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    11cd <check_tty+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1416 <check_tty+0x2b6>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1202 <check_tty+0xa2>
mov    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
jne    11fd <check_tty+0x9d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1416 <check_tty+0x2b6>
jmp    1202 <check_tty+0xa2>
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%edx
lea    0x2e50(%rip),%rdi
call   1030 <strncpy@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    138a <check_tty+0x22a>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    1286 <check_tty+0x126>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0x2f15(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1281 <check_tty+0x121>
mov    -0x28(%rbp),%esi
lea    0x2efc(%rip),%rdi
call   1080 <bzero@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
lea    0x2ee9(%rip),%rdi
call   1030 <strncpy@plt>
jmp    138a <check_tty+0x22a>
jmp    1286 <check_tty+0x126>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3f,%eax
jne    133f <check_tty+0x1df>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0x2eb7(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    133a <check_tty+0x1da>
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jl     131a <check_tty+0x1ba>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3f,%eax
je     1315 <check_tty+0x1b5>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rdx
lea    0x2e5c(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1315 <check_tty+0x1b5>
jmp    137c <check_tty+0x21c>
jmp    131a <check_tty+0x1ba>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     1335 <check_tty+0x1d5>
movslq -0x20(%rbp),%rcx
lea    0x2e2f(%rip),%rax
movb   $0x3f,(%rax,%rcx,1)
jmp    133a <check_tty+0x1da>
jmp    1377 <check_tty+0x217>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0x2e13(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     1372 <check_tty+0x212>
mov    -0x28(%rbp),%edx
lea    0x2dfa(%rip),%rdi
lea    0x2cf3(%rip),%rsi
call   1030 <strncpy@plt>
jmp    1377 <check_tty+0x217>
jmp    137c <check_tty+0x21c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    121c <check_tty+0xbc>
mov    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     13b7 <check_tty+0x257>
mov    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
movq   $0x0,(%rax)
lea    0x2ca2(%rip),%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
mov    -0x10(%rbp),%rdi
lea    0x2d8d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13fe <check_tty+0x29e>
lea    0x2d78(%rip),%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
movl   $0x0,-0x4(%rbp)
jmp    1416 <check_tty+0x2b6>
lea    0x2d5b(%rip),%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_tty>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r13
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
lea    0x2fd3(%rip),%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
test   %r15d,%r15d
je     12e7 <check_tty+0x187>
lea    0x2fb9(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1283 <check_tty+0x123>
mov    %ebp,%r12d
cmp    %r14d,%r12d
jge    11d8 <check_tty+0x78>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     128a <check_tty+0x12a>
lea    0x2e81(%rip),%rdi
mov    %r13,%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
test   %r12d,%r12d
jle    12b0 <check_tty+0x150>
movslq %r14d,%rax
mov    %rax,(%rsp)
xor    %ebp,%ebp
jmp    1212 <check_tty+0xb2>
xchg   %ax,%ax
test   %rax,%rax
je     1260 <check_tty+0x100>
add    $0x1,%rbp
cmp    %rbp,%r12
je     12b0 <check_tty+0x150>
movzbl (%rbx,%rbp,1),%r13d
cmp    $0x2a,%r13b
jne    1234 <check_tty+0xd4>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1291 <check_tty+0x131>
movzbl (%rbx,%rbp,1),%r13d
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1040 <strncmp@plt>
cmp    $0x3f,%r13b
je     1200 <check_tty+0xa0>
test   %rax,%rax
je     1205 <check_tty+0xa5>
mov    %r15,%rdi
lea    0x2e0a(%rip),%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
jmp    1205 <check_tty+0xa5>
cmp    (%rsp),%rbp
jge    1276 <check_tty+0x116>
movzbl 0x1(%rbx,%rbp,1),%eax
cmp    $0x3f,%al
je     1276 <check_tty+0x116>
cmp    0x1(%rbp,%r15,1),%al
jne    1205 <check_tty+0xa5>
cmp    %r12d,%r14d
jl     1205 <check_tty+0xa5>
movb   $0x3f,0x0(%rbp,%r15,1)
jmp    1205 <check_tty+0xa5>
xor    %eax,%eax
jmp    130c <check_tty+0x1ac>
mov    $0xffffffff,%eax
jmp    130c <check_tty+0x1ac>
lea    0x2ec8(%rip),%r14
mov    %r14,%rdi
mov    %r12d,%esi
call   1080 <bzero@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12d6 <check_tty+0x176>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1060 <strchr@plt>
movq   $0x0,(%rax)
lea    0x2d83(%rip),%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
lea    0x2e72(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
neg    %ebx
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@check_tty.tmpstring = internal global [256 x i8] zeroinitializer
@check_tty.tmpstr = internal global [256 x i8] zeroinitializer
define i32 @check_tty(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @strncpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i8* %1, i32 %5)
%7 = icmp eq i32 %2, 0
br i1 %7, label %73, label %8
8: ; preds = %3
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %78, label %11
11: ; preds = %8
%12 = icmp slt i32 %5, %4
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = tail call i64* @strchr(i8* %0, i8 signext 42)
%15 = icmp eq i64* %14, null
br i1 %15, label %78, label %16
16: ; preds = %13, %11
%17 = tail call i32 @strncpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstring, i64 0, i64 0), i8* %1, i32 %5)
%18 = icmp sgt i32 %5, 0
br i1 %18, label %19, label %66
19: ; preds = %16
%20 = icmp slt i32 %4, %5
%21 = sext i32 %4 to i64
%22 = zext i32 %5 to i64
br label %23
23: ; preds = %19, %63
%24 = phi i64 [ 0, %19 ], [ %64, %63 ]
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 42
br i1 %27, label %28, label %38
28: ; preds = %23
%29 = trunc i64 %24 to i32
%30 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = trunc i64 %24 to i32
%34 = tail call i32 @bzero(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i32 %5)
%35 = tail call i32 @strncpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i8* %0, i32 %33)
br label %66
36: ; preds = %28
%37 = load i8, i8* %25
br label %38
38: ; preds = %36, %23
%39 = phi i8 [ %37, %36 ], [ %26, %23 ]
%40 = icmp eq i8 %39, 63
%41 = trunc i64 %24 to i32
%42 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i32 %41)
%43 = icmp eq i64 %42, 0
br i1 %40, label %44, label %60
44: ; preds = %38
br i1 %43, label %45, label %63
45: ; preds = %44
%46 = icmp slt i64 %24, %21
br i1 %46, label %47, label %57
47: ; preds = %45
%48 = add nuw nsw i64 %24, 1
%49 = getelementptr inbounds i8, i8* %0, i64 %48
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 63
br i1 %51, label %57, label %52
52: ; preds = %47
%53 = getelementptr inbounds [256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 %48
%54 = load i8, i8* %53
%55 = icmp ne i8 %50, %54
%56 = select i1 %55, i1 true, i1 %20
br i1 %56, label %63, label %58
57: ; preds = %47, %45
br i1 %20, label %63, label %58
58: ; preds = %52, %57
%59 = getelementptr inbounds [256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 %24
store i8 63, i8* %59
br label %63
60: ; preds = %38
br i1 %43, label %63, label %61
61: ; preds = %60
%62 = tail call i32 @strncpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstring, i64 0, i64 0), i32 %5)
br label %63
63: ; preds = %57, %58, %44, %61, %60, %52
%64 = add nuw nsw i64 %24, 1
%65 = icmp eq i64 %64, %22
br i1 %65, label %66, label %23
66: ; preds = %63, %16, %32
%67 = tail call i64* @strchr(i8* %0, i8 signext 42)
%68 = icmp eq i64* %67, null
br i1 %68, label %71, label %69
69: ; preds = %66
%70 = tail call i64* @strchr(i8* %0, i8 signext 42)
store i64 0, i64* %70
br label %71
71: ; preds = %69, %66
%72 = tail call i32 @bzero(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstring, i64 0, i64 0), i32 256)
br label %73
73: ; preds = %71, %3
%74 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0))
%75 = icmp ne i32 %74, 0
%76 = tail call i32 @bzero(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @check_tty.tmpstr, i64 0, i64 0), i32 256)
%77 = sext i1 %75 to i32
br label %78
78: ; preds = %73, %13, %8
%79 = phi i32 [ 0, %8 ], [ -1, %13 ], [ %77, %73 ]
ret i32 %79
}