#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*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  char s1[100], s2[100];
  strcpy(s1, "xxxxxx 1");
  strcpy(s2, "zzzzzz 2");
  puts("Original strings: ");
  puts("");
  puts(s1);
  puts(s2);
  puts("");
  strncpy(s2, s1, 5);
  puts("New strings: ");
  puts("");
  puts(s1);
  puts(s2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    -0x70(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <strcpy@plt>
lea    0xead(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1050 <puts@plt>
lea    -0x70(%rbp),%rdi
call   1050 <puts@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <puts@plt>
lea    0xe92(%rip),%rdi
call   1050 <puts@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
lea    0xe72(%rip),%rdi
call   1050 <puts@plt>
lea    0xe65(%rip),%rdi
call   1050 <puts@plt>
lea    -0x70(%rbp),%rdi
call   1050 <puts@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0xeaf(%rip),%rsi
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1050 <strcpy@plt>
lea    0xea4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcpy@plt>
lea    0xe9b(%rip),%rdi
call   1060 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
call   1060 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <strncpy@plt>
lea    0xe6e(%rip),%rdi
call   1060 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
call   1060 <puts@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"xxxxxx 1\00"
@.str.1 = [9 x i8] c"zzzzzz 2\00"
@.str.2 = [19 x i8] c"Original strings: \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [14 x i8] c"New strings: \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
%13 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%16 = call i32 @strncpy(i8* %14, i8* %15, i32 5)
%17 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"xxxxxx 1\00"
@.str.1 = [9 x i8] c"zzzzzz 2\00"
@.str.2 = [19 x i8] c"Original strings: \00"
@.str.4 = [14 x i8] c"New strings: \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @putchar(i32 10)
%9 = call i32 @puts(i8* %3)
%10 = call i32 @puts(i8* %4)
%11 = call i32 @putchar(i32 10)
%12 = call i32 @strncpy(i8* %4, i8* %3, i32 5)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @putchar(i32 10)
%15 = call i32 @puts(i8* %3)
%16 = call i32 @puts(i8* %4)
ret i32 0
}