#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*/ strcpy(char *, char const *);
int strncmp(char *, char const *, int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int main(int argc, char **argv) {
  char Buf[2048];
  const char Str[] = "TestStringOfParticularLength";
  strcpy(Buf, Str);
  strncpy(Buf, Str, 17);
  return strncmp(Buf, Str, 17);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x830(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x828(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x820(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x818(%rbp)
mov    0xe97(%rip),%al
mov    %al,-0x814(%rbp)
lea    -0x810(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x810(%rbp),%rdi
lea    -0x830(%rbp),%rsi
mov    $0x11,%edx
call   1030 <strncpy@plt>
lea    -0x810(%rbp),%rdi
lea    -0x830(%rbp),%rsi
mov    $0x11,%edx
call   1040 <strncmp@plt>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x828,%rsp
movups 0xecc(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x11,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x11,%edx
call   1040 <strncmp@plt>
add    $0x828,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.Str = [29 x i8] c"TestStringOfParticularLength\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
%7 = alloca [29 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [29 x i8]* %7 to i8*
%9 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%14 = call i32 @strncpy(i8* %12, i8* %13, i32 17)
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%17 = call i32 @strncmp(i8* %15, i8* %16, i32 17)
ret i32 %17
}

LLVM IR (-O2):
@__const.main.Str = [29 x i8] c"TestStringOfParticularLength\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2048 x i8]
%4 = alloca [29 x i8]
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [29 x i8], [29 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = call i32 @strncpy(i8* %5, i8* %6, i32 17)
%9 = call i32 @strncmp(i8* %5, i8* %6, i32 17)
ret i32 %9
}