#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 */
char *mlr_malloc_or_die(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *mlr_paste_5_strings(char *s1, char *s2, char *s3, char *s4, char *s5) {
  int n1 = strlen(s1);
  int n2 = strlen(s2);
  int n3 = strlen(s3);
  int n4 = strlen(s4);
  int n5 = strlen(s5);
  char *s = mlr_malloc_or_die(n1 + n2 + n3 + n4 + n5 + 1);
  strcpy(s, s1);
  strcat(s, s2);
  strcat(s, s3);
  strcat(s, s4);
  strcat(s, s5);
  return s;
}


x86 assembly (clang, -O0):
<mlr_paste_5_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%edi
add    -0x30(%rbp),%edi
add    -0x34(%rbp),%edi
add    -0x38(%rbp),%edi
add    -0x3c(%rbp),%edi
add    $0x1,%edi
call   1050 <mlr_malloc_or_die@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x48(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlr_paste_5_strings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r13
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rdx,0x20(%rsp)
mov    %rsi,%rbp
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
call   1040 <strlen@plt>
mov    %eax,0xc(%rsp)
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r12,%rdi
mov    %r12,%rbx
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1040 <strlen@plt>
add    0xc(%rsp),%r14d
add    %r15d,%r14d
add    %r12d,%r14d
lea    (%rax,%r14,1),%edi
add    $0x1,%edi
call   1050 <mlr_malloc_or_die@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   1060 <strcat@plt>
mov    %rbp,%rdi
mov    0x20(%rsp),%rsi
call   1060 <strcat@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <strcat@plt>
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @mlr_paste_5_strings(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 i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = 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
%17 = load i8*, i8** %6
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %11
%19 = load i8*, i8** %7
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %12
%21 = load i8*, i8** %8
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %13
%23 = load i8*, i8** %9
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %14
%25 = load i8*, i8** %10
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %15
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = add nsw i32 %27, %28
%30 = load i32, i32* %13
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %14
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %15
%35 = add nsw i32 %33, %34
%36 = add nsw i32 %35, 1
%37 = call i8* @mlr_malloc_or_die(i32 %36)
store i8* %37, i8** %16
%38 = load i8*, i8** %16
%39 = load i8*, i8** %6
%40 = call i32 @strcpy(i8* %38, i8* %39)
%41 = load i8*, i8** %16
%42 = load i8*, i8** %7
%43 = call i32 @strcat(i8* %41, i8* %42)
%44 = load i8*, i8** %16
%45 = load i8*, i8** %8
%46 = call i32 @strcat(i8* %44, i8* %45)
%47 = load i8*, i8** %16
%48 = load i8*, i8** %9
%49 = call i32 @strcat(i8* %47, i8* %48)
%50 = load i8*, i8** %16
%51 = load i8*, i8** %10
%52 = call i32 @strcat(i8* %50, i8* %51)
%53 = load i8*, i8** %16
ret i8* %53
}

LLVM IR (-O2):
define i8* @mlr_paste_5_strings(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i32 @strlen(i8* %1)
%8 = tail call i32 @strlen(i8* %2)
%9 = tail call i32 @strlen(i8* %3)
%10 = tail call i32 @strlen(i8* %4)
%11 = add i32 %6, 1
%12 = add i32 %11, %7
%13 = add i32 %12, %8
%14 = add i32 %13, %9
%15 = add i32 %14, %10
%16 = tail call i8* @mlr_malloc_or_die(i32 %15)
%17 = tail call i32 @strcpy(i8* %16, i8* %0)
%18 = tail call i32 @strcat(i8* %16, i8* %1)
%19 = tail call i32 @strcat(i8* %16, i8* %2)
%20 = tail call i32 @strcat(i8* %16, i8* %3)
%21 = tail call i32 @strcat(i8* %16, i8* %4)
ret i8* %16
}