#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 /*<<< orphan*/, int);
int scanf(char *, int *, int *);
int main() {
  int x, y, i = 1;
  while (scanf("%d %d", &x, &y) == 2)
    printf("Case %d: %d\n", i++,
           (x = 11679 * x - 11680 * y) < 0
               ? (x + (x / -250755 + 1) * 250755) % 250755
               : x % 250755);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11d1 <main+0xb1>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
imul   $0x2d9f,-0x8(%rbp),%eax
imul   $0x2da0,-0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xfffc2c7d,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    $0x1,%ecx
imul   $0x3d383,%ecx,%ecx
add    %ecx,%eax
mov    $0x3d383,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
jmp    11ba <main+0x9a>
mov    -0x8(%rbp),%eax
mov    $0x3d383,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11dc <main+0xbc>
mov    $0x1,%ebx
lea    0xeae(%rip),%r14
lea    0xea1(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%r13
jmp    11a5 <main+0x85>
nopl   0x0(%rax,%rax,1)
mov    %edx,%eax
imul   $0x42e82467,%rax,%rax
shr    $0x30,%rax
imul   $0x3d383,%eax,%eax
sub    %eax,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <scanf@plt>
add    $0x1,%ebx
cmp    $0x2,%eax
jne    11dc <main+0xbc>
imul   $0x2d9f,0x8(%rsp),%eax
imul   $0xffffd260,0xc(%rsp),%edx
ff
add    %eax,%edx
mov    %edx,0x8(%rsp)
jns    1170 <main+0x50>
mov    %edx,%eax
neg    %eax
imul   $0x42e82467,%rax,%rax
shr    $0x30,%rax
imul   $0x3d383,%eax,%eax
add    %eax,%edx
add    $0x3d383,%edx
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [13 x i8] c"Case %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
br label %5
5: ; preds = %28, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %31
8: ; preds = %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = mul nsw i32 11679, %11
%13 = load i32, i32* %3
%14 = mul nsw i32 11680, %13
%15 = sub nsw i32 %12, %14
store i32 %15, i32* %2
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %8
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = sdiv i32 %19, -250755
%21 = add nsw i32 %20, 1
%22 = mul nsw i32 %21, 250755
%23 = add nsw i32 %18, %22
%24 = srem i32 %23, 250755
br label %28
25: ; preds = %8
%26 = load i32, i32* %2
%27 = srem i32 %26, 250755
br label %28
28: ; preds = %25, %17
%29 = phi i32 [ %24, %17 ], [ %27, %25 ]
%30 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %29)
br label %5
31: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [13 x i8] c"Case %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %26
7: ; preds = %0, %20
%8 = phi i32 [ %9, %20 ], [ 1, %0 ]
%9 = add nuw nsw i32 %8, 1
%10 = load i32, i32* %1
%11 = mul nsw i32 %10, 11679
%12 = load i32, i32* %2
%13 = mul i32 %12, -11680
%14 = add i32 %13, %11
store i32 %14, i32* %1
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %7
%17 = sub i32 0, %14
%18 = urem i32 %17, 250755
%19 = sub nuw nsw i32 250755, %18
br label %20
20: ; preds = %7, %16
%21 = phi i32 [ %19, %16 ], [ %14, %7 ]
%22 = urem i32 %21, 250755
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %22)
%24 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%25 = icmp eq i32 %24, 2
br i1 %25, label %7, label %26
26: ; preds = %20, %0
ret i32 0
}