char *helper_get_file_name(char *base, char *prefix) {
  char *result;
  result = helper_malloc(strlen(base) + strlen(prefix) + 2,
                         "/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                         "aweeraman/debian-copyfs/refs/heads/master/helper.c",
                         296, __func__);
  sprintf(result, "%s.%s", prefix, base);
  return result;
}


x86 assembly (clang, -O0):
<helper_get_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
lea    0xe98(%rip),%rsi
mov    $0x128,%edx
lea    0xf19(%rip),%rcx
mov    $0x0,%al
call   1040 <helper_malloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xf0e(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper_get_file_name>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x2,%rdi
lea    0xea6(%rip),%rsi
lea    0xf2c(%rip),%rcx
mov    $0x128,%edx
xor    %eax,%eax
call   1040 <helper_malloc@plt>
movslq %eax,%rbx
lea    0xf2b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aweeraman/debian-copyfs/refs/heads/master/helper.c\00"
@__func__.helper_get_file_name = [21 x i8] c"helper_get_file_name\00"
@.str.1 = [6 x i8] c"%s.%s\00"
define i8* @helper_get_file_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add i64 %7, %9
%11 = add i64 %10, 2
%12 = call i32 (i64, i8*, i32, i8*, ...) bitcast (i32 (...)* @helper_malloc to i32 (i64, i8*, i32, i8*, ...)*)(i64 %11, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i32 296, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.helper_get_file_name, i64 0, i64 0))
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = load i8*, i8** %3
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aweeraman/debian-copyfs/refs/heads/master/helper.c\00"
@__func__.helper_get_file_name = [21 x i8] c"helper_get_file_name\00"
@.str.1 = [6 x i8] c"%s.%s\00"
define i8* @helper_get_file_name(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 2
%6 = add i64 %5, %4
%7 = tail call i32 (i64, i8*, i32, i8*, ...) bitcast (i32 (...)* @helper_malloc to i32 (i64, i8*, i32, i8*, ...)*)(i64 %6, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i32 296, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.helper_get_file_name, i64 0, i64 0))
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
ret i8* %9
}