char *jstrescape(char *pt) {
  char *ptr;
  int i = 0, j = 0;
  (ptr) = (char *)_mcalloc(
      (65535), sizeof(char),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/DanielSchiavini/cortez-ro/refs/heads/master/"
      "src/common/strlib.c",
      24, __func__);
  strcpy(ptr, pt);
  while (ptr[i] != '\0') {
    switch (ptr[i]) {
    case '\'':
      pt[j++] = '\\';
      pt[j++] = ptr[i++];
      break;
    case '\\':
      pt[j++] = '\\';
      pt[j++] = ptr[i++];
      break;
    case '%':
      pt[j++] = '_';
      i++;
      break;
    default:
      pt[j++] = ptr[i++];
    }
  }
  pt[j++] = '\0';
  _mfree(ptr,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/DanielSchiavini/cortez-ro/refs/heads/"
         "master/src/common/strlib.c",
         45, __func__);
  return pt;
}


x86 assembly (clang, -O0):
<jstrescape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0xffff,%edi
mov    $0x1,%esi
lea    0xea5(%rip),%rdx
mov    $0x18,%ecx
lea    0xf33(%rip),%r8
mov    $0x0,%al
call   1040 <_mcalloc@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     12b2 <jstrescape+0x182>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x25,%eax
je     125f <jstrescape+0x12f>
jmp    11b3 <jstrescape+0x83>
mov    -0x1c(%rbp),%eax
sub    $0x27,%eax
je     11d5 <jstrescape+0xa5>
jmp    11c4 <jstrescape+0x94>
mov    -0x1c(%rbp),%eax
sub    $0x5c,%eax
je     121a <jstrescape+0xea>
jmp    1283 <jstrescape+0x153>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    12ad <jstrescape+0x17d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    12ad <jstrescape+0x17d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movb   $0x5f,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ad <jstrescape+0x17d>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1181 <jstrescape+0x51>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
lea    0xd2d(%rip),%rsi
mov    $0x2d,%edx
lea    0xdbb(%rip),%rcx
mov    $0x0,%al
call   1050 <_mfree@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jstrescape>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xec1(%rip),%rdx
lea    0xf54(%rip),%r8
xor    %ebx,%ebx
mov    $0x1,%esi
mov    $0xffff,%edi
mov    $0x18,%ecx
xor    %eax,%eax
call   1040 <_mcalloc@plt>
movslq %eax,%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    (%r14),%cl
test   %cl,%cl
je     11c7 <jstrescape+0x97>
mov    %r14,%rax
jmp    11a4 <jstrescape+0x74>
nopl   0x0(%rax,%rax,1)
movslq %ebx,%rcx
add    $0x1,%ebx
movb   $0x5c,(%r15,%rcx,1)
movzbl (%rax),%ecx
movslq %ebx,%rbx
mov    %cl,(%r15,%rbx,1)
add    $0x1,%ebx
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11c4 <jstrescape+0x94>
movsbl %cl,%edx
cmp    $0x25,%edx
je     11c0 <jstrescape+0x90>
cmp    $0x5c,%edx
je     1180 <jstrescape+0x50>
cmp    $0x27,%edx
je     1180 <jstrescape+0x50>
jmp    118e <jstrescape+0x5e>
nopl   0x0(%rax,%rax,1)
mov    $0x5f,%cl
jmp    118e <jstrescape+0x5e>
movslq %ebx,%rbx
movb   $0x0,(%r15,%rbx,1)
lea    0xe2d(%rip),%rsi
lea    0xec0(%rip),%rcx
mov    %r14,%rdi
mov    $0x2d,%edx
xor    %eax,%eax
call   1050 <_mfree@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/DanielSchiavini/cortez-ro/refs/heads/master/src/common/strlib.c\00"
@__func__.jstrescape = [11 x i8] c"jstrescape\00"
define i8* @jstrescape(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (i32, i64, i8*, i32, i8*, ...) bitcast (i32 (...)* @_mcalloc to i32 (i32, i64, i8*, i32, i8*, ...)*)(i32 65535, i64 1, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.jstrescape, i64 0, i64 0))
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i8* @strcpy(i8* %9, i8* %10)
br label %12
12: ; preds = %81, %1
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %82
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
switch i32 %26, label %69 [
i32 39, label %27
i32 92, label %44
i32 37, label %61
]
27: ; preds = %20
%28 = load i8*, i8** %2
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
store i8 92, i8* %32
%33 = load i8*, i8** %3
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
%36 = sext i32 %34 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = load i8, i8* %37
%39 = load i8*, i8** %2
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
store i8 %38, i8* %43
br label %81
44: ; preds = %20
%45 = load i8*, i8** %2
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
store i8 92, i8* %49
%50 = load i8*, i8** %3
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i8, i8* %54
%56 = load i8*, i8** %2
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
%59 = sext i32 %57 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
store i8 %55, i8* %60
br label %81
61: ; preds = %20
%62 = load i8*, i8** %2
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
%65 = sext i32 %63 to i64
%66 = getelementptr inbounds i8, i8* %62, i64 %65
store i8 95, i8* %66
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %81
69: ; preds = %20
%70 = load i8*, i8** %3
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
%73 = sext i32 %71 to i64
%74 = getelementptr inbounds i8, i8* %70, i64 %73
%75 = load i8, i8* %74
%76 = load i8*, i8** %2
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 1
store i32 %78, i32* %5
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds i8, i8* %76, i64 %79
store i8 %75, i8* %80
br label %81
81: ; preds = %69, %61, %44, %27
br label %12
82: ; preds = %12
%83 = load i8*, i8** %2
%84 = load i32, i32* %5
%85 = add nsw i32 %84, 1
store i32 %85, i32* %5
%86 = sext i32 %84 to i64
%87 = getelementptr inbounds i8, i8* %83, i64 %86
store i8 0, i8* %87
%88 = load i8*, i8** %3
%89 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_mfree to i32 (i8*, i8*, i32, i8*, ...)*)(i8* %88, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.jstrescape, i64 0, i64 0))
%90 = load i8*, i8** %2
ret i8* %90
}

LLVM IR (-O2):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/DanielSchiavini/cortez-ro/refs/heads/master/src/common/strlib.c\00"
@__func__.jstrescape = [11 x i8] c"jstrescape\00"
define i8* @jstrescape(i8* returned %0) {
%2 = tail call i32 (i32, i64, i8*, i32, i8*, ...) bitcast (i32 (...)* @_mcalloc to i32 (i32, i64, i8*, i32, i8*, ...)*)(i32 65535, i64 1, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.jstrescape, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i8* @strcpy(i8* dereferenceable(1) %4, i8* dereferenceable(1) %0)
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %37, label %8
8: ; preds = %1, %25
%9 = phi i64 [ %31, %25 ], [ 0, %1 ]
%10 = phi i8 [ %33, %25 ], [ %6, %1 ]
%11 = phi i8* [ %32, %25 ], [ %4, %1 ]
%12 = phi i32 [ %30, %25 ], [ 0, %1 ]
%13 = sext i8 %10 to i32
switch i32 %13, label %24 [
i32 39, label %14
i32 92, label %19
i32 37, label %25
]
14: ; preds = %8
%15 = add nsw i32 %12, 1
%16 = sext i32 %12 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 92, i8* %17
%18 = load i8, i8* %11
br label %25
19: ; preds = %8
%20 = add nsw i32 %12, 1
%21 = sext i32 %12 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 92, i8* %22
%23 = load i8, i8* %11
br label %25
24: ; preds = %8
br label %25
25: ; preds = %8, %24, %19, %14
%26 = phi i32 [ %12, %24 ], [ %20, %19 ], [ %15, %14 ], [ %12, %8 ]
%27 = phi i8 [ %10, %24 ], [ %23, %19 ], [ %18, %14 ], [ 95, %8 ]
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds i8, i8* %0, i64 %28
store i8 %27, i8* %29
%30 = add nsw i32 %26, 1
%31 = add nuw i64 %9, 1
%32 = getelementptr inbounds i8, i8* %4, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %8
35: ; preds = %25
%36 = sext i32 %30 to i64
br label %37
37: ; preds = %35, %1
%38 = phi i64 [ 0, %1 ], [ %36, %35 ]
%39 = getelementptr inbounds i8, i8* %0, i64 %38
store i8 0, i8* %39
%40 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_mfree to i32 (i8*, i8*, i32, i8*, ...)*)(i8* %4, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.jstrescape, i64 0, i64 0))
ret i8* %0
}