#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 a, b;
  printf("Enter two numbers: \n");
  scanf("%d %d", &a, &b);
  int i, max, maxBack;
  max = (a > b) ? a : b;
  maxBack = max;
  while ((max % a != 0) || (max % b != 0)) {
    max += maxBack;
  }
  printf("LCM is %d", max);
  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    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1168 <main+0x48>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    116e <main+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x1d(%rbp)
jne    119f <main+0x7f>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11af <main+0x8f>
jmp    11bd <main+0x9d>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    117a <main+0x5a>
mov    -0x14(%rbp),%esi
lea    0xe54(%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
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%r8d
cmp    %r8d,%ecx
mov    %r8d,%edi
cmovg  %ecx,%edi
mov    %edi,%esi
jmp    1172 <main+0x42>
cs nopw 0x0(%rax,%rax,1)
add    %edi,%esi
mov    %esi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1170 <main+0x40>
mov    %esi,%eax
cltd
idiv   %r8d
test   %edx,%edx
jne    1170 <main+0x40>
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter two numbers: \0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [10 x i8] c"LCM 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* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = load i32, i32* %2
br label %16
14: ; preds = %0
%15 = load i32, i32* %3
br label %16
16: ; preds = %14, %12
%17 = phi i32 [ %13, %12 ], [ %15, %14 ]
store i32 %17, i32* %5
%18 = load i32, i32* %5
store i32 %18, i32* %6
br label %19
19: ; preds = %31, %16
%20 = load i32, i32* %5
%21 = load i32, i32* %2
%22 = srem i32 %20, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %19
%25 = load i32, i32* %5
%26 = load i32, i32* %3
%27 = srem i32 %25, %26
%28 = icmp ne i32 %27, 0
br label %29
29: ; preds = %24, %19
%30 = phi i1 [ true, %19 ], [ %28, %24 ]
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = load i32, i32* %6
%33 = load i32, i32* %5
%34 = add nsw i32 %33, %32
store i32 %34, i32* %5
br label %19
35: ; preds = %29
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %36)
ret i32 0
}

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