#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*/ memcpy(char *, char *, size_t);
void add(char *ptr_out, char *ptr_in1, size_t len_in1, char *ptr_in2,
         size_t len_in2, char *ptr_in3, size_t len_in3) {
  memcpy(ptr_out, ptr_in1, len_in1);
  ptr_out += len_in1;
  memcpy(ptr_out, ptr_in2, len_in2);
  ptr_out += len_in2;
  memcpy(ptr_out, ptr_in3, len_in3);
  ptr_out += len_in3;
  *ptr_out = '\n';
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    0x10(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0xa,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%r13
mov    %rdi,%rbx
mov    0x40(%rsp),%rbp
call   1030 <memcpy@plt>
add    %r13,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <memcpy@plt>
add    %r12,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1030 <memcpy@plt>
movb   $0xa,0x0(%rbp,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @add(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i8* %5, i64 %6) {
%8 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%9 = getelementptr inbounds i8, i8* %0, i64 %2
%10 = tail call i32 @memcpy(i8* %9, i8* %3, i64 %4)
%11 = getelementptr inbounds i8, i8* %9, i64 %4
%12 = tail call i32 @memcpy(i8* %11, i8* %5, i64 %6)
%13 = getelementptr inbounds i8, i8* %11, i64 %6
store i8 10, i8* %13
ret void
}