int main(void) {
  char buf[1000001];
  int len, i;
  scanf("%s", buf);
  len = strlen(buf);
  for (i = 0; i < len; i++) {
    printf("%.*s%.*s\n", len - i, buf + i, i, buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4260,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf4250(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xf4254(%rbp)
movl   $0x0,-0xf4258(%rbp)
mov    -0xf4258(%rbp),%eax
cmp    -0xf4254(%rbp),%eax
jge    11d1 <main+0xa1>
mov    -0xf4254(%rbp),%esi
sub    -0xf4258(%rbp),%esi
lea    -0xf4250(%rbp),%rdx
movslq -0xf4258(%rbp),%rax
add    %rax,%rdx
mov    -0xf4258(%rbp),%ecx
lea    -0xf4250(%rbp),%r8
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xf4258(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4258(%rbp)
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0xf4260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf4250,%rsp
lea    0xeb9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r12
test   %r12d,%r12d
jle    11a3 <main+0x73>
mov    %r12d,%r13d
lea    0xe95(%rip),%r14
mov    %rsp,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rsp,%rbx,1),%rdx
mov    %r14,%rdi
mov    %r12d,%esi
mov    %ebx,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0xffffffff,%r12d
cmp    %rbx,%r13
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0xf4250,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [10 x i8] c"%.*s%.*s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000001 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
store i32 0, i32* %4
br label %10
10: ; preds = %25, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = sub nsw i32 %15, %16
%18 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i32, i32* %4
%23 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %21, i32 %22, i8* %23)
br label %25
25: ; preds = %14
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %10
28: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [10 x i8] c"%.*s%.*s\0A\00"
define i32 @main() {
%1 = alloca [1000001 x i8]
%2 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i64 @strlen(i8* %2)
%5 = trunc i64 %4 to i32
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = and i64 %4, 4294967295
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = trunc i64 %10 to i32
%12 = sub nsw i32 %5, %11
%13 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 %10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, i8* %13, i32 %11, i8* %2)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %0
ret i32 0
}