#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*/ scanf(char *, int *, ...);
int manasastones(void) {
  int numTestCases;
  scanf("%d", &numTestCases);
  while (numTestCases--) {
    int numStones;
    int stepSize1, stepSize2;
    scanf("%d", &numStones);
    scanf("%d %d", &stepSize1, &stepSize2);
    if (stepSize1 > stepSize2) {
      int temp = stepSize1;
      stepSize1 = stepSize2;
      stepSize2 = temp;
    }
    int stepDifference = stepSize2 - stepSize1;
    int currentFinalValue = stepSize1 * (numStones - 1);
    int largestFinalValue = currentFinalValue + stepDifference * numStones;
    do {
      printf("%d ", currentFinalValue);
      currentFinalValue += stepDifference;
    } while (currentFinalValue < largestFinalValue);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<manasastones>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     11f4 <manasastones+0xd4>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe99(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1194 <manasastones+0x74>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     11bb <manasastones+0x9b>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113a <manasastones+0x1a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manasastones>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0x10(%rsp)
jb     120a <manasastones+0xda>
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xe99(%rip),%rbp
nopl   (%rax)
lea    0xe8c(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe76(%rip),%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%r15d
mov    0x8(%rsp),%ecx
cmp    %ecx,%r15d
jle    11c0 <manasastones+0x90>
mov    %ecx,0xc(%rsp)
mov    %r15d,0x8(%rsp)
mov    %ecx,%eax
jmp    11c6 <manasastones+0x96>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%eax
mov    %ecx,%r15d
sub    %eax,%r15d
mov    0x14(%rsp),%r12d
lea    -0x1(%r12),%r14d
imul   %eax,%r14d
imul   %r15d,%r12d
add    %r14d,%r12d
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %r15d,%r14d
cmp    %r12d,%r14d
jl     11e0 <manasastones+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0x10(%rsp)
jae    1170 <manasastones+0x40>
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 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @manasastones() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %10
10: ; preds = %47, %0
%11 = load i32, i32* %1
%12 = add nsw i32 %11, -1
store i32 %12, i32* %1
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %49
14: ; preds = %10
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load i32, i32* %3
store i32 %21, i32* %5
%22 = load i32, i32* %4
store i32 %22, i32* %3
%23 = load i32, i32* %5
store i32 %23, i32* %4
br label %24
24: ; preds = %20, %14
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = sub nsw i32 %25, %26
store i32 %27, i32* %6
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 1
%31 = mul nsw i32 %28, %30
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = load i32, i32* %6
%34 = load i32, i32* %2
%35 = mul nsw i32 %33, %34
%36 = add nsw i32 %32, %35
store i32 %36, i32* %8
br label %37
37: ; preds = %43, %24
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = add nsw i32 %41, %40
store i32 %42, i32* %7
br label %43
43: ; preds = %37
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = icmp slt i32 %44, %45
br i1 %46, label %37, label %47
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %10
49: ; preds = %10
ret i32 0
}

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