#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
main() {
  int n, i, a, b;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    if (a == b) {
      if (a % 2 != 0)
        printf("Case %d: %d\n", i, a);
      else
        printf("Case %d: 0\n", i);
    } else {
      if (a % 2 == 0)
        a++;
      if (b % 2 == 0)
        b--;
      printf("Case %d: %d\n", i, ((b - a) / 2 + 1) * (a + b) / 2);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     123b <main+0x11b>
lea    0xea5(%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
jne    11b9 <main+0x99>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11a3 <main+0x83>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x94>
mov    -0xc(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1228 <main+0x108>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d6 <main+0xb6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f3 <main+0xd3>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122d <main+0x10d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecd(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    1207 <main+0xe7>
lea    0xead(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0xeae(%rip),%r12
lea    0xe9a(%rip),%r13
xor    %ebp,%ebp
jmp    11a2 <main+0x82>
nop
mov    %eax,%ecx
sub    %edx,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
add    $0x1,%esi
add    %eax,%edx
imul   %esi,%edx
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
mov    %r13,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x14(%rsp),%ebp
jge    1207 <main+0xe7>
add    $0x1,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%eax
cmp    %eax,%edx
jne    11e0 <main+0xc0>
test   $0x1,%dl
jne    1200 <main+0xe0>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x14(%rsp),%ebp
jl     11a2 <main+0x82>
jmp    1207 <main+0xe7>
nopw   0x0(%rax,%rax,1)
test   $0x1,%dl
jne    11ec <main+0xcc>
add    $0x1,%edx
mov    %edx,0x10(%rsp)
test   $0x1,%al
jne    1170 <main+0x50>
add    $0xffffffff,%eax
mov    %eax,0xc(%rsp)
jmp    1170 <main+0x50>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %ebp,%esi
jmp    1195 <main+0x75>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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