#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);
int /*<<< orphan*/ scanf(char *, int *, int *);
void main() {
  int num0, num1;
  int r;
  scanf("%d%d", &num0, &num1);
  int lcm = num0 * num1;
  int tmp;
  while (num0 % num1 != 0) {
    tmp = num0 % num1;
    num0 = num1;
    num1 = tmp;
  }
  lcm /= num1;
  printf("gcd = %d\n", num1);
  printf("lcm = %d\n", lcm);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     1171 <main+0x51>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%edi
mov    %r8d,%eax
cltd
idiv   %edi
mov    %edi,%esi
test   %edx,%edx
je     1175 <main+0x55>
mov    %edi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %esi,%ecx
mov    %edx,%esi
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1160 <main+0x40>
mov    %ecx,0xc(%rsp)
mov    %esi,0x8(%rsp)
imul   %r8d,%edi
mov    %edi,%eax
cltd
idiv   %esi
mov    %eax,%ebx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [10 x i8] c"gcd = %d\0A\00"
@.str.2 = [10 x i8] c"lcm = %d\0A\00"
define void @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 = load i32, i32* %2
%8 = srem i32 %6, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %0, %10
%11 = phi i32 [ %13, %10 ], [ %8, %0 ]
%12 = phi i32 [ %11, %10 ], [ %7, %0 ]
%13 = srem i32 %12, %11
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10
store i32 %12, i32* %1
store i32 %11, i32* %2
br label %16
16: ; preds = %15, %0
%17 = phi i32 [ %11, %15 ], [ %7, %0 ]
%18 = mul nsw i32 %7, %6
%19 = sdiv i32 %18, %17
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret void
}