#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 *);
void main() {
  int num1 = 1, num2 = 1;
  int divisor = 1;
  int multiple = 1;
  int temp = 1;
  printf("Please input the two number:\n");
  scanf("%d,%d", &num1, &num2);
  int factor = 1;
  for (factor = 1; factor <= num1 && factor <= num2; factor++) {
    if ((0 == num1 % factor) && (0 == num2 % factor))
      divisor = factor;
  }
  if (num1 > num2) {
    factor = num1;
    num1 = num2;
    num2 = factor;
  }
  factor = num1;
  while (0 != num2 % factor) {
    temp++;
    num2 = num2 * temp;
  }
  multiple = num2;
  printf("divisor:%d\n", divisor);
  printf("multiple:%d\n", multiple);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x19(%rbp)
jg     1198 <main+0x78>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11a8 <main+0x88>
jmp    11e3 <main+0xc3>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x18(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    11d0 <main+0xb0>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    11d0 <main+0xb0>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117b <main+0x5b>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1201 <main+0xe1>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
je     1230 <main+0x110>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1207 <main+0xe7>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
movl   $0x1,0x8(%rsp)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%ecx
mov    $0x1,%esi
test   %edi,%edi
jle    11b0 <main+0x80>
test   %ecx,%ecx
jle    11b0 <main+0x80>
mov    $0x1,%ebx
mov    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    11a3 <main+0x73>
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
cmove  %ebx,%esi
cmp    %edi,%ebx
jge    11b0 <main+0x80>
lea    0x1(%rbx),%eax
cmp    %ecx,%ebx
mov    %eax,%ebx
jl     1190 <main+0x60>
cmp    %ecx,%edi
jle    11c0 <main+0x90>
mov    %ecx,0xc(%rsp)
mov    %edi,0x8(%rsp)
mov    %edi,%ebx
jmp    11c4 <main+0x94>
mov    %ecx,%ebx
mov    %edi,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     11f3 <main+0xc3>
mov    $0x2,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   %edi,%ebx
mov    %ebx,%eax
cltd
idiv   %ecx
add    $0x1,%edi
test   %edx,%edx
jne    11e0 <main+0xb0>
mov    %ebx,0x8(%rsp)
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe0a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Please input the two number:\0A\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [12 x i8] c"divisor:%d\0A\00"
@.str.3 = [13 x i8] c"multiple:%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 1, i32* %1
store i32 1, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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* %1, i32* %2)
store i32 1, i32* %6
store i32 1, i32* %6
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %1
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ false, %9 ], [ %16, %13 ]
br i1 %18, label %19, label %35
19: ; preds = %17
%20 = load i32, i32* %1
%21 = load i32, i32* %6
%22 = srem i32 %20, %21
%23 = icmp eq i32 0, %22
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load i32, i32* %2
%26 = load i32, i32* %6
%27 = srem i32 %25, %26
%28 = icmp eq i32 0, %27
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load i32, i32* %6
store i32 %30, i32* %3
br label %31
31: ; preds = %29, %24, %19
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %9
35: ; preds = %17
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = load i32, i32* %1
store i32 %40, i32* %6
%41 = load i32, i32* %2
store i32 %41, i32* %1
%42 = load i32, i32* %6
store i32 %42, i32* %2
br label %43
43: ; preds = %39, %35
%44 = load i32, i32* %1
store i32 %44, i32* %6
br label %45
45: ; preds = %50, %43
%46 = load i32, i32* %2
%47 = load i32, i32* %6
%48 = srem i32 %46, %47
%49 = icmp ne i32 0, %48
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
%53 = load i32, i32* %2
%54 = load i32, i32* %5
%55 = mul nsw i32 %53, %54
store i32 %55, i32* %2
br label %45
56: ; preds = %45
%57 = load i32, i32* %2
store i32 %57, i32* %4
%58 = load i32, i32* %3
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %4
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %60)
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [12 x i8] c"divisor:%d\0A\00"
@.str.3 = [13 x i8] c"multiple:%d\0A\00"
@str = [29 x i8] c"Please input the two number:\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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, 0
%10 = icmp sgt i32 %8, 0
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %27
12: ; preds = %0, %21
%13 = phi i32 [ %23, %21 ], [ 1, %0 ]
%14 = phi i32 [ %22, %21 ], [ 1, %0 ]
%15 = srem i32 %7, %13
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = srem i32 %8, %13
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 %13, i32 %14
br label %21
21: ; preds = %17, %12
%22 = phi i32 [ %14, %12 ], [ %20, %17 ]
%23 = add nuw nsw i32 %13, 1
%24 = icmp slt i32 %13, %7
%25 = icmp slt i32 %13, %8
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %12, label %27
27: ; preds = %21, %0
%28 = phi i32 [ 1, %0 ], [ %22, %21 ]
%29 = icmp sgt i32 %7, %8
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 %8, i32* %1
store i32 %7, i32* %2
br label %31
31: ; preds = %30, %27
%32 = phi i32 [ %7, %30 ], [ %8, %27 ]
%33 = phi i32 [ %8, %30 ], [ %7, %27 ]
%34 = srem i32 %32, %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %44, label %36
36: ; preds = %31, %36
%37 = phi i32 [ %39, %36 ], [ 1, %31 ]
%38 = phi i32 [ %40, %36 ], [ %32, %31 ]
%39 = add nuw nsw i32 %37, 1
%40 = mul nsw i32 %38, %39
%41 = srem i32 %40, %33
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %36
43: ; preds = %36
store i32 %40, i32* %2
br label %44
44: ; preds = %43, %31
%45 = phi i32 [ %40, %43 ], [ %32, %31 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %45)
ret void
}