#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 INT_MIN;
void log_esc(int, char *);
int /*<<< orphan*/ log_sn(char *, int, int);
int /*<<< orphan*/ memcmp(char *, char *, int);
int /*<<< orphan*/ ts_9(char *);
void log_l(char *s, int n, int pfx) {
  if (!memcmp(s, "&CMD", 4))
    return log_esc(pfx, s + 4);
  char buf[12];
  ts_9(buf);
  buf[9] = pfx;
  buf[10] = 32;
  log_sn(buf, 11, INT_MIN);
  log_sn(s, n + 1, *s == '`' ? INT_MIN : 11);
}


x86 assembly (clang, -O0):
<log_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%eax
jne    1185 <log_l+0x45>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
call   1060 <log_esc@plt>
jmp    11fd <log_l+0xbd>
lea    -0x1c(%rbp),%rdi
call   1040 <ts_9@plt>
mov    -0x10(%rbp),%eax
mov    %al,-0x13(%rbp)
movb   $0x20,-0x12(%rbp)
lea    -0x1c(%rbp),%rdi
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%esi
call   1030 <log_sn@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x60,%eax
jne    11e1 <log_l+0xa1>
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
jmp    11ee <log_l+0xae>
mov    $0xb,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ee <log_l+0xae>
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
call   1030 <log_sn@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_l>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xea5(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %eax,%eax
je     11c4 <log_l+0x84>
lea    0x4(%rsp),%r15
mov    %r15,%rdi
call   1040 <ts_9@plt>
mov    %r14b,0xd(%rsp)
movb   $0x20,0xe(%rsp)
mov    0x2e61(%rip),%r12
mov    (%r12),%edx
mov    $0xb,%r14d
mov    %r15,%rdi
mov    $0xb,%esi
call   1030 <log_sn@plt>
add    $0x1,%ebp
cmpb   $0x60,(%rbx)
jne    11aa <log_l+0x6a>
mov    (%r12),%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <log_sn@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x4,%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <log_esc@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"&CMD\00"
@INT_MIN = global i32 0
define void @log_l(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [12 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 @memcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = load i32, i32* %6
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 4
br label %38
15: ; preds = %3
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%17 = call i32 @ts_9(i8* %16)
%18 = load i32, i32* %6
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 9
store i8 %19, i8* %20
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 10
store i8 32, i8* %21
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* @INT_MIN
%24 = call i32 @log_sn(i8* %22, i32 11, i32 %23)
%25 = load i8*, i8** %4
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 96
br i1 %31, label %32, label %34
32: ; preds = %15
%33 = load i32, i32* @INT_MIN
br label %35
34: ; preds = %15
br label %35
35: ; preds = %34, %32
%36 = phi i32 [ %33, %32 ], [ 11, %34 ]
%37 = call i32 @log_sn(i8* %25, i32 %27, i32 %36)
br label %38
38: ; preds = %35, %11
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"&CMD\00"
@INT_MIN = global i32 0
define void @log_l(i8* %0, i32 %1, i32 %2) {
%4 = alloca [12 x i8]
%5 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 4
tail call void @log_esc(i32 %2, i8* %8)
br label %23
9: ; preds = %3
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%11 = call i32 @ts_9(i8* %10)
%12 = trunc i32 %2 to i8
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 9
store i8 %12, i8* %13
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 10
store i8 32, i8* %14
%15 = load i32, i32* @INT_MIN
%16 = call i32 @log_sn(i8* %10, i32 11, i32 %15)
%17 = add nsw i32 %1, 1
%18 = load i8, i8* %0
%19 = icmp eq i8 %18, 96
%20 = load i32, i32* @INT_MIN
%21 = select i1 %19, i32 %20, i32 11
%22 = call i32 @log_sn(i8* %0, i32 %17, i32 %21)
br label %23
23: ; preds = %9, %7
ret void
}