#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 *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char a[] = "hello1 is a long string.";
  char b[] = "hello2 is short.";
  int sa = sizeof a;
  int sb = sizeof b;
  void printArray(char *a, int len);
  printArray(a, sa);
  printArray(b, sb);
  strcpy(a, b);
  printf("a:%s b:%s\n", a, b);
  printArray(a, sa);
  printArray(b, sb);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeab(%rip),%al
mov    %al,-0x18(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0x40(%rbp)
movl   $0x19,-0x54(%rbp)
movl   $0x11,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1050 <printArray@plt>
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1050 <printArray@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1050 <printArray@plt>
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movups 0xecb(%rip),%xmm0
movups %xmm0,0x29(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x19,%esi
call   1050 <printArray@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x11,%esi
call   1050 <printArray@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe9e(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x19,%esi
call   1050 <printArray@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [25 x i8] c"hello1 is a long string.\00"
@__const.main.b = [17 x i8] c"hello2 is short.\00"
@.str = [11 x i8] c"a:%s b:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [25 x i8]
%7 = alloca [17 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [25 x i8]* %6 to i8*
%11 = bitcast [17 x i8]* %7 to i8*
store i32 25, i32* %8
store i32 17, i32* %9
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %8
%14 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* %9
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%20 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20)
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %8
%24 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%25 = load i32, i32* %9
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [25 x i8] c"hello1 is a long string.\00"
@__const.main.b = [17 x i8] c"hello2 is short.\00"
@.str = [11 x i8] c"a:%s b:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [25 x i8]
%4 = alloca [17 x i8]
%5 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret i32 0
}