#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*/ computeNumCallFibo(long long, int);
int /*<<< orphan*/ printf(char *, int, long long, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, long long *, int *);
int main(void) {
  int caseId, mod;
  long long int n;
  caseId = 1;
  while (1) {
    scanf("%lld %d", &n, &mod);
    if (n == 0 && mod == 0)
      break;
    printf("Case %d: %lld %d %d\n", caseId, n, mod, computeNumCallFibo(n, mod));
    caseId++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    1174 <main+0x44>
cmpl   $0x0,-0xc(%rbp)
jne    1174 <main+0x44>
jmp    11bb <main+0x8b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <computeNumCallFibo@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    %eax,%r8d
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%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    0xebb(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rbx
mov    0xc(%rsp),%r14d
test   %rbx,%rbx
jne    1168 <main+0x38>
test   %r14d,%r14d
je     11c7 <main+0x97>
mov    $0x1,%ebp
lea    0xe8c(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <computeNumCallFibo@plt>
lea    0xe76(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
add    $0x1,%ebp
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rbx
mov    0xc(%rsp),%r14d
test   %rbx,%rbx
jne    1180 <main+0x50>
test   %r14d,%r14d
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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