#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 */
unsigned long long lcm(unsigned long long, unsigned long long);
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *, unsigned long long *);
int main() {
  unsigned long long int w, h;
  unsigned long long int num;
  while (1) {
    scanf("%llu%llu", &w, &h);
    if (w == 0 && h == 0)
      break;
    num = lcm(w, h);
    printf("%llu\n", ((num / h) * (num / w)));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    116e <main+0x3e>
cmpq   $0x0,-0x18(%rbp)
jne    116e <main+0x3e>
jmp    11af <main+0x7f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <lcm@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rax,%rsi
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
imul   %rax,%rsi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %rdi,%rax
or     %rsi,%rax
jne    1171 <main+0x41>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe91(%rip),%r14
lea    0xe81(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%rbx
jmp    11c7 <main+0x97>
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
imul   %rsi,%rax
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %rdi,%rax
or     %rsi,%rax
je     1163 <main+0x33>
call   1040 <lcm@plt>
mov    %rax,%rcx
mov    0x8(%rsp),%rsi
or     %rsi,%rax
shr    $0x20,%rax
je     11f0 <main+0xc0>
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
mov    %rax,%rsi
jmp    11f8 <main+0xc8>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
mov    %eax,%esi
mov    0x10(%rsp),%rdi
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
jne    1190 <main+0x60>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
jmp    1198 <main+0x68>

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

LLVM IR (-O2):
@.str = [9 x i8] c"%llu%llu\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = load i64, i64* %1
%7 = icmp eq i64 %6, 0
%8 = load i64, i64* %2
%9 = icmp eq i64 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %27, label %11
11: ; preds = %0, %11
%12 = phi i64 [ %24, %11 ], [ %8, %0 ]
%13 = phi i64 [ %22, %11 ], [ %6, %0 ]
%14 = call i64 @lcm(i64 %13, i64 %12)
%15 = load i64, i64* %2
%16 = udiv i64 %14, %15
%17 = load i64, i64* %1
%18 = udiv i64 %14, %17
%19 = mul i64 %18, %16
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %19)
%21 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%22 = load i64, i64* %1
%23 = icmp eq i64 %22, 0
%24 = load i64, i64* %2
%25 = icmp eq i64 %24, 0
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %27, label %11
27: ; preds = %11, %0
ret i32 0
}