int main() {
  int size2 = 4096;
  char string1[] = {"ma vedi mpo'"};
  char string2[size2];
  char *o = mystrcpy(string2, string1);
  puts(o);
  mystrcpy(string2, string1);
  printf("str 2 is %s\n", string2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x1000,-0x4(%rbp)
movabs $0x276f706d206964,%rax
mov    %rax,-0x13(%rbp)
movabs $0x206964657620616d,%rax
64 69 20
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <mystrcpy@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x38(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <mystrcpy@plt>
mov    -0x38(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1010,%rsp
mov    %rsp,%r15
movabs $0x276f706d206964,%rax
mov    %rax,0x5(%rsp)
movabs $0x206964657620616d,%rax
64 69 20
mov    %rax,(%rsp)
lea    0x10(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <mystrcpy@plt>
movslq %eax,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <mystrcpy@plt>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string1 = [13 x i8] c"ma vedi mpo'\00"
@.str = [13 x i8] c"str 2 is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i32 4096, i32* %1
%6 = bitcast [13 x i8]* %2 to i8*
%7 = load i32, i32* %1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @mystrcpy to i32 (i8*, i8*, ...)*)(i8* %10, i8* %11)
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %15)
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%18 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @mystrcpy to i32 (i8*, i8*, ...)*)(i8* %10, i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %10)
%20 = load i8*, i8** %3
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = [13 x i8] c"ma vedi mpo'\00"
@.str = [13 x i8] c"str 2 is %s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @mystrcpy to i32 (i8*, i8*, ...)*)(i8* %5, i8* %2)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %8)
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @mystrcpy to i32 (i8*, i8*, ...)*)(i8* %5, i8* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}