#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*/ fix_escaping(char *, size_t);
char *reallocate(int /*<<< orphan*/ *, size_t, int, char *, int, int);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *extract_token(const char *s, size_t l) {
  char *token;
  token = reallocate(NULL, (l + 1), (sizeof(char)),
                     "/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",
                     435, false);
  strncpy(token, s, l);
  token[l] = '\0';
  fix_escaping(token, l);
  return token;
}


x86 assembly (clang, -O0):
<extract_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1,%edx
lea    0xea8(%rip),%rcx
mov    $0x1b3,%r8d
xor    %r9d,%r9d
call   1040 <reallocate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <fix_escaping@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_token>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
add    $0x1,%rsi
lea    0xeba(%rip),%rcx
xor    %edi,%edi
mov    $0x1,%edx
mov    $0x1b3,%r8d
xor    %r9d,%r9d
call   1040 <reallocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <fix_escaping@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [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 i8* @extract_token(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = call i8* @reallocate(i32* null, i64 %7, i32 1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str, i64 0, i64 0), i32 435, i32 0)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i64, i64* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i64 %11)
%13 = load i8*, i8** %5
%14 = load i64, i64* %4
%15 = getelementptr inbounds i8, i8* %13, i64 %14
store i8 0, i8* %15
%16 = load i8*, i8** %5
%17 = load i64, i64* %4
%18 = call i32 @fix_escaping(i8* %16, i64 %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@.str = [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 i8* @extract_token(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @reallocate(i32* null, i64 %3, i32 1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str, i64 0, i64 0), i32 435, i32 0)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %1)
%6 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %6
%7 = tail call i32 @fix_escaping(i8* %4, i64 %1)
ret i8* %4
}