#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(void) {
  int a, b, t1, t2, lcm, gcd;
  printf("Enter two number: ");
  scanf("%d%d", &a, &b);
  t1 = a;
  t2 = b;
  while (t1 != t2) {
    if (t1 > t2) {
      t1 = t1 - t2;
    } else {
      t2 = t2 - t1;
    }
  }
  gcd = t1;
  lcm = (a * b) / gcd;
  printf("LCM = %d, GCD = %d", lcm, gcd);
  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    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1191 <main+0x71>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1183 <main+0x63>
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    118c <main+0x6c>
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x3d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%eax
mov    %r8d,%ecx
cmp    %eax,%r8d
je     1187 <main+0x67>
mov    %r8d,%esi
mov    %eax,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %ecx,%esi
mov    %esi,%edi
cmovg  %ebx,%edi
mov    $0x0,%edx
cmovg  %ecx,%edx
sub    %edi,%ecx
sub    %edx,%esi
cmp    %ecx,%esi
jne    1170 <main+0x50>
imul   %r8d,%eax
cltd
idiv   %ecx
lea    0xe83(%rip),%rdi
mov    %eax,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"Enter two number: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [19 x i8] c"LCM = %d, GCD = %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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %7, %8
br i1 %9, label %19, label %10
10: ; preds = %0, %10
%11 = phi i32 [ %17, %10 ], [ %7, %0 ]
%12 = phi i32 [ %15, %10 ], [ %8, %0 ]
%13 = icmp sgt i32 %11, %12
%14 = select i1 %13, i32 0, i32 %11
%15 = sub nsw i32 %12, %14
%16 = select i1 %13, i32 %12, i32 0
%17 = sub nsw i32 %11, %16
%18 = icmp eq i32 %17, %15
br i1 %18, label %19, label %10
19: ; preds = %10, %0
%20 = phi i32 [ %7, %0 ], [ %15, %10 ]
%21 = mul nsw i32 %8, %7
%22 = sdiv i32 %21, %20
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %20)
ret i32 0
}