char *util_strcat_realloc(char *str1, const char *str2) {
  char *buf;
  if (str1) {
    buf = __util_realloc(
        __func__,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/ibm-s390-tools/s390-tools/refs/heads/master/"
        "libutil/util_libc.c",
        134, str1, strlen(str1) + strlen(str2) + 1);
    strcat(buf, str2);
  } else {
    buf =
        __util_strdup(__func__,
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/ibm-s390-tools/"
                      "s390-tools/refs/heads/master/libutil/util_libc.c",
                      137, str2);
  }
  return buf;
}


x86 assembly (clang, -O0):
<util_strcat_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ba <util_strcat_realloc+0x7a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%r8
mov    -0x20(%rbp),%rcx
add    %rax,%r8
add    $0x1,%r8
lea    0xe71(%rip),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x86,%edx
mov    $0x0,%al
call   1040 <__util_realloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
jmp    11de <util_strcat_realloc+0x9e>
mov    -0x10(%rbp),%rcx
lea    0xe3b(%rip),%rdi
lea    0xe48(%rip),%rsi
mov    $0x89,%edx
mov    $0x0,%al
call   1060 <__util_strdup@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_strcat_realloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %rdi,%rdi
je     1195 <util_strcat_realloc+0x55>
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%r8
add    $0x1,%r8
lea    0xe91(%rip),%rdi
lea    0xe9e(%rip),%rsi
mov    $0x86,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <__util_realloc@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
jmp    11b5 <util_strcat_realloc+0x75>
lea    0xe64(%rip),%rdi
lea    0xe71(%rip),%rsi
mov    $0x89,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1060 <__util_strdup@plt>
movslq %eax,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__func__.util_strcat_realloc = [20 x i8] c"util_strcat_realloc\00"
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ibm-s390-tools/s390-tools/refs/heads/master/libutil/util_libc.c\00"
define i8* @util_strcat_realloc(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 = icmp ne i8* %6, null
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = load i8*, i8** %4
%13 = call i64 @strlen(i8* %12)
%14 = add i64 %11, %13
%15 = add i64 %14, 1
%16 = call i32 (i8*, i8*, i32, i8*, i64, ...) bitcast (i32 (...)* @__util_realloc to i32 (i8*, i8*, i32, i8*, i64, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.util_strcat_realloc, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 134, i8* %9, i64 %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i8*, i8** %4
%21 = call i8* @strcat(i8* %19, i8* %20)
br label %27
22: ; preds = %2
%23 = load i8*, i8** %4
%24 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @__util_strdup to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.util_strcat_realloc, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 137, i8* %23)
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %5
br label %27
27: ; preds = %22, %8
%28 = load i8*, i8** %5
ret i8* %28
}

LLVM IR (-O2):
@__func__.util_strcat_realloc = [20 x i8] c"util_strcat_realloc\00"
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ibm-s390-tools/s390-tools/refs/heads/master/libutil/util_libc.c\00"
define i8* @util_strcat_realloc(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %0)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%7 = add i64 %5, 1
%8 = add i64 %7, %6
%9 = tail call i32 (i8*, i8*, i32, i8*, i64, ...) bitcast (i32 (...)* @__util_realloc to i32 (i8*, i8*, i32, i8*, i64, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.util_strcat_realloc, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 134, i8* %0, i64 %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = tail call i8* @strcat(i8* dereferenceable(1) %11, i8* dereferenceable(1) %1)
br label %17
13: ; preds = %2
%14 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @__util_strdup to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.util_strcat_realloc, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 137, i8* %1)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
br label %17
17: ; preds = %13, %4
%18 = phi i8* [ %11, %4 ], [ %16, %13 ]
ret i8* %18
}