#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 /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getMaxRange(char *, long, long);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char *str;
  long *A;
  long t;
  scanf("%ld", &t);
  while (t--) {
    str = (char *)malloc(1000002 * sizeof(char));
    scanf("%s", str);
    long i = 0;
    long currentInt = 0;
    long min = currentInt, max = currentInt, shiftValue = 0, maxP = 0,
         maxPRev = 0, len = 0;
    while (str[i] != '\0') {
      if (str[i] != '=') {
        str[len++] = str[i];
      }
      i++;
    }
    printf("%ld", getMaxRange(str, currentInt, len));
    free(str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1273 <main+0x123>
mov    $0xf4242,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1246 <main+0xf6>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
je     1235 <main+0xe5>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x60(%rbp)
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11ea <main+0x9a>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x60(%rbp),%rdx
call   1040 <getMaxRange@plt>
mov    %eax,%esi
lea    0xda0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    1171 <main+0x21>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    1180 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe7d(%rip),%r14
lea    0xe72(%rip),%r15
jmp    11b4 <main+0x64>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <getMaxRange@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
subq   $0x1,0x8(%rsp)
jb     1174 <main+0x24>
mov    $0xf4242,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rax
xor    %edx,%edx
jmp    11e4 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x3d,%cl
je     11e0 <main+0x90>
test   %cl,%cl
je     1190 <main+0x40>
mov    %cl,(%rbx,%rdx,1)
add    $0x1,%rdx
jmp    11e0 <main+0x90>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = add nsw i64 %4, -1
store i64 %5, i64* %1
%6 = icmp eq i64 %4, 0
br i1 %6, label %29, label %7
7: ; preds = %0, %22
%8 = call i64 @malloc(i32 1000002)
%9 = inttoptr i64 %8 to i8*
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %19, %7
%12 = phi i64 [ 0, %7 ], [ %21, %19 ]
%13 = phi i64 [ 0, %7 ], [ %20, %19 ]
%14 = getelementptr inbounds i8, i8* %9, i64 %12
%15 = load i8, i8* %14
switch i8 %15, label %16 [
i8 0, label %22
i8 61, label %19
]
16: ; preds = %11
%17 = add nsw i64 %13, 1
%18 = getelementptr inbounds i8, i8* %9, i64 %13
store i8 %15, i8* %18
br label %19
19: ; preds = %11, %16
%20 = phi i64 [ %17, %16 ], [ %13, %11 ]
%21 = add nuw nsw i64 %12, 1
br label %11
22: ; preds = %11
%23 = call i32 @getMaxRange(i8* %9, i64 0, i64 %13)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = call i32 @free(i8* %9)
%26 = load i64, i64* %1
%27 = add nsw i64 %26, -1
store i64 %27, i64* %1
%28 = icmp eq i64 %26, 0
br i1 %28, label %29, label %7
29: ; preds = %22, %0
ret i32 0
}