#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 */
char *SLexpand_escaped_char(char *, char *);
void SLexpand_escaped_string(register char *s, register char *t,
                             register char *tmax) {
  char ch;
  while (t < tmax) {
    ch = *t++;
    if (ch == '\\') {
      t = SLexpand_escaped_char(t, &ch);
    }
    *s++ = ch;
  }
  *s = 0;
}


x86 assembly (clang, -O0):
<SLexpand_escaped_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117d <SLexpand_escaped_string+0x6d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x5c,%eax
jne    1164 <SLexpand_escaped_string+0x54>
mov    -0x10(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1030 <SLexpand_escaped_char@plt>
mov    %rax,-0x10(%rbp)
mov    -0x19(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1124 <SLexpand_escaped_string+0x14>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SLexpand_escaped_string>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
cmp    %rdx,%rsi
jae    115d <SLexpand_escaped_string+0x4d>
mov    %rdx,%r14
mov    %rsi,%rax
lea    0xf(%rsp),%r15
jmp    113b <SLexpand_escaped_string+0x2b>
xchg   %ax,%ax
mov    %cl,(%rbx)
add    $0x1,%rbx
cmp    %r14,%rax
jae    115d <SLexpand_escaped_string+0x4d>
movzbl (%rax),%ecx
add    $0x1,%rax
mov    %cl,0xf(%rsp)
cmp    $0x5c,%cl
jne    1130 <SLexpand_escaped_string+0x20>
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <SLexpand_escaped_char@plt>
movzbl 0xf(%rsp),%ecx
jmp    1130 <SLexpand_escaped_string+0x20>
movb   $0x0,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @SLexpand_escaped_string(i8* nocapture writeonly %0, i8* %1, i8* readnone %2) {
%4 = alloca i8
%5 = icmp ult i8* %1, %2
br i1 %5, label %6, label %20
6: ; preds = %3, %15
%7 = phi i8* [ %18, %15 ], [ %0, %3 ]
%8 = phi i8* [ %17, %15 ], [ %1, %3 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %4
%11 = icmp eq i8 %10, 92
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = call i8* @SLexpand_escaped_char(i8* %9, i8* %4)
%14 = load i8, i8* %4
br label %15
15: ; preds = %12, %6
%16 = phi i8 [ %14, %12 ], [ %10, %6 ]
%17 = phi i8* [ %13, %12 ], [ %9, %6 ]
%18 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %16, i8* %7
%19 = icmp ult i8* %17, %2
br i1 %19, label %6, label %20
20: ; preds = %15, %3
%21 = phi i8* [ %0, %3 ], [ %18, %15 ]
store i8 0, i8* %21
ret void
}