#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 getDivisor(int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(int argc, char const *argv[]) {
  int lines, a, b;
  scanf("%d", &lines);
  getchar();
  for (int i = 0; i < lines; i++) {
    scanf("%d %d", &a, &b);
    getchar();
    printf("%d %d\n", getDivisor(a, b), a * b / getDivisor(a, b));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e9 <main+0xa9>
lea    0xe77(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <getDivisor@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <getDivisor@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1176 <main+0x36>
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    0xeae(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmpl   $0x0,0x14(%rsp)
jle    11ea <main+0xaa>
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xe86(%rip),%r13
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe69(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1030 <getDivisor@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <getDivisor@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %r13,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%r14d
cmp    0x14(%rsp),%r14d
jl     1190 <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 = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%11 = call i32 (...) @getchar()
store i32 0, i32* %9
br label %12
12: ; preds = %30, %2
%13 = load i32, i32* %9
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
%18 = call i32 (...) @getchar()
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = call i32 @getDivisor(i32 %19, i32 %20)
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = call i32 @getDivisor(i32 %25, i32 %26)
%28 = sdiv i32 %24, %27
%29 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %28)
br label %30
30: ; preds = %16
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %12
33: ; preds = %12
ret i32 0
}

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