#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_strcat4(char *_str1, char *_str2, char *_str3, char *_str4) {
  char *str5 = (char *)calloc(
      (strlen(_str1) + strlen(_str2) + strlen(_str3) + strlen(_str4)),
      sizeof(char));
  str5 = strcat(str5, _str1);
  str5 = strcat(str5, _str2);
  str5 = strcat(str5, _str3);
  str5 = strcat(str5, _str4);
  return str5;
}


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

x86 assembly (clang, -O2):
<utils_strcat4>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %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    %r13,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <strcat@plt>

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

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