#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*/ string2;
typedef int /*<<< orphan*/ string;
typedef int /*<<< orphan*/ str3;
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char *src = "Take the test.";
  char dst[strlen(src) + 1];
  strcpy(dst, src);
  dst[0] = 'M';
  printf("src = %s\ndst = %s\n", src, dst);
  char string[10];
  char str[] = "Hello World";
  char *string2 = str;
  printf("%s\n", string2);
  printf("%d\n", (int)sizeof(string));
  printf("%d\n", (int)strlen(string));
  printf("%d\n", (int)sizeof(string2));
  printf("%d\n", (int)strlen(string2));
  printf("%d\n", (int)sizeof(str));
  printf("%d\n", (int)strlen(str));
  char str2[sizeof(str)];
  strcpy(str2, string2);
  printf("%s\n", str2);
  strcpy(str2, "hi");
  printf("%s\n", str2);
  char str3[] = "hello world!\0hello everyone";
  printf("%s\n", str3);
  printf("%d\n", (int)strlen(str3));
  printf("%d\n", (int)sizeof(str3));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x78(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x78(%rbp),%rdx
movb   $0x4d,(%rdx)
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0xe7d(%rip),%rax
mov    %rax,-0x36(%rbp)
mov    0xe7b(%rip),%eax
mov    %eax,-0x2e(%rbp)
lea    -0x36(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x2a(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe03(%rip),%rdi
mov    $0xc,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x36(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4c(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x4c(%rbp),%rsi
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4c(%rbp),%rdi
lea    0xdb8(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x4c(%rbp),%rsi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0xda8(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xda5(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xda2(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xda0(%rip),%eax
mov    %eax,-0x58(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd41(%rip),%rdi
mov    $0x1c,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0xeaa(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
add    $0x1,%ebx
mov    %rsp,%r12
add    $0xf,%rbx
and    $0xfffffffffffffff0,%rbx
mov    %r12,%r15
sub    %rbx,%r15
mov    %r15,%rsp
neg    %rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movb   $0x4d,(%r12,%rbx,1)
lea    0xe7e(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,-0x30(%rbp)
movl   $0x646c72,-0x28(%rbp)
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%r15
mov    %r15,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x5a(%rbp),%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x66(%rbp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xde4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
movups 0xde7(%rip),%xmm0
movups %xmm0,-0x44(%rbp)
movaps 0xdd0(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
lea    -0x50(%rbp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    $0x1c,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Take the test.\00"
@.str.1 = [19 x i8] c"src = %s\0Adst = %s\0A\00"
@__const.main.str = [12 x i8] c"Hello World\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [3 x i8] c"hi\00"
@__const.main.str3 = [28 x i8] c"hello world!\00hello everyone\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [10 x i8]
%6 = alloca [12 x i8]
%7 = alloca i8*
%8 = alloca [12 x i8]
%9 = alloca [28 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %11, 1
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %3
%15 = alloca i8, i64 %13
store i64 %13, i64* %4
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = getelementptr inbounds i8, i8* %15, i64 0
store i8 77, i8* %18
%19 = load i8*, i8** %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %15)
%21 = bitcast [12 x i8]* %6 to i8*
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 10)
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 8)
%30 = load i8*, i8** %7
%31 = call i32 @strlen(i8* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 12)
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%38 = load i8*, i8** %7
%39 = call i32 @strcpy(i8* %37, i8* %38)
%40 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%44 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = bitcast [28 x i8]* %9 to i8*
%47 = getelementptr inbounds [28 x i8], [28 x i8]* %9, i64 0, i64 0
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = getelementptr inbounds [28 x i8], [28 x i8]* %9, i64 0, i64 0
%50 = call i32 @strlen(i8* %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 28)
%53 = load i32, i32* @EXIT_SUCCESS
store i32 %53, i32* %1
%54 = load i8*, i8** %3
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str = [15 x i8] c"Take the test.\00"
@.str.1 = [19 x i8] c"src = %s\0Adst = %s\0A\00"
@__const.main.str = [12 x i8] c"Hello World\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [3 x i8] c"hi\00"
@__const.main.str3 = [28 x i8] c"hello world!\00hello everyone\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [12 x i8]
%3 = alloca [12 x i8]
%4 = alloca [28 x i8]
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = add nsw i32 %5, 1
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8 77, i8* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%13 = call i32 @puts(i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 10)
%15 = call i32 @strlen(i8* %11)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 8)
%18 = call i32 @strlen(i8* %12)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 12)
%21 = call i32 @strlen(i8* %12)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%24 = call i32 @strcpy(i8* %23, i8* %12)
%25 = call i32 @puts(i8* %23)
%26 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @puts(i8* %23)
%28 = getelementptr inbounds [28 x i8], [28 x i8]* %4, i64 0, i64 0
%29 = call i32 @puts(i8* %28)
%30 = call i32 @strlen(i8* %28)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 28)
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}