#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*/ dest;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
char *strcpy(char *, char *);
int main() {
  char src[100];
  char dest[100];
  memset(dest, 0, sizeof(dest));
  strcpy(src, "hello world!");
  char *retDest = strcpy(dest, src);
  printf("%s\n", dest);
  if (retDest != dest) {
    abort();
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <strcpy@plt>
mov    %rax,-0xe8(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
mov    -0xe8(%rbp),%rax
lea    -0xe0(%rbp),%rcx
cmp    %rcx,%rax
je     11bd <main+0x7d>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,(%rsp)
movabs $0x21646c726f7720,%rax
mov    %rax,0x5(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 100)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i8* @strcpy(i8* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i8* @strcpy(i8* %9, i8* %10)
store i8* %11, i8** %4
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = icmp ne i8* %14, %15
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello world!\00"
@.str.1 = [4 x i8] c"%s\0A\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 @memset(i8* %4, i32 0, i32 100)
%6 = call i8* @strcpy(i8* %4, i8* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}