char *get_file_name(char *line_chunk) {
  char *first = strchr(line_chunk, '\"');
  char *second = strchr(first + 1, '\"');
  int size = (second - first) / sizeof(char);
  char *ret = malloc((size) * sizeof(char));
  strncpy(ret, first + 1, size);
  ret[size - 1] = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<get_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x22,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0x22,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
shr    $0x0,%rax
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
movslq -0x1c(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_name>:
push   %r15
push   %r14
push   %rbx
mov    $0x22,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
lea    0x1(%rax),%r14
mov    %r14,%rdi
mov    $0x22,%esi
call   1040 <strchr@plt>
sub    %rbx,%rax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
add    $0xffffffff,%ebx
movslq %ebx,%rax
movb   $0x0,(%r15,%rax,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @get_file_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @strchr(i8* %7, i32 34)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = call i8* @strchr(i8* %10, i32 34)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = udiv i64 %16, 1
%18 = trunc i64 %17 to i32
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 1
%22 = call i8* @malloc(i64 %21)
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = call i8* @strncpy(i8* %23, i8* %25, i64 %27)
%29 = load i8*, i8** %6
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8 0, i8* %33
%34 = load i8*, i8** %6
ret i8* %34
}

LLVM IR (-O2):
define i8* @get_file_name(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 34)
%3 = getelementptr inbounds i8, i8* %2, i64 1
%4 = tail call i8* @strchr(i8* %3, i32 34)
%5 = ptrtoint i8* %4 to i64
%6 = ptrtoint i8* %2 to i64
%7 = sub i64 %5, %6
%8 = shl i64 %7, 32
%9 = ashr exact i64 %8, 32
%10 = tail call i8* @malloc(i64 %9)
%11 = tail call i8* @strncpy(i8* dereferenceable(1) %10, i8* %3, i64 %9)
%12 = add i64 %8, -4294967296
%13 = ashr exact i64 %12, 32
%14 = getelementptr inbounds i8, i8* %10, i64 %13
store i8 0, i8* %14
ret i8* %10
}