#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*/ draw(int);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ stdout;
int main(void) {
  freopen("out", "w", stdout);
  int n, i;
  int a, f;
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &a, &f);
    for (i = 1; i <= f; ++i) {
      draw(a);
      if (n == 0 && i == f)
        return 0;
      putchar('\n');
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1201 <main+0xc1>
lea    0xe6e(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11fc <main+0xbc>
mov    -0x10(%rbp),%edi
call   1040 <draw@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11e4 <main+0xa4>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11e4 <main+0xa4>
movl   $0x0,-0x4(%rbp)
jmp    1208 <main+0xc8>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ae <main+0x6e>
jmp    117d <main+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
lea    0xea6(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe9b(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0x10(%rsp)
jb     11f9 <main+0xb9>
lea    0xe7f(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xc(%rsp),%rbx
jmp    11a7 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
subl   $0x1,0x10(%rsp)
jb     11f9 <main+0xb9>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <main+0x60>
xor    %ebp,%ebp
jmp    11e0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    0xc(%rsp),%ebp
jge    11a0 <main+0x60>
add    $0x1,%ebp
mov    0x14(%rsp),%edi
call   1040 <draw@plt>
cmpl   $0x0,0x10(%rsp)
jne    11d0 <main+0x90>
cmp    0xc(%rsp),%ebp
jne    11d0 <main+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"out\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"%d%d\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 = load i32, i32* @stdout
%7 = call i32 @freopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %34, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
store i32 1, i32* %3
br label %15
15: ; preds = %31, %13
%16 = load i32, i32* %3
%17 = load i32, i32* %5
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32, i32* %4
%21 = call i32 @draw(i32 %20)
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %1
br label %36
29: ; preds = %24, %19
%30 = call i32 @putchar(i8 signext 10)
br label %31
31: ; preds = %29
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %15
34: ; preds = %15
br label %9
35: ; preds = %9
store i32 0, i32* %1
br label %36
36: ; preds = %35, %28
%37 = load i32, i32* %1
ret i32 %37
}

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