#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*/ track_esccode(char **, int *);
void track_all_esccodes(char **s, char **p, int *ansi_state) {
  p = s;
  while (**p) {
    if (**p == '\033') {
      track_esccode(&(*p), &(*ansi_state));
    } else {
      ++(*p);
    }
  }
}


x86 assembly (clang, -O0):
<track_all_esccodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     1174 <track_all_esccodes+0x64>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x1b,%eax
jne    1161 <track_all_esccodes+0x51>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <track_esccode@plt>
jmp    116f <track_all_esccodes+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    112c <track_all_esccodes+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<track_all_esccodes>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
jmp    112b <track_all_esccodes+0x1b>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <track_esccode@plt>
mov    (%rbx),%rax
movzbl (%rax),%ecx
cmp    $0x1b,%cl
je     1120 <track_all_esccodes+0x10>
test   %cl,%cl
je     1143 <track_all_esccodes+0x33>
add    $0x1,%rax
mov    %rax,(%rbx)
jmp    112b <track_all_esccodes+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @track_all_esccodes(i8** %0, i8** %1, i32* %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i32*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%7 = load i8**, i8*** %4
store i8** %7, i8*** %5
br label %8
8: ; preds = %27, %3
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 27
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = load i32*, i32** %6
%22 = call i32 @track_esccode(i8** %20, i32* %21)
br label %27
23: ; preds = %13
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %24
br label %27
27: ; preds = %23, %19
br label %8
28: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @track_all_esccodes(i8** %0, i8** nocapture readnone %1, i32* %2) {
br label %4
4: ; preds = %11, %3
%5 = load i8*, i8** %0
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 27, label %7
]
7: ; preds = %4
%8 = tail call i32 @track_esccode(i8** %0, i32* %2)
br label %11
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %10, i8** %0
br label %11
11: ; preds = %9, %7
br label %4
12: ; preds = %4
ret void
}