#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 gcd(int, int);
int lcm(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a <= 0 || b <= 0)
    printf("invalid\n");
  else
    printf("%d %d\n", gcd(a, b), lcm(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1177 <main+0x37>
cmpl   $0x0,-0xc(%rbp)
jg     118a <main+0x4a>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <main+0x76>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <gcd@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <lcm@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    11a3 <main+0x53>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    11a3 <main+0x53>
call   1070 <gcd@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <lcm@plt>
lea    0xe6f(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11af <main+0x5f>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
@str = [8 x i8] c"invalid\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %19
13: ; preds = %0
%14 = call i32 @gcd(i32 %6, i32 %8)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @lcm(i32 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %17)
br label %19
19: ; preds = %13, %11
ret i32 0
}