#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__ Malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *);
scalar_t__ strlen(char *);
char *strcat5(char *s1, char *s2, char *s3, char *s4, char *s5) {
  char *s;
  s = (char *)Malloc(strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) +
                     strlen(s5) + 1);
  sprintf(s, "%s%s%s%s%s", s1, s2, s3, s4, s5);
  return s;
}


x86 assembly (clang, -O0):
<strcat5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1030 <Malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%rax
lea    0xe26(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <sprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat5>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r13
mov    %rcx,%r12
mov    %rcx,0x10(%rsp)
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rsi,0x18(%rsp)
mov    %rdi,0x20(%rsp)
call   1040 <strlen@plt>
mov    %rax,0x8(%rsp)
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   1040 <strlen@plt>
add    0x8(%rsp),%r14
add    %r15,%r14
add    %r12,%r14
lea    (%rax,%r14,1),%rdi
add    $0x1,%rdi
call   1030 <Malloc@plt>
mov    %rax,%rbp
mov    %r13,(%rsp)
lea    0xe4e(%rip),%rsi
mov    %rbp,%rdi
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    %rbx,%r8
mov    0x10(%rsp),%r9
call   1050 <sprintf@plt>
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s%s%s%s%s\00"
define i8* @strcat5(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = load i8*, i8** %7
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %13, %15
%17 = load i8*, i8** %8
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %16, %18
%20 = load i8*, i8** %9
%21 = call i64 @strlen(i8* %20)
%22 = add nsw i64 %19, %21
%23 = load i8*, i8** %10
%24 = call i64 @strlen(i8* %23)
%25 = add nsw i64 %22, %24
%26 = add nsw i64 %25, 1
%27 = call i64 @Malloc(i64 %26)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %11
%29 = load i8*, i8** %11
%30 = load i8*, i8** %6
%31 = load i8*, i8** %7
%32 = load i8*, i8** %8
%33 = load i8*, i8** %9
%34 = load i8*, i8** %10
%35 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %30, i8* %31, i8* %32, i8* %33, i8* %34)
%36 = load i8*, i8** %11
ret i8* %36
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s%s%s%s%s\00"
define i8* @strcat5(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%11 = add i64 %6, 1
%12 = add i64 %11, %7
%13 = add i64 %12, %8
%14 = add i64 %13, %9
%15 = add i64 %14, %10
%16 = tail call i64 @Malloc(i64 %15)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 @sprintf(i8* dereferenceable(1) %17, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2, i8* %3, i8* %4)
ret i8* %17
}