#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*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int main() {
  char src[50];
  char dest[50];
  strcpy(dest, "asdfsdf");
  strncat(dest, "yxcvyser", 5);
  strncat(dest, "", 5);
  strncat(dest, "123", 5);
  printf("result: %s\n", dest);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    -0x80(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    -0x80(%rbp),%rdi
lea    0xe91(%rip),%rsi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    -0x80(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <strncat@plt>
lea    0xe8b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"asdfsdf\00"
@.str.1 = [9 x i8] c"yxcvyser\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [12 x i8] c"result: %s\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 5)
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%8 = call i32 @strncat(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 5)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 5)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"asdfsdf\00"
@.str.1 = [9 x i8] c"yxcvyser\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [12 x i8] c"result: %s\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strncat(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 5)
%5 = call i32 @strncat(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 5)
%6 = call i32 @strncat(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %2)
ret i32 0
}