#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 /*<<< orphan*/ isalpha(char);
char *StripHighlightAndTitle(char *s) {
  static char retbuf[512];
  char *p = retbuf;
  while (*s != '\000') {
    while (*s == '\033') {
      while (*s != '\000' && !isalpha(*s))
        s++;
      if (*s != '\000')
        s++;
    }
    while (*s != '\000' && *s != '\033') {
      if (*s == '(' || *s == '[') {
        *p = '\000';
        return retbuf;
      }
      *p++ = *s++;
    }
  }
  *p = '\000';
  return retbuf;
}


x86 assembly (clang, -O0):
<StripHighlightAndTitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     125c <StripHighlightAndTitle+0x14c>
jmp    113c <StripHighlightAndTitle+0x2c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1b,%eax
jne    11bf <StripHighlightAndTitle+0xaf>
jmp    1151 <StripHighlightAndTitle+0x41>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     117d <StripHighlightAndTitle+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    118d <StripHighlightAndTitle+0x7d>
jmp    119e <StripHighlightAndTitle+0x8e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1151 <StripHighlightAndTitle+0x41>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ba <StripHighlightAndTitle+0xaa>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <StripHighlightAndTitle+0x2c>
jmp    11c4 <StripHighlightAndTitle+0xb4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     11e9 <StripHighlightAndTitle+0xd9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1b,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    11f9 <StripHighlightAndTitle+0xe9>
jmp    1257 <StripHighlightAndTitle+0x147>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
je     1219 <StripHighlightAndTitle+0x109>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    1230 <StripHighlightAndTitle+0x120>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e19(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126e <StripHighlightAndTitle+0x15e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    11c4 <StripHighlightAndTitle+0xb4>
jmp    1127 <StripHighlightAndTitle+0x17>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2dd6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StripHighlightAndTitle>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     118a <StripHighlightAndTitle+0x7a>
mov    %rdi,%rbx
lea    0x2f1c(%rip),%r14
cmp    $0x1b,%al
jne    116f <StripHighlightAndTitle+0x5f>
mov    $0x1b,%cl
jmp    1142 <StripHighlightAndTitle+0x32>
nopl   0x0(%rax)
movzbl (%rbx),%eax
cmp    $0x1,%al
sbb    $0xffffffffffffffff,%rbx
movzbl (%rbx),%eax
mov    $0x1b,%cl
cmp    $0x1b,%al
jne    116f <StripHighlightAndTitle+0x5f>
movsbl %cl,%edi
call   1030 <isalpha@plt>
test   %eax,%eax
jne    1130 <StripHighlightAndTitle+0x20>
movzbl 0x1(%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1142 <StripHighlightAndTitle+0x32>
xor    %eax,%eax
jmp    1133 <StripHighlightAndTitle+0x23>
xchg   %ax,%ax
mov    %al,(%r14)
add    $0x1,%r14
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    $0x27,%al
jg     1180 <StripHighlightAndTitle+0x70>
test   %al,%al
je     1191 <StripHighlightAndTitle+0x81>
cmp    $0x1b,%al
jne    1160 <StripHighlightAndTitle+0x50>
jmp    1124 <StripHighlightAndTitle+0x14>
nopl   (%rax)
cmp    $0x28,%al
je     1191 <StripHighlightAndTitle+0x81>
cmp    $0x5b,%al
jne    1160 <StripHighlightAndTitle+0x50>
jmp    1191 <StripHighlightAndTitle+0x81>
lea    0x2eaf(%rip),%r14
movb   $0x0,(%r14)
lea    0x2ea4(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@StripHighlightAndTitle.retbuf = internal global [512 x i8] zeroinitializer
define i8* @StripHighlightAndTitle(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0), i8** %4
br label %5
5: ; preds = %73, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %74
10: ; preds = %5
br label %11
11: ; preds = %41, %10
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 27
br i1 %15, label %16, label %42
16: ; preds = %11
br label %17
17: ; preds = %30, %16
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = call i32 @isalpha(i8 signext %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br label %28
28: ; preds = %22, %17
%29 = phi i1 [ false, %17 ], [ %27, %22 ]
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %17
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %3
br label %41
41: ; preds = %38, %33
br label %11
42: ; preds = %11
br label %43
43: ; preds = %67, %42
%44 = load i8*, i8** %3
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %43
%49 = load i8*, i8** %3
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 27
br label %53
53: ; preds = %48, %43
%54 = phi i1 [ false, %43 ], [ %52, %48 ]
br i1 %54, label %55, label %73
55: ; preds = %53
%56 = load i8*, i8** %3
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 40
br i1 %59, label %65, label %60
60: ; preds = %55
%61 = load i8*, i8** %3
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 91
br i1 %64, label %65, label %67
65: ; preds = %60, %55
%66 = load i8*, i8** %4
store i8 0, i8* %66
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0), i8** %2
br label %76
67: ; preds = %60
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %3
%70 = load i8, i8* %68
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i32 1
store i8* %72, i8** %4
store i8 %70, i8* %71
br label %43
73: ; preds = %53
br label %5
74: ; preds = %5
%75 = load i8*, i8** %4
store i8 0, i8* %75
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0), i8** %2
br label %76
76: ; preds = %74, %65
%77 = load i8*, i8** %2
ret i8* %77
}

LLVM IR (-O2):
@StripHighlightAndTitle.retbuf = internal global [512 x i8] zeroinitializer
define i8* @StripHighlightAndTitle(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %42, label %4
4: ; preds = %34, %1
%5 = phi i8 [ %2, %1 ], [ %35, %34 ]
%6 = phi i8* [ getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0), %1 ], [ %37, %34 ]
%7 = phi i8* [ %0, %1 ], [ %36, %34 ]
%8 = icmp eq i8 %5, 27
br i1 %8, label %9, label %31
9: ; preds = %4, %20
%10 = phi i8 [ %21, %20 ], [ 27, %4 ]
%11 = phi i8* [ %22, %20 ], [ %7, %4 ]
%12 = tail call i32 @isalpha(i8 signext %10)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = load i8, i8* %11
br label %23
16: ; preds = %9
%17 = getelementptr inbounds i8, i8* %11, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %16, %23
%21 = phi i8 [ %18, %16 ], [ 27, %23 ]
%22 = phi i8* [ %17, %16 ], [ %28, %23 ]
br label %9
23: ; preds = %16, %14
%24 = phi i8 [ %15, %14 ], [ 0, %16 ]
%25 = phi i8* [ %11, %14 ], [ %17, %16 ]
%26 = icmp ne i8 %24, 0
%27 = zext i1 %26 to i64
%28 = getelementptr i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 27
br i1 %30, label %20, label %31
31: ; preds = %23, %4
%32 = phi i8 [ %5, %4 ], [ %29, %23 ]
%33 = phi i8* [ %7, %4 ], [ %28, %23 ]
br label %34
34: ; preds = %31, %38
%35 = phi i8 [ %41, %38 ], [ %32, %31 ]
%36 = phi i8* [ %39, %38 ], [ %33, %31 ]
%37 = phi i8* [ %40, %38 ], [ %6, %31 ]
switch i8 %35, label %38 [
i8 91, label %42
i8 40, label %42
i8 0, label %42
i8 27, label %4
]
38: ; preds = %34
%39 = getelementptr inbounds i8, i8* %36, i64 1
%40 = getelementptr inbounds i8, i8* %37, i64 1
store i8 %35, i8* %37
%41 = load i8, i8* %39
br label %34
42: ; preds = %34, %34, %34, %1
%43 = phi i8* [ getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0), %1 ], [ %37, %34 ], [ %37, %34 ], [ %37, %34 ]
store i8 0, i8* %43
ret i8* getelementptr inbounds ([512 x i8], [512 x i8]* @StripHighlightAndTitle.retbuf, i64 0, i64 0)
}