#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*/ putchar(char);
int scanf(char *, ...);
int main() {
  int num_cases;
  char line[256], ch;
  int repeat, i;
  scanf("%d\n", &num_cases);
  for (i = 1; i <= num_cases; i++) {
    printf("Case %d: ", i);
    while (scanf("%c%d", &ch, &repeat) == 2) {
      while (repeat-- > 0) {
        putchar(ch);
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11fd <main+0xcd>
mov    -0x11c(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0x111(%rbp),%rsi
lea    -0x118(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11db <main+0xab>
jmp    11ab <main+0x7b>
mov    -0x118(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x118(%rbp)
cmp    $0x0,%eax
jle    11d6 <main+0xa6>
movsbl -0x111(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ab <main+0x7b>
jmp    1181 <main+0x51>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11eb <main+0xbb>
mov    $0x1,%r15d
lea    0xe9c(%rip),%r14
lea    0xe9f(%rip),%r12
lea    0x7(%rsp),%r13
lea    0x8(%rsp),%rbx
jmp    1198 <main+0x68>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jge    11eb <main+0xbb>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jle    11b0 <main+0x80>
movsbl 0x7(%rsp),%edi
call   1030 <putchar@plt>
jmp    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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