#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*/ fprintf(int /*<<< orphan*/, char *, char *, int, char);
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ stderr;
void fix_escaping(char *token, int l) {
  int i;
  bool shift;
  i = 0;
  while (i < l) {
    if (token[i] == '\\') {
      shift = true;
      switch (token[i + 1]) {
      case '\\':
        token[i] = '\\';
        break;
      case '\'':
        token[i] = '\'';
        break;
      case '\"':
        token[i] = '\"';
        break;
      case 't':
        token[i] = '\t';
        break;
      case 'r':
        token[i] = '\r';
        break;
      case 'n':
        token[i] = '\n';
        break;
      case 'f':
        token[i] = '\f';
        break;
      default:
        shift = false;
        fprintf(stderr,
                "%s:%d - WARNING: invalid escape "
                "sequence found \'\\%c\'\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/RecipeML/Recipe/refs/heads/"
                "master/src/grammar.c",
                361, token[i + 1]);
        break;
      }
      if (shift) {
        memmove(token + i + 1, token + i + 2, (l - (i + 2) + 1));
        token[l--] = '\0';
      }
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<fix_escaping>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12f7 <fix_escaping+0x1d7>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    12e9 <fix_escaping+0x1c9>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rax
movsbl 0x1(%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
sub    $0x22,%eax
je     1204 <fix_escaping+0xe4>
jmp    117c <fix_escaping+0x5c>
mov    -0x18(%rbp),%eax
sub    $0x27,%eax
je     11f3 <fix_escaping+0xd3>
jmp    118d <fix_escaping+0x6d>
mov    -0x18(%rbp),%eax
sub    $0x5c,%eax
je     11e2 <fix_escaping+0xc2>
jmp    119e <fix_escaping+0x7e>
mov    -0x18(%rbp),%eax
sub    $0x66,%eax
je     1248 <fix_escaping+0x128>
jmp    11af <fix_escaping+0x8f>
mov    -0x18(%rbp),%eax
sub    $0x6e,%eax
je     1237 <fix_escaping+0x117>
jmp    11c0 <fix_escaping+0xa0>
mov    -0x18(%rbp),%eax
sub    $0x72,%eax
je     1226 <fix_escaping+0x106>
jmp    11d1 <fix_escaping+0xb1>
mov    -0x18(%rbp),%eax
sub    $0x74,%eax
je     1215 <fix_escaping+0xf5>
jmp    1259 <fix_escaping+0x139>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x27,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x22,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x9,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0xd,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0xc,(%rax,%rcx,1)
jmp    1293 <fix_escaping+0x173>
movl   $0x0,-0x14(%rbp)
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%r8
lea    0xd83(%rip),%rsi
lea    0xdb2(%rip),%rdx
mov    $0x169,%ecx
movsbl (%rax,%r8,1),%r8d
call   1030 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
je     12e4 <fix_escaping+0x1c4>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
add    %rax,%rsi
add    $0x2,%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%eax
add    $0x2,%eax
sub    %eax,%edx
add    $0x1,%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    12e9 <fix_escaping+0x1c9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <fix_escaping+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_escaping>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11f7 <fix_escaping+0xd7>
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x1(%rdi),%r13
lea    0x2(%rdi),%rbp
mov    $0xffffffff,%r15d
xor    %r12d,%r12d
jmp    117b <fix_escaping+0x5b>
mov    $0xc,%al
nopl   (%rax)
mov    %al,(%r14,%rsi,1)
lea    (%rsi,%r13,1),%rdi
add    %rbp,%rsi
lea    (%rbx,%r15,1),%edx
call   1040 <memmove@plt>
movslq %ebx,%rax
add    $0xffffffff,%ebx
movb   $0x0,(%r14,%rax,1)
movslq %ebx,%rax
add    $0xffffffff,%r15d
cmp    %rax,%r12
jge    11f7 <fix_escaping+0xd7>
mov    %r12,%rsi
add    $0x1,%r12
cmpb   $0x5c,-0x1(%r13,%rsi,1)
jne    116f <fix_escaping+0x4f>
movsbl 0x0(%r13,%rsi,1),%r8d
lea    -0x5c(%r8),%ecx
cmp    $0x18,%ecx
ja     11af <fix_escaping+0x8f>
mov    $0x5c,%al
lea    0xe5e(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xa,%al
jmp    1150 <fix_escaping+0x30>
cmp    $0x22,%r8d
je     11f0 <fix_escaping+0xd0>
cmp    $0x27,%r8d
jne    11bf <fix_escaping+0x9f>
mov    $0x27,%al
jmp    1150 <fix_escaping+0x30>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe95(%rip),%rsi
lea    0xec4(%rip),%rdx
mov    $0x169,%ecx
call   1030 <fprintf@plt>
jmp    116f <fix_escaping+0x4f>
mov    $0xd,%al
jmp    1150 <fix_escaping+0x30>
mov    $0x9,%al
jmp    1150 <fix_escaping+0x30>
mov    $0x22,%al
jmp    1150 <fix_escaping+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"%s:%d - WARNING: invalid escape sequence found '\\%c'\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RecipeML/Recipe/refs/heads/master/src/grammar.c\00"
define void @fix_escaping(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %97, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %100
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 92
br i1 %18, label %19, label %97
19: ; preds = %11
store i32 1, i32* %6
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
switch i32 %26, label %62 [
i32 92, label %27
i32 39, label %32
i32 34, label %37
i32 116, label %42
i32 114, label %47
i32 110, label %52
i32 102, label %57
]
27: ; preds = %19
%28 = load i8*, i8** %3
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 92, i8* %31
br label %71
32: ; preds = %19
%33 = load i8*, i8** %3
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 39, i8* %36
br label %71
37: ; preds = %19
%38 = load i8*, i8** %3
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 34, i8* %41
br label %71
42: ; preds = %19
%43 = load i8*, i8** %3
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
store i8 9, i8* %46
br label %71
47: ; preds = %19
%48 = load i8*, i8** %3
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 13, i8* %51
br label %71
52: ; preds = %19
%53 = load i8*, i8** %3
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 10, i8* %56
br label %71
57: ; preds = %19
%58 = load i8*, i8** %3
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8 12, i8* %61
br label %71
62: ; preds = %19
store i32 0, i32* %6
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %3
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %64, i64 %67
%69 = load i8, i8* %68
%70 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 361, i8 signext %69)
br label %71
71: ; preds = %62, %57, %52, %47, %42, %37, %32, %27
%72 = load i32, i32* %6
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %96
74: ; preds = %71
%75 = load i8*, i8** %3
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = getelementptr inbounds i8, i8* %78, i64 1
%80 = load i8*, i8** %3
%81 = load i32, i32* %5
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
%84 = getelementptr inbounds i8, i8* %83, i64 2
%85 = load i32, i32* %4
%86 = load i32, i32* %5
%87 = add nsw i32 %86, 2
%88 = sub nsw i32 %85, %87
%89 = add nsw i32 %88, 1
%90 = call i32 @memmove(i8* %79, i8* %84, i32 %89)
%91 = load i8*, i8** %3
%92 = load i32, i32* %4
%93 = add nsw i32 %92, -1
store i32 %93, i32* %4
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds i8, i8* %91, i64 %94
store i8 0, i8* %95
br label %96
96: ; preds = %74, %71
br label %97
97: ; preds = %96, %11
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 1
store i32 %99, i32* %5
br label %7
100: ; preds = %7
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"%s:%d - WARNING: invalid escape sequence found '\\%c'\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RecipeML/Recipe/refs/heads/master/src/grammar.c\00"
define void @fix_escaping(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %39
4: ; preds = %2, %35
%5 = phi i64 [ %11, %35 ], [ 0, %2 ]
%6 = phi i32 [ %36, %35 ], [ %1, %2 ]
%7 = trunc i64 %5 to i32
%8 = getelementptr inbounds i8, i8* %0, i64 %5
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 92
%11 = add nuw nsw i64 %5, 1
br i1 %10, label %12, label %35
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %0, i64 %11
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %22 [
i32 92, label %25
i32 39, label %16
i32 34, label %17
i32 116, label %18
i32 114, label %19
i32 110, label %20
i32 102, label %21
]
16: ; preds = %12
br label %25
17: ; preds = %12
br label %25
18: ; preds = %12
br label %25
19: ; preds = %12
br label %25
20: ; preds = %12
br label %25
21: ; preds = %12
br label %25
22: ; preds = %12
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 361, i8 signext %14)
br label %35
25: ; preds = %12, %16, %17, %18, %19, %20, %21
%26 = phi i8 [ 39, %16 ], [ 34, %17 ], [ 9, %18 ], [ 13, %19 ], [ 10, %20 ], [ 12, %21 ], [ 92, %12 ]
store i8 %26, i8* %8
%27 = getelementptr inbounds i8, i8* %8, i64 1
%28 = getelementptr inbounds i8, i8* %8, i64 2
%29 = xor i32 %7, -1
%30 = add i32 %6, %29
%31 = tail call i32 @memmove(i8* %27, i8* %28, i32 %30)
%32 = add nsw i32 %6, -1
%33 = sext i32 %6 to i64
%34 = getelementptr inbounds i8, i8* %0, i64 %33
store i8 0, i8* %34
br label %35
35: ; preds = %4, %22, %25
%36 = phi i32 [ %6, %22 ], [ %32, %25 ], [ %6, %4 ]
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %11, %37
br i1 %38, label %4, label %39
39: ; preds = %35, %2
ret void
}