#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 Factor(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i, n, rang1, rang2, max, max_index;
  fflush(stdin);
  scanf("%d", &n);
  while (n--) {
    int divisor[10000 + 1] = {0};
    max = max_index = 0;
    scanf("%d %d", &rang1, &rang2);
    if ((rang2 - rang1) > 10000)
      return 1;
    printf("Between %d and %d, ", rang1, rang2);
    for (i = rang1; i <= rang2; i++) {
      divisor[i - rang1] = Factor(i);
      if (max < divisor[i - rang1]) {
        max = divisor[i - rang1];
        max_index = i;
      }
    }
    printf("%d has a maximum of %d divisors.\n", max_index, max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    0xe85(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     1289 <main+0x139>
lea    -0x9c70(%rbp),%rdi
xor    %esi,%esi
mov    $0x9c44,%edx
call   1050 <memset@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe3b(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
cmp    $0x2710,%eax
jle    11f1 <main+0xa1>
movl   $0x1,-0x4(%rbp)
jmp    1290 <main+0x140>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1272 <main+0x122>
mov    -0x14(%rbp),%edi
call   1030 <Factor@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    -0x1c(%rbp),%eax
cltq
mov    %ecx,-0x9c70(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
cmp    -0x9c70(%rbp,%rcx,4),%eax
jge    125f <main+0x10f>
mov    -0x14(%rbp),%eax
sub    -0x1c(%rbp),%eax
cltq
mov    -0x9c70(%rbp,%rax,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1264 <main+0x114>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1209 <main+0xb9>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xd9b(%rip),%rdi
call   1040 <printf@plt>
jmp    1189 <main+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x9c70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xea0(%rip),%rdi
xor    %ebp,%ebp
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0x14(%rsp)
jb     122b <main+0xeb>
lea    0xc(%rsp),%rbx
lea    0xe92(%rip),%r13
xor    %ebp,%ebp
jmp    11a9 <main+0x69>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
subl   $0x1,0x14(%rsp)
jb     122b <main+0xeb>
lea    0xe50(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%esi
mov    %edx,%eax
sub    %esi,%eax
cmp    $0x2710,%eax
jg     1226 <main+0xe6>
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
mov    0x10(%rsp),%r15d
mov    $0x0,%r14d
mov    $0x0,%r12d
cmp    0xc(%rsp),%r15d
jg     1190 <main+0x50>
xor    %r12d,%r12d
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %r15d,%edi
call   1030 <Factor@plt>
cmp    %eax,%r14d
cmovl  %eax,%r14d
cmovl  %r15d,%r12d
lea    0x1(%r15),%eax
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jl     1200 <main+0xc0>
jmp    1190 <main+0x50>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [20 x i8] c"Between %d and %d, \00"
@.str.3 = [34 x i8] c"%d has a maximum of %d divisors.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [10001 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @stdin
%14 = call i32 @fflush(i32 %13)
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %16
16: ; preds = %65, %2
%17 = load i32, i32* %7
%18 = add nsw i32 %17, -1
store i32 %18, i32* %7
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %69
20: ; preds = %16
%21 = bitcast [10001 x i32]* %12 to i8*
store i32 0, i32* %11
store i32 0, i32* %10
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32* %9)
%23 = load i32, i32* %9
%24 = load i32, i32* %8
%25 = sub nsw i32 %23, %24
%26 = icmp sgt i32 %25, 10000
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 1, i32* %3
br label %70
28: ; preds = %20
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %8
store i32 %32, i32* %6
br label %33
33: ; preds = %62, %28
%34 = load i32, i32* %6
%35 = load i32, i32* %9
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %65
37: ; preds = %33
%38 = load i32, i32* %6
%39 = call i32 @Factor(i32 %38)
%40 = load i32, i32* %6
%41 = load i32, i32* %8
%42 = sub nsw i32 %40, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10001 x i32], [10001 x i32]* %12, i64 0, i64 %43
store i32 %39, i32* %44
%45 = load i32, i32* %10
%46 = load i32, i32* %6
%47 = load i32, i32* %8
%48 = sub nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10001 x i32], [10001 x i32]* %12, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp slt i32 %45, %51
br i1 %52, label %53, label %61
53: ; preds = %37
%54 = load i32, i32* %6
%55 = load i32, i32* %8
%56 = sub nsw i32 %54, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [10001 x i32], [10001 x i32]* %12, i64 0, i64 %57
%59 = load i32, i32* %58
store i32 %59, i32* %10
%60 = load i32, i32* %6
store i32 %60, i32* %11
br label %61
61: ; preds = %53, %37
br label %62
62: ; preds = %61
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %33
65: ; preds = %33
%66 = load i32, i32* %11
%67 = load i32, i32* %10
%68 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %66, i32 %67)
br label %16
69: ; preds = %16
store i32 0, i32* %3
br label %70
70: ; preds = %69, %27
%71 = load i32, i32* %3
ret i32 %71
}

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