#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 /*<<< orphan*/ strcpy_2(char **, char **);
void main() {
  char string_1[20] = "123qweasd";
  char string_2[20];
  printf("string_1 = %s;\n", string_1);
  printf("string_2 = %s;\n", string_2);
  strcpy_2(&string_2, &string_1);
  printf("after copying string_2 = %s;\n", string_2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy_2@plt>
lea    -0x40(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xed3(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy_2@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string_1 = [20 x i8] c"123qweasd\00\00\00\00\00\00\00\00\00\00\00"
@.str = [16 x i8] c"string_1 = %s;\0A\00"
@.str.1 = [16 x i8] c"string_2 = %s;\0A\00"
@.str.2 = [30 x i8] c"after copying string_2 = %s;\0A\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = bitcast [20 x i8]* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = bitcast [20 x i8]* %2 to i8**
%9 = bitcast [20 x i8]* %1 to i8**
%10 = call i32 @strcpy_2(i8** %8, i8** %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@__const.main.string_1 = [20 x i8] c"123qweasd\00\00\00\00\00\00\00\00\00\00\00"
@.str = [16 x i8] c"string_1 = %s;\0A\00"
@.str.1 = [16 x i8] c"string_2 = %s;\0A\00"
@.str.2 = [30 x i8] c"after copying string_2 = %s;\0A\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = bitcast [20 x i8]* %2 to i8**
%8 = bitcast [20 x i8]* %1 to i8**
%9 = call i32 @strcpy_2(i8** %7, i8** %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret void
}