#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 */
int /*<<< orphan*/ Strings_Append(char *, unsigned int, char *, unsigned int);
int /*<<< orphan*/ Strings_Assign(char *, unsigned int, char *, unsigned int);
int /*<<< orphan*/ memcpy(char *, char *, unsigned int);
void Strings_Concat(char *source1_, unsigned int _source1_high, char *source2_,
                    unsigned int _source2_high, char *destination,
                    unsigned int _destination_high) {
  char source1[_source1_high + 1];
  char source2[_source2_high + 1];
  memcpy(source1, source1_, _source1_high + 1);
  memcpy(source2, source2_, _source2_high + 1);
  Strings_Assign((char *)source1, _source1_high, (char *)destination,
                 _destination_high);
  Strings_Append((char *)source2, _source2_high, (char *)destination,
                 _destination_high);
}


x86 assembly (clang, -O0):
<Strings_Concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x58(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1050 <Strings_Assign@plt>
mov    -0x50(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1030 <Strings_Append@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strings_Concat>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,-0x2c(%rbp)
mov    %r8,-0x40(%rbp)
mov    %ecx,%r12d
mov    %rdx,-0x38(%rbp)
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0x1(%rbx),%edx
mov    %rsp,%r13
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    0x1(%r12),%r14d
mov    %rsp,%r15
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r13,%rdi
call   1040 <memcpy@plt>
mov    %r15,%rdi
mov    -0x38(%rbp),%rsi
mov    %r14d,%edx
call   1040 <memcpy@plt>
mov    %r13,%rdi
mov    %ebx,%esi
mov    -0x40(%rbp),%r14
mov    %r14,%rdx
mov    -0x2c(%rbp),%ebx
mov    %ebx,%ecx
call   1050 <Strings_Assign@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1030 <Strings_Append@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Strings_Concat(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i64
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%16 = load i32, i32* %8
%17 = add i32 %16, 1
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %13
%20 = alloca i8, i64 %18
store i64 %18, i64* %14
%21 = load i32, i32* %10
%22 = add i32 %21, 1
%23 = zext i32 %22 to i64
%24 = alloca i8, i64 %23
store i64 %23, i64* %15
%25 = load i8*, i8** %7
%26 = load i32, i32* %8
%27 = add i32 %26, 1
%28 = call i32 @memcpy(i8* %20, i8* %25, i32 %27)
%29 = load i8*, i8** %9
%30 = load i32, i32* %10
%31 = add i32 %30, 1
%32 = call i32 @memcpy(i8* %24, i8* %29, i32 %31)
%33 = load i32, i32* %8
%34 = load i8*, i8** %11
%35 = load i32, i32* %12
%36 = call i32 @Strings_Assign(i8* %20, i32 %33, i8* %34, i32 %35)
%37 = load i32, i32* %10
%38 = load i8*, i8** %11
%39 = load i32, i32* %12
%40 = call i32 @Strings_Append(i8* %24, i32 %37, i8* %38, i32 %39)
%41 = load i8*, i8** %13
ret void
}

LLVM IR (-O2):
define void @Strings_Concat(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = add i32 %1, 1
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = add i32 %3, 1
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
%13 = call i32 @memcpy(i8* %9, i8* %0, i32 %7)
%14 = call i32 @memcpy(i8* %12, i8* %2, i32 %10)
%15 = call i32 @Strings_Assign(i8* %9, i32 %1, i8* %4, i32 %5)
%16 = call i32 @Strings_Append(i8* %12, i32 %3, i8* %4, i32 %5)
ret void
}