#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*/ printf(char *, char *);
int main(void) {
  void copyString(char *to, char *from);
  char string1[] = "A string to be copied.";
  char string2[50];
  copyString(string2, string1);
  printf("%s\n", string2);
  copyString(string2, "So is this.");
  printf("%s\n", string2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebf(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xeb7(%rip),%al
mov    %al,-0xa(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <copyString@plt>
lea    -0x60(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <copyString@plt>
lea    -0x60(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x2e646569706f63,%rax
mov    %rax,0xf(%rsp)
lea    0x20(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <copyString@plt>
lea    0xebf(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <copyString@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string1 = [23 x i8] c"A string to be copied.\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"So is this.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [23 x i8]
%3 = alloca [50 x i8]
store i32 0, i32* %1
%4 = bitcast [23 x i8]* %2 to i8*
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = [23 x i8] c"A string to be copied.\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"So is this.\00"
define i32 @main() {
%1 = alloca [23 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [23 x i8], [23 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}