#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*/ memset(long long *, int, int);
int /*<<< orphan*/ printf(char *, long long, ...);
scalar_t__ scanf(char *, long long *, long long *);
long long terms(long long);
main() {
  long long temp, i, a, b, s[1000002], max, reg = 0;
  memset(s, -1, sizeof(s));
  while (scanf("%lld%lld", &a, &b) > 0) {
    printf("%lld %lld ", a, b);
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    max = 0;
    for (i = a; i <= b; i++) {
      if (s[i] == -1)
        s[i] = terms(i);
      if (s[i] > max)
        max = s[i];
    }
    printf("%lld\n", max + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7a1250,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x7a1250(%rbp)
lea    -0x7a1240(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x7a1210,%edx
call   1040 <memset@plt>
lea    0xe86(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <scanf@plt>
cmp    $0x0,%rax
jle    1279 <main+0x139>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    11cd <main+0x8d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x7a1248(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     125b <main+0x11b>
mov    -0x18(%rbp),%rax
cmpq   $0xffffffffffffffff,-0x7a1240(%rbp,%rax,8)
ff ff
jne    1219 <main+0xd9>
mov    -0x18(%rbp),%rdi
call   1050 <terms@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0x7a1240(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%rax
mov    -0x7a1240(%rbp,%rax,8),%rax
ff
cmp    -0x7a1248(%rbp),%rax
jle    1245 <main+0x105>
mov    -0x18(%rbp),%rax
mov    -0x7a1240(%rbp,%rax,8),%rax
ff
mov    %rax,-0x7a1248(%rbp)
jmp    124a <main+0x10a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e0 <main+0xa0>
mov    -0x7a1248(%rbp),%rsi
add    $0x1,%rsi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1173 <main+0x33>
xor    %eax,%eax
add    $0x7a1250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7a1228,%rsp
lea    0x10(%rsp),%rdi
mov    $0xffffffff,%esi
mov    $0x7a1210,%edx
call   1040 <memset@plt>
lea    0xe94(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
test   %rax,%rax
jle    1245 <main+0x105>
lea    0xe8b(%rip),%r15
lea    0xe70(%rip),%r12
lea    0x8(%rsp),%r13
mov    %rsp,%rbx
jmp    11c8 <main+0x88>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
test   %rax,%rax
jle    1245 <main+0x105>
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
lea    0xe31(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rsp),%rbp
cmp    %rbp,%rax
jle    1200 <main+0xc0>
mov    %rbp,0x8(%rsp)
mov    %rax,(%rsp)
mov    %rax,%rcx
jmp    1206 <main+0xc6>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rcx
mov    %rax,%rbp
xor    %r14d,%r14d
cmp    %rcx,%rbp
jle    1227 <main+0xe7>
jmp    11a0 <main+0x60>
cmp    %r14,%rax
cmovg  %rax,%r14
lea    0x1(%rbp),%rax
cmp    %rcx,%rbp
mov    %rax,%rbp
jge    11a0 <main+0x60>
mov    0x10(%rsp,%rbp,8),%rax
cmp    $0xffffffffffffffff,%rax
jne    1210 <main+0xd0>
mov    %rbp,%rdi
call   1050 <terms@plt>
mov    %rax,0x10(%rsp,%rbp,8)
mov    (%rsp),%rcx
jmp    1210 <main+0xd0>
xor    %eax,%eax
add    $0x7a1228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%lld%lld\00"
@.str.1 = [11 x i8] c"%lld %lld \00"
@.str.2 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca [1000002 x i64]
%4 = bitcast i64* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast [1000002 x i64]* %3 to i8*
%7 = getelementptr inbounds [1000002 x i64], [1000002 x i64]* %3, i64 0, i64 0
%8 = call i32 @memset(i64* %7, i32 -1, i32 8000016)
%9 = call i64 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %46
11: ; preds = %0, %40
%12 = load i64, i64* %1
%13 = load i64, i64* %2
%14 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %12, i64 %13)
%15 = load i64, i64* %1
%16 = load i64, i64* %2
%17 = icmp sgt i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i64 %16, i64* %1
store i64 %15, i64* %2
br label %19
19: ; preds = %18, %11
%20 = phi i64 [ %15, %18 ], [ %16, %11 ]
%21 = phi i64 [ %16, %18 ], [ %15, %11 ]
%22 = icmp sgt i64 %21, %20
br i1 %22, label %40, label %23
23: ; preds = %19, %33
%24 = phi i64 [ %34, %33 ], [ %20, %19 ]
%25 = phi i64 [ %38, %33 ], [ %21, %19 ]
%26 = phi i64 [ %37, %33 ], [ 0, %19 ]
%27 = getelementptr inbounds [1000002 x i64], [1000002 x i64]* %3, i64 0, i64 %25
%28 = load i64, i64* %27
%29 = icmp eq i64 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %23
%31 = call i64 @terms(i64 %25)
store i64 %31, i64* %27
%32 = load i64, i64* %2
br label %33
33: ; preds = %30, %23
%34 = phi i64 [ %32, %30 ], [ %24, %23 ]
%35 = phi i64 [ %31, %30 ], [ %28, %23 ]
%36 = icmp sgt i64 %35, %26
%37 = select i1 %36, i64 %35, i64 %26
%38 = add nsw i64 %25, 1
%39 = icmp slt i64 %25, %34
br i1 %39, label %23, label %40
40: ; preds = %33, %19
%41 = phi i64 [ 0, %19 ], [ %37, %33 ]
%42 = add nsw i64 %41, 1
%43 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %42)
%44 = call i64 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%45 = icmp sgt i64 %44, 0
br i1 %45, label %11, label %46
46: ; preds = %40, %0
ret i32 0
}