#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_s(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int i, num1, num2, LCM = 0, max;
  printf("Enter first number : ");
  scanf_s("%d", &num1);
  printf("Enter second number : ");
  scanf_s("%d", &num2);
  if (num1 > num2) {
    max = num1;
  } else {
    max = num2;
  }
  i = max;
  while (1) {
    if (i % num1 == 0 && i % num2 == 0) {
      LCM = i;
      break;
    }
    i = i + max;
  }
  printf("\n");
  printf("LCM (%d, %d) = %d", num1, num2, LCM);
  printf("\n");
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf_s@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf_s@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1199 <main+0x69>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x6f>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11d0 <main+0xa0>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11d0 <main+0xa0>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11de <main+0xae>
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x75>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe29(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf_s@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf_s@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%esi
cmp    %esi,%ecx
mov    %esi,%edi
cmovg  %ecx,%edi
mov    %edi,%ebx
jmp    11a2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nop
add    %edi,%ebx
mov    %ebx,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    11a0 <main+0x60>
mov    %ebx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe60(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe58(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"Enter first number : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter second number : \00"
@.str.4 = [18 x i8] c"LCM (%d, %d) = %d\00"
@.str.5 = [6 x i8] c"pause\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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i32 %9, i32 %10
br label %13
13: ; preds = %27, %0
%14 = phi i32 [ %12, %0 ], [ %28, %27 ]
%15 = srem i32 %14, %9
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = srem i32 %14, %10
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = call i32 @putchar(i32 10)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 %23, i32 %14)
%25 = call i32 @putchar(i32 10)
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
27: ; preds = %17, %13
%28 = add nsw i32 %14, %12
br label %13
}