#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 compare(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main() {
  int q, c = 0, a, b;
  char str[1000001];
  while (scanf("%s", str) == 1) {
    scanf("%d", &q);
    printf("Case %d:\n", ++c);
    while (q--) {
      scanf("%d %d", &a, &b);
      int flag;
      if (a >= b)
        flag = compare(str, b, a);
      else
        flag = compare(str, a, b);
      if (flag)
        printf("Yes\n");
      else
        printf("No\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0xf4260(%rbp),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1233 <main+0x103>
lea    0xea2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     122e <main+0xfe>
lea    0xe62(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11e3 <main+0xb3>
lea    -0xf4260(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <compare@plt>
mov    %eax,-0xf4264(%rbp)
jmp    11fb <main+0xcb>
lea    -0xf4260(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <compare@plt>
mov    %eax,-0xf4264(%rbp)
cmpl   $0x0,-0xf4264(%rbp)
je     121b <main+0xeb>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <main+0xf9>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <main+0x60>
jmp    1149 <main+0x19>
xor    %eax,%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf4258,%rsp
lea    0xea8(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1243 <main+0x103>
lea    0x10(%rsp),%rbx
lea    0xe94(%rip),%rbp
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0xe89(%rip),%r13
lea    0xe85(%rip),%r12
movl   $0x0,(%rsp)
jmp    11ba <main+0x7a>
nopw   0x0(%rax,%rax,1)
lea    0xe59(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1243 <main+0x103>
lea    0xe4f(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%esi
add    $0x1,%esi
lea    0xe29(%rip),%rdi
mov    %esi,(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f5 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
call   1030 <puts@plt>
subl   $0x1,0x4(%rsp)
jb     11a0 <main+0x60>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
mov    %rbx,%rdi
cmp    %eax,%edx
jge    1230 <main+0xf0>
mov    %edx,%esi
mov    %eax,%edx
jmp    1232 <main+0xf2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%esi
call   1060 <compare@plt>
mov    %r13,%rdi
test   %eax,%eax
je     11f0 <main+0xb0>
mov    %r12,%rdi
jmp    11f0 <main+0xb0>
xor    %eax,%eax
add    $0xf4258,%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 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Case %d:\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [5 x i8] c"Yes\0A\00"
@.str.5 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000001 x i8]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %8
8: ; preds = %44, %0
%9 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %45
12: ; preds = %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %43, %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, -1
store i32 %19, i32* %2
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %44
21: ; preds = %17
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = icmp sge i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %6, i64 0, i64 0
%28 = load i32, i32* %5
%29 = load i32, i32* %4
%30 = call i32 @compare(i8* %27, i32 %28, i32 %29)
store i32 %30, i32* %7
br label %36
31: ; preds = %21
%32 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %6, i64 0, i64 0
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 @compare(i8* %32, i32 %33, i32 %34)
store i32 %35, i32* %7
br label %36
36: ; preds = %31, %26
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %43
41: ; preds = %36
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %17
44: ; preds = %17
br label %8
45: ; preds = %8
ret i32 0
}

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