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

/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(void) {
  char s[] = "Golden Global View";
  printf("old len is %ld\n", strlen(s));
  memmove(s, s + 7, sizeof(s) - 7);
  printf("%s\n", s);
  printf("now len is %ld\n", strlen(s));
  printf("now sizeof() is %ld\n", sizeof(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xeac(%rip),%al
mov    %al,-0xe(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0x7,%rsi
mov    $0xc,%edx
call   1050 <memmove@plt>
lea    -0x20(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x13,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x776569,0xf(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x7(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xc,%edx
call   1060 <memmove@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x13,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [19 x i8] c"Golden Global View\00"
@.str = [16 x i8] c"old len is %ld\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [16 x i8] c"now len is %ld\0A\00"
@.str.3 = [21 x i8] c"now sizeof() is %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [19 x i8]
store i32 0, i32* %1
%3 = bitcast [19 x i8]* %2 to i8*
%4 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds i8, i8* %8, i64 7
%10 = call i32 @memmove(i8* %7, i8* %9, i32 12)
%11 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i64 19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [19 x i8] c"Golden Global View\00"
@.str = [16 x i8] c"old len is %ld\0A\00"
@.str.2 = [16 x i8] c"now len is %ld\0A\00"
@.str.3 = [21 x i8] c"now sizeof() is %ld\0A\00"
define i32 @main() {
%1 = alloca [19 x i8]
%2 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 7
%6 = call i32 @memmove(i8* %2, i8* %5, i32 12)
%7 = call i32 @puts(i8* %2)
%8 = call i32 @strlen(i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i64 19)
ret i32 0
}