#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 */
scalar_t__ calloc(scalar_t__, int);
char *strcat(char *, char *);
scalar_t__ strlen(char *);
char *utils_strcat3(char *_str1, char *_str2, char *_str3) {
  char *str4 = (char *)calloc((strlen(_str1) + strlen(_str2) + strlen(_str3)),
                              sizeof(char));
  str4 = strcat(str4, _str1);
  str4 = strcat(str4, _str2);
  str4 = strcat(str4, _str3);
  return str4;
}


x86 assembly (clang, -O0):
<utils_strcat3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_strcat3>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
add    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %rax,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <strcat@plt>

LLVM IR (-O0):
define i8* @utils_strcat3(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = add nsw i64 %9, %11
%13 = load i8*, i8** %6
%14 = call i64 @strlen(i8* %13)
%15 = add nsw i64 %12, %14
%16 = call i64 @calloc(i64 %15, i32 1)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %7
%18 = load i8*, i8** %7
%19 = load i8*, i8** %4
%20 = call i8* @strcat(i8* %18, i8* %19)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = load i8*, i8** %5
%23 = call i8* @strcat(i8* %21, i8* %22)
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = load i8*, i8** %6
%26 = call i8* @strcat(i8* %24, i8* %25)
store i8* %26, i8** %7
%27 = load i8*, i8** %7
ret i8* %27
}

LLVM IR (-O2):
define i8* @utils_strcat3(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = add nsw i64 %5, %4
%7 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%8 = add nsw i64 %6, %7
%9 = tail call i64 @calloc(i64 %8, i32 1)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i8* @strcat(i8* dereferenceable(1) %10, i8* dereferenceable(1) %0)
%12 = tail call i8* @strcat(i8* dereferenceable(1) %10, i8* dereferenceable(1) %1)
%13 = tail call i8* @strcat(i8* dereferenceable(1) %10, i8* dereferenceable(1) %2)
ret i8* %10
}