#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 *__xstrdup(char *, char *);
char *extract_file_name(char *text) {
  int i = 1;
  int j = 0;
  char buffer[100];
  char *ret_buffer;
  while (text[i] != 34) {
    i++;
  }
  i++;
  while (text[i] != 34) {
    buffer[j] = text[i];
    i++;
    j++;
  }
  buffer[j] = '\00';
  ret_buffer = (__xstrdup(
      (buffer), "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/SpectreV/Multi2Sim-RCSL/"
                "refs/heads/dramsim/m2c/cl2llvm/format.c"
                ":"
                "44"));
  return ret_buffer;
}


x86 assembly (clang, -O0):
<extract_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     1150 <extract_file_name+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <extract_file_name+0x1d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     1198 <extract_file_name+0x88>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <extract_file_name+0x49>
movslq -0x10(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1030 <__xstrdup@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_file_name>:
sub    $0x68,%rsp
mov    $0x1,%ecx
nopl   0x0(%rax)
cmpb   $0x22,(%rdi,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1120 <extract_file_name+0x10>
mov    %ecx,%eax
mov    (%rdi,%rax,1),%al
cmp    $0x22,%al
jne    1137 <extract_file_name+0x27>
xor    %eax,%eax
jmp    1161 <extract_file_name+0x51>
add    $0xffffffffffffffff,%rcx
mov    %ecx,%ecx
lea    (%rdi,%rcx,1),%rdx
add    $0x2,%rdx
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %al,(%rsp,%rcx,1)
movzbl (%rdx,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x22,%al
jne    1150 <extract_file_name+0x40>
mov    %ecx,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xe94(%rip),%rsi
mov    %rsp,%rdi
call   1030 <__xstrdup@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SpectreV/Multi2Sim-RCSL/refs/heads/dramsim/m2c/cl2llvm/format.c:44\00"
define i8* @extract_file_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i8*
store i8* %0, i8** %2
store i32 1, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %15, %1
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 34
br i1 %14, label %15, label %18
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %21
21: ; preds = %29, %18
%22 = load i8*, i8** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 34
br i1 %28, label %29, label %42
29: ; preds = %21
%30 = load i8*, i8** %2
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %36
store i8 %34, i8* %37
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %21
42: ; preds = %21
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %44
store i8 0, i8* %45
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%47 = call i8* @__xstrdup(i8* %46, i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
store i8* %47, i8** %6
%48 = load i8*, i8** %6
ret i8* %48
}

LLVM IR (-O2):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SpectreV/Multi2Sim-RCSL/refs/heads/dramsim/m2c/cl2llvm/format.c:44\00"
define i8* @extract_file_name(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ %9, %4 ], [ 1, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 34
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = add i64 %5, 1
%12 = and i64 %11, 4294967295
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 34
br i1 %15, label %31, label %16
16: ; preds = %10
%17 = and i64 %5, 4294967295
%18 = add nuw nsw i64 %17, 1
br label %19
19: ; preds = %16, %19
%20 = phi i64 [ 0, %16 ], [ %24, %19 ]
%21 = phi i64 [ %18, %16 ], [ %25, %19 ]
%22 = phi i8 [ %14, %16 ], [ %27, %19 ]
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %20
store i8 %22, i8* %23
%24 = add nuw i64 %20, 1
%25 = add nuw i64 %21, 1
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 34
br i1 %28, label %29, label %19
29: ; preds = %19
%30 = and i64 %24, 4294967295
br label %31
31: ; preds = %29, %10
%32 = phi i64 [ 0, %10 ], [ %30, %29 ]
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %32
store i8 0, i8* %33
%34 = call i8* @__xstrdup(i8* %3, i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
ret i8* %34
}