buildString(char **array, int length) {
  char *string =
      eipa_malloc((strlen(array[0]) + 1), 831,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/"
                  "heads/master/Cuda-SAK/functions.c");
  strcpy(string, array[0]);
  for (int i = 1; i < length; i++) {
    string = eipa_realloc(
        (void **)(&(string)),
        (strlen(string) + strlen("\n") + strlen(array[i]) + 1), 835,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/"
        "Cuda-SAK/functions.c");
    strcat(string, "\n");
    strcat(string, array[i]);
  }
  string = (char *)eipa_realloc(
      (void **)(&(string)), (strlen(string) + strlen("\n") + 1), 840,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/"
      "Cuda-SAK/functions.c");
  strcat(string, "\n");
  return string;
}


x86 assembly (clang, -O0):
<buildString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    $0x33f,%esi
lea    0xe82(%rip),%rdx
mov    $0x0,%al
call   1060 <eipa_malloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122b <buildString+0xdb>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rsi
add    %rax,%rsi
add    $0x1,%rsi
lea    -0x18(%rbp),%rdi
mov    $0x343,%edx
lea    0xe15(%rip),%rcx
mov    $0x0,%al
call   1050 <eipa_realloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcat@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a2 <buildString+0x52>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rsi
add    $0x1,%rsi
add    $0x1,%rsi
lea    -0x18(%rbp),%rdi
mov    $0x348,%edx
lea    0xdb1(%rip),%rcx
mov    $0x0,%al
call   1050 <eipa_realloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r12
mov    (%rdi),%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
lea    0xe8d(%rip),%rdx
mov    $0x33f,%esi
xor    %eax,%eax
call   1060 <eipa_malloc@plt>
movslq %eax,%rbx
mov    %rbx,(%rsp)
mov    (%r12),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
cmp    $0x2,%ebp
jl     120d <buildString+0xbd>
mov    %ebp,%r13d
mov    $0x1,%ebp
lea    0xe5a(%rip),%r14
mov    %rsp,%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    (%r12,%rbp,8),%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rsi
add    $0x2,%rsi
mov    %r15,%rdi
mov    $0x343,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <eipa_realloc@plt>
movslq %eax,%rbx
mov    %rbx,(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movw   $0xa,(%rbx,%rax,1)
mov    (%rsp),%rdi
mov    (%r12,%rbp,8),%rsi
call   1070 <strcat@plt>
add    $0x1,%rbp
mov    (%rsp),%rbx
cmp    %rbp,%r13
jne    11b0 <buildString+0x60>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x2(%rax),%rsi
lea    0xde0(%rip),%rcx
mov    %rsp,%rdi
mov    $0x348,%edx
xor    %eax,%eax
call   1050 <eipa_realloc@plt>
movslq %eax,%rbx
mov    %rbx,(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movw   $0xa,(%rbx,%rax,1)
mov    (%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @buildString(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%7 = load i8**, i8*** %3
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i64 @strlen(i8* %9)
%11 = add i64 %10, 1
%12 = call i32 (i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_malloc to i32 (i64, i32, i8*, ...)*)(i64 %11, i32 831, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, 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*** %3
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i8* @strcpy(i8* %15, i8* %18)
store i32 1, i32* %6
br label %20
20: ; preds = %48, %2
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %51
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = call i64 @strlen(i8* %25)
%27 = add i64 %26, 1
%28 = load i8**, i8*** %3
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @strlen(i8* %32)
%34 = add i64 %27, %33
%35 = add i64 %34, 1
%36 = call i32 (i8**, i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_realloc to i32 (i8**, i64, i32, i8*, ...)*)(i8** %5, i64 %35, i32 835, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %5
%39 = load i8*, i8** %5
%40 = call i8* @strcat(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%41 = load i8*, i8** %5
%42 = load i8**, i8*** %3
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i8* @strcat(i8* %41, i8* %46)
br label %48
48: ; preds = %24
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %20
51: ; preds = %20
%52 = load i8*, i8** %5
%53 = call i64 @strlen(i8* %52)
%54 = add i64 %53, 1
%55 = add i64 %54, 1
%56 = call i32 (i8**, i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_realloc to i32 (i8**, i64, i32, i8*, ...)*)(i8** %5, i64 %55, i32 840, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%57 = sext i32 %56 to i64
%58 = inttoptr i64 %57 to i8*
store i8* %58, i8** %5
%59 = load i8*, i8** %5
%60 = call i8* @strcat(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%61 = load i8*, i8** %5
%62 = ptrtoint i8* %61 to i32
ret i32 %62
}

LLVM IR (-O2):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
define i32 @buildString(i8** nocapture %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %0
%6 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%7 = add i64 %6, 1
%8 = tail call i32 (i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_malloc to i32 (i64, i32, i8*, ...)*)(i64 %7, i32 831, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %0
%12 = tail call i8* @strcpy(i8* dereferenceable(1) %10, i8* dereferenceable(1) %11)
%13 = icmp sgt i32 %1, 1
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = zext i32 %1 to i64
br label %29
16: ; preds = %29, %2
%17 = phi i8* [ %10, %2 ], [ %49, %29 ]
%18 = call i64 @strlen(i8* dereferenceable(1) %17)
%19 = add i64 %18, 2
%20 = call i32 (i8**, i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_realloc to i32 (i8**, i64, i32, i8*, ...)*)(i8** %3, i64 %19, i32 840, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %3
%23 = call i64 @strlen(i8* dereferenceable(1) %22)
%24 = getelementptr i8, i8* %22, i64 %23
%25 = bitcast i8* %24 to i16*
store i16 10, i16* %25
%26 = load i8*, i8** %3
%27 = ptrtoint i8* %26 to i64
%28 = trunc i64 %27 to i32
ret i32 %28
29: ; preds = %29, %14
%30 = phi i8* [ %10, %14 ], [ %49, %29 ]
%31 = phi i64 [ 1, %14 ], [ %47, %29 ]
%32 = call i64 @strlen(i8* dereferenceable(1) %30)
%33 = getelementptr inbounds i8*, i8** %0, i64 %31
%34 = load i8*, i8** %33
%35 = call i64 @strlen(i8* dereferenceable(1) %34)
%36 = add i64 %32, 2
%37 = add i64 %36, %35
%38 = call i32 (i8**, i64, i32, i8*, ...) bitcast (i32 (...)* @eipa_realloc to i32 (i8**, i64, i32, i8*, ...)*)(i8** %3, i64 %37, i32 835, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i8*
store i8* %40, i8** %3
%41 = call i64 @strlen(i8* dereferenceable(1) %40)
%42 = getelementptr i8, i8* %40, i64 %41
%43 = bitcast i8* %42 to i16*
store i16 10, i16* %43
%44 = load i8*, i8** %3
%45 = load i8*, i8** %33
%46 = call i8* @strcat(i8* dereferenceable(1) %44, i8* dereferenceable(1) %45)
%47 = add nuw nsw i64 %31, 1
%48 = icmp eq i64 %47, %15
%49 = load i8*, i8** %3
br i1 %48, label %16, label %29
}