#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 *);
int main() {
  int n, m, t, a, b;
  printf("Input two integers: ");
  scanf("%d %d", &m, &n);
  a = m;
  b = n;
  while (m != 0) {
    t = n % m;
    n = m;
    m = t;
  }
  printf("LCM is %d, GCD is %d", a * b / n, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1182 <main+0x62>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x3d>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
mov    -0x8(%rbp),%edx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1040 <scanf@plt>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
mov    %esi,%ecx
test   %edi,%edi
je     1176 <main+0x56>
mov    %edi,%edx
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
mov    %edx,%ecx
cltd
idiv   %ecx
test   %edx,%edx
jne    1160 <main+0x40>
mov    %ecx,0x4(%rsp)
movl   $0x0,(%rsp)
imul   %edi,%esi
mov    %esi,%eax
cltd
idiv   %ecx
lea    0xe96(%rip),%rdi
mov    %eax,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"Input two integers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [21 x i8] c"LCM is %d, GCD is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %1)
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = icmp eq i32 %7, 0
br i1 %9, label %16, label %10
10: ; preds = %0, %10
%11 = phi i32 [ %13, %10 ], [ %7, %0 ]
%12 = phi i32 [ %11, %10 ], [ %8, %0 ]
%13 = srem i32 %12, %11
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10
store i32 %11, i32* %1
store i32 0, i32* %2
br label %16
16: ; preds = %15, %0
%17 = phi i32 [ %11, %15 ], [ %8, %0 ]
%18 = mul nsw i32 %8, %7
%19 = sdiv i32 %18, %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %17)
ret i32 0
}