#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 *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ strcat2(char *, char *);
scalar_t__ strlen(char *);
int main(void) {
  int i = 0;
  char *pe = "Marchena";
  char *ps = malloc(strlen(pe) + 10);
  *ps = 'D';
  *(ps + (++i)) = 'a';
  *(ps + (++i)) = 'n';
  *(ps + (++i)) = 'i';
  *(ps + (++i)) = 'e';
  *(ps + (++i)) = 'l';
  *(ps + (++i)) = ' ';
  *(ps + (++i)) = '\0';
  printf("Start - %s and End - %s\n\n", ps, pe);
  strcat2(ps, pe);
  printf("%s\n", ps);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0xa,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x44,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x61,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x6e,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x69,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x65,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x6c,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcat2@plt>
mov    -0x18(%rbp),%rsi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x12,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movabs $0x206c65696e6144,%rax
mov    %rax,(%rbx)
lea    0xeb4(%rip),%rdi
lea    0xea4(%rip),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcat2@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Marchena\00"
@.str.1 = [26 x i8] c"Start - %s and End - %s\0A\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 10
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
store i8 68, i8* %9
%10 = load i8*, i8** %4
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
store i8 97, i8* %14
%15 = load i8*, i8** %4
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
store i8 110, i8* %19
%20 = load i8*, i8** %4
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8 105, i8* %24
%25 = load i8*, i8** %4
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
store i8 101, i8* %29
%30 = load i8*, i8** %4
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
store i8 108, i8* %34
%35 = load i8*, i8** %4
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
store i8 32, i8* %39
%40 = load i8*, i8** %4
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
store i8 0, i8* %44
%45 = load i8*, i8** %4
%46 = load i8*, i8** %3
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %45, i8* %46)
%48 = load i8*, i8** %4
%49 = load i8*, i8** %3
%50 = call i32 @strcat2(i8* %48, i8* %49)
%51 = load i8*, i8** %4
%52 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %51)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Marchena\00"
@.str.1 = [26 x i8] c"Start - %s and End - %s\0A\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(18) i8* @malloc(i64 18)
store i8 68, i8* %1
%2 = getelementptr inbounds i8, i8* %1, i64 1
store i8 97, i8* %2
%3 = getelementptr inbounds i8, i8* %1, i64 2
store i8 110, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 3
store i8 105, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 4
store i8 101, i8* %5
%6 = getelementptr inbounds i8, i8* %1, i64 5
store i8 108, i8* %6
%7 = getelementptr inbounds i8, i8* %1, i64 6
store i8 32, i8* %7
%8 = getelementptr inbounds i8, i8* %1, i64 7
store i8 0, i8* %8
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @strcat2(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
ret i32 0
}