char *strcpy(char *destination, const char *source) {
  char *dest = destination;
  const char *src = source;
  char *d = dest;
  const char *s = src;
  if (!(dest != 0)) {
    printf("!!!Failed assertion: `%s' in %s: %d in %s \n\n", "dest != NULL",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/kylios/kylux/refs/heads/master/src/lib/"
           "string.c",
           29, __func__);
    debug_backtrace();
    while (1)
      ;
  };
  if (!(src != 0)) {
    printf("!!!Failed assertion: `%s' in %s: %d in %s \n\n", "src != NULL",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/kylios/kylux/refs/heads/master/src/lib/"
           "string.c",
           30, __func__);
    debug_backtrace();
    while (1)
      ;
  };
  while (*s != '\0') {
    *d++ = *s++;
  }
  *d = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <strcpy+0x6f>
lea    0xe9e(%rip),%rdi
lea    0xec4(%rip),%rsi
lea    0xeca(%rip),%rdx
mov    $0x1d,%ecx
lea    0xf48(%rip),%r8
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <debug_backtrace@plt>
jmp    118a <strcpy+0x6a>
cmpq   $0x0,-0x20(%rbp)
jne    11ce <strcpy+0xae>
lea    0xe5f(%rip),%rdi
lea    0xf23(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    $0x1e,%ecx
lea    0xf09(%rip),%r8
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <debug_backtrace@plt>
jmp    11c9 <strcpy+0xa9>
jmp    11d3 <strcpy+0xb3>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     120a <strcpy+0xea>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    11d3 <strcpy+0xb3>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
push   %rax
test   %rdi,%rdi
je     1159 <strcpy+0x39>
test   %rsi,%rsi
je     1192 <strcpy+0x72>
mov    (%rsi),%al
mov    %rdi,%rcx
test   %al,%al
je     1151 <strcpy+0x31>
add    $0x1,%rsi
mov    %rdi,%rcx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rcx)
add    $0x1,%rcx
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1140 <strcpy+0x20>
movb   $0x0,(%rcx)
mov    %rdi,%rax
pop    %rcx
ret
lea    0xea0(%rip),%rdi
lea    0xec6(%rip),%rsi
lea    0xecc(%rip),%rdx
lea    0xf4f(%rip),%r8
mov    $0x1d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <debug_backtrace@plt>
nopl   0x0(%rax,%rax,1)
jmp    1190 <strcpy+0x70>
lea    0xe67(%rip),%rdi
lea    0xf2b(%rip),%rsi
lea    0xe93(%rip),%rdx
lea    0xf16(%rip),%r8
mov    $0x1e,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <debug_backtrace@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    11d0 <strcpy+0xb0>

LLVM IR (-O0):
@.str = [45 x i8] c"!!!Failed assertion: `%s' in %s: %d in %s \0A\0A\00"
@.str.1 = [13 x i8] c"dest != NULL\00"
@.str.2 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kylios/kylux/refs/heads/master/src/lib/string.c\00"
@__func__.strcpy = [7 x i8] c"strcpy\00"
@.str.3 = [12 x i8] c"src != NULL\00"
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
store i8* %9, i8** %5
%10 = load i8*, i8** %4
store i8* %10, i8** %6
%11 = load i8*, i8** %5
store i8* %11, i8** %7
%12 = load i8*, i8** %6
store i8* %12, i8** %8
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.2, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.strcpy, i64 0, i64 0))
%17 = call i32 (...) @debug_backtrace()
br label %18
18: ; preds = %15, %18
br label %18
19: ; preds = %2
%20 = load i8*, i8** %6
%21 = icmp ne i8* %20, null
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.2, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.strcpy, i64 0, i64 0))
%24 = call i32 (...) @debug_backtrace()
br label %25
25: ; preds = %22, %25
br label %25
26: ; preds = %19
br label %27
27: ; preds = %32, %26
%28 = load i8*, i8** %8
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i8*, i8** %8
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %8
%35 = load i8, i8* %33
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %7
store i8 %35, i8* %36
br label %27
38: ; preds = %27
%39 = load i8*, i8** %7
store i8 0, i8* %39
%40 = load i8*, i8** %5
ret i8* %40
}

LLVM IR (-O2):
@.str = [45 x i8] c"!!!Failed assertion: `%s' in %s: %d in %s \0A\0A\00"
@.str.1 = [13 x i8] c"dest != NULL\00"
@.str.2 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kylios/kylux/refs/heads/master/src/lib/string.c\00"
@__func__.strcpy = [7 x i8] c"strcpy\00"
@.str.3 = [12 x i8] c"src != NULL\00"
define i8* @strcpy(i8* returned writeonly %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.2, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.strcpy, i64 0, i64 0))
%6 = tail call i32 (...) @debug_backtrace()
br label %7
7: ; preds = %7, %4
br label %7
8: ; preds = %2
%9 = icmp eq i8* %1, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 0
br i1 %12, label %25, label %17
13: ; preds = %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.2, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.strcpy, i64 0, i64 0))
%15 = tail call i32 (...) @debug_backtrace()
br label %16
16: ; preds = %16, %13
br label %16
17: ; preds = %10, %17
%18 = phi i8 [ %23, %17 ], [ %11, %10 ]
%19 = phi i8* [ %21, %17 ], [ %1, %10 ]
%20 = phi i8* [ %22, %17 ], [ %0, %10 ]
%21 = getelementptr inbounds i8, i8* %19, i64 1
%22 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %18, i8* %20
%23 = load i8, i8* %21
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %17
25: ; preds = %17, %10
%26 = phi i8* [ %0, %10 ], [ %22, %17 ]
store i8 0, i8* %26
ret i8* %0
}