#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 */
typedef int /*<<< orphan*/ src;

/* Variables and functions */
int EXIT_SUCCESS;
char *malloc(int);
int /*<<< orphan*/ my_strncat(char *, char *, scalar_t__);
int /*<<< orphan*/ my_strncpy(char *, char *, scalar_t__);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strlen(char *);
int main(void) {
  char src[] = "Take a walk on the wild side";
  char *dest = malloc(sizeof(src) + 1);
  char skill_list[] = "C, C+,+ AWK, Perl, Networking, SysAdministration, ";
  char update_skill[] = "Network Security, Secure Coding.";
  my_strncpy(dest, src, strlen(src) + 1);
  my_strncat(skill_list, update_skill, strlen(update_skill) + 1);
  printf(" src: %s\n", src);
  printf("dest: %s\n", dest);
  printf("%s\n", skill_list);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe81(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7f(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xe7a(%rip),%al
mov    %al,-0x14(%rbp)
mov    $0x1e,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe62(%rip),%rsi
mov    $0x33,%edx
call   1060 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x21,%edx
call   1060 <memcpy@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xc0(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <my_strncpy@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0xb0(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1080 <my_strncat@plt>
lea    -0x30(%rbp),%rsi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
movups 0xea8(%rip),%xmm0
movups %xmm0,0x3d(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movl   $0x202c6e,0x7f(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x20(%rsp)
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <my_strncpy@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
lea    0x50(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <my_strncat@plt>
lea    0xe74(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.src = [29 x i8] c"Take a walk on the wild side\00"
@__const.main.skill_list = [51 x i8] c"C, C+,+ AWK, Perl, Networking, SysAdministration, \00"
@__const.main.update_skill = [33 x i8] c"Network Security, Secure Coding.\00"
@.str = [10 x i8] c" src: %s\0A\00"
@.str.1 = [10 x i8] c"dest: %s\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [29 x i8]
%3 = alloca i8*
%4 = alloca [51 x i8]
%5 = alloca [33 x i8]
store i32 0, i32* %1
%6 = bitcast [29 x i8]* %2 to i8*
%7 = call i8* @malloc(i32 30)
store i8* %7, i8** %3
%8 = bitcast [51 x i8]* %4 to i8*
%9 = bitcast [33 x i8]* %5 to i8*
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%13 = call i64 @strlen(i8* %12)
%14 = add nsw i64 %13, 1
%15 = call i32 @my_strncpy(i8* %10, i8* %11, i64 %14)
%16 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%19 = call i64 @strlen(i8* %18)
%20 = add nsw i64 %19, 1
%21 = call i32 @my_strncat(i8* %16, i8* %17, i64 %20)
%22 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %3
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}

LLVM IR (-O2):
@__const.main.src = [29 x i8] c"Take a walk on the wild side\00"
@__const.main.skill_list = [51 x i8] c"C, C+,+ AWK, Perl, Networking, SysAdministration, \00"
@__const.main.update_skill = [33 x i8] c"Network Security, Secure Coding.\00"
@.str = [10 x i8] c" src: %s\0A\00"
@.str.1 = [10 x i8] c"dest: %s\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [29 x i8]
%2 = alloca [51 x i8]
%3 = alloca [33 x i8]
%4 = getelementptr inbounds [29 x i8], [29 x i8]* %1, i64 0, i64 0
%5 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%6 = getelementptr inbounds [51 x i8], [51 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%8 = call i64 @strlen(i8* %4)
%9 = add nsw i64 %8, 1
%10 = call i32 @my_strncpy(i8* %5, i8* %4, i64 %9)
%11 = call i64 @strlen(i8* %7)
%12 = add nsw i64 %11, 1
%13 = call i32 @my_strncat(i8* %6, i8* %7, i64 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}