#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 */
char *malloc(long);
int /*<<< orphan*/ printf(char *, long, long);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int main() {
  char *x = malloc(10000000);
  scanf("%s", x);
  long len = strlen(x) / 2 + 1, i, idx = 0;
  char *dup;
  char *s = malloc(len);
  for (i = 1; i < len; i++) {
    s[i - 1] = x[i - 1];
    s[i] = 0;
    dup = strstr(x + i, s);
    if (dup == NULL)
      break;
    else
      idx = dup - x;
  }
  printf("%ld %ld\n", i - 1, idx + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x989680,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1236 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1211 <main+0xc1>
jmp    1236 <main+0xe6>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1225 <main+0xd5>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11b4 <main+0x64>
mov    -0x20(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x28(%rbp),%rdx
add    $0x1,%rdx
lea    0xdb6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x989680,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe91(%rip),%rdi
mov    %rax,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
shr    $0x1f,%eax
add    %ebp,%eax
sar    %eax
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    $0x1,%r14d
mov    $0x1,%esi
cmp    $0x2,%ebp
jl     1222 <main+0xd2>
mov    %rax,%r12
mov    $0x1,%r14d
cmp    $0x3,%r15
mov    $0x2,%ebp
cmovl  %rbp,%r15
mov    (%rbx),%al
mov    %al,(%r12)
movb   $0x0,0x1(%r12)
lea    0x1(%rbx),%rdi
mov    %r12,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
je     121d <main+0xcd>
sub    %rbx,%r14
add    $0x2,%rbx
mov    %rax,%r13
cmp    %rbp,%r15
je     1215 <main+0xc5>
movzbl -0x1(%rbx),%eax
mov    %al,-0x1(%r12,%rbp,1)
movb   $0x0,(%r12,%rbp,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strstr@plt>
add    $0x1,%rbp
add    $0x1,%rbx
test   %rax,%rax
jne    11e0 <main+0x90>
add    $0xffffffffffffffff,%rbp
mov    %rbp,%r15
add    %r13,%r14
mov    %r15,%rsi
jmp    1222 <main+0xd2>
mov    $0x1,%esi
add    $0xffffffffffffffff,%rsi
lea    0xdd6(%rip),%rdi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %1
%8 = call i8* @malloc(i64 10000000)
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = sdiv i32 %12, 2
%14 = add nsw i32 %13, 1
%15 = sext i32 %14 to i64
store i64 %15, i64* %3
store i64 0, i64* %5
%16 = load i64, i64* %3
%17 = call i8* @malloc(i64 %16)
store i8* %17, i8** %7
store i64 1, i64* %4
br label %18
18: ; preds = %50, %0
%19 = load i64, i64* %4
%20 = load i64, i64* %3
%21 = icmp slt i64 %19, %20
br i1 %21, label %22, label %53
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = load i64, i64* %4
%25 = sub nsw i64 %24, 1
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = load i8*, i8** %7
%29 = load i64, i64* %4
%30 = sub nsw i64 %29, 1
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
%32 = load i8*, i8** %7
%33 = load i64, i64* %4
%34 = getelementptr inbounds i8, i8* %32, i64 %33
store i8 0, i8* %34
%35 = load i8*, i8** %2
%36 = load i64, i64* %4
%37 = getelementptr inbounds i8, i8* %35, i64 %36
%38 = load i8*, i8** %7
%39 = call i8* @strstr(i8* %37, i8* %38)
store i8* %39, i8** %6
%40 = load i8*, i8** %6
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %43
42: ; preds = %22
br label %53
43: ; preds = %22
%44 = load i8*, i8** %6
%45 = load i8*, i8** %2
%46 = ptrtoint i8* %44 to i64
%47 = ptrtoint i8* %45 to i64
%48 = sub i64 %46, %47
store i64 %48, i64* %5
br label %49
49: ; preds = %43
br label %50
50: ; preds = %49
%51 = load i64, i64* %4
%52 = add nsw i64 %51, 1
store i64 %52, i64* %4
br label %18
53: ; preds = %42, %18
%54 = load i64, i64* %4
%55 = sub nsw i64 %54, 1
%56 = load i64, i64* %5
%57 = add nsw i64 %56, 1
%58 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %55, i64 %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(10000000) i8* @malloc(i64 10000000)
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @strlen(i8* %1)
%4 = sdiv i32 %3, 2
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp sgt i32 %3, 1
br i1 %8, label %9, label %35
9: ; preds = %0
%10 = ptrtoint i8* %1 to i64
%11 = sub i64 1, %10
%12 = call i64 @llvm.smax.i64(i64 %6, i64 2)
%13 = load i8, i8* %1
store i8 %13, i8* %7
%14 = getelementptr inbounds i8, i8* %7, i64 1
store i8 0, i8* %14
%15 = getelementptr inbounds i8, i8* %1, i64 1
%16 = tail call i8* @strstr(i8* %15, i8* dereferenceable(1) %7)
%17 = icmp eq i8* %16, null
br i1 %17, label %35, label %26
18: ; preds = %26
%19 = getelementptr inbounds i8, i8* %1, i64 %28
%20 = load i8, i8* %19
%21 = getelementptr inbounds i8, i8* %7, i64 %28
store i8 %20, i8* %21
%22 = getelementptr inbounds i8, i8* %7, i64 %29
store i8 0, i8* %22
%23 = getelementptr inbounds i8, i8* %1, i64 %29
%24 = tail call i8* @strstr(i8* %23, i8* dereferenceable(1) %7)
%25 = icmp eq i8* %24, null
br i1 %25, label %31, label %26
26: ; preds = %9, %18
%27 = phi i8* [ %24, %18 ], [ %16, %9 ]
%28 = phi i64 [ %29, %18 ], [ 1, %9 ]
%29 = add nuw nsw i64 %28, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %31, label %18
31: ; preds = %26, %18
%32 = phi i64 [ %12, %26 ], [ %29, %18 ]
%33 = ptrtoint i8* %27 to i64
%34 = add i64 %11, %33
br label %35
35: ; preds = %31, %9, %0
%36 = phi i64 [ 1, %0 ], [ 1, %9 ], [ %34, %31 ]
%37 = phi i64 [ 1, %0 ], [ 1, %9 ], [ %32, %31 ]
%38 = add nsw i64 %37, -1
%39 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %38, i64 %36)
ret i32 0
}