#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 temp = 1;
  int a = 1, b = 1;
  printf("Please input two numbers,and seprated with ','\n");
  scanf("%d,%d", &num1, &num2);
  if (num1 < num2) {
    temp = num1;
    num1 = num2;
    num2 = temp;
  }
  a = num1, b = num2;
  while (b != 0) {
    temp = a % b;
    a = b;
    b = temp;
  }
  printf("The max divisor is:%d\n", a);
  printf("The min multiple is %d\n", num1 * num2 / a);
}


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    0xed0(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118b <main+0x6b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11bc <main+0x9c>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <main+0x77>
mov    -0x10(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,%esi
lea    0xe6c(%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    0xee9(%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),%ecx
mov    0x8(%rsp),%eax
cmp    %eax,%ecx
jge    1183 <main+0x53>
mov    %eax,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ecx,%edx
test   %edx,%edx
jne    1190 <main+0x60>
jmp    119d <main+0x6d>
mov    %eax,%edx
mov    %ecx,%eax
test   %edx,%edx
je     119d <main+0x6d>
nopl   0x0(%rax,%rax,1)
mov    %edx,%ebx
cltd
idiv   %ebx
mov    %ebx,%eax
test   %edx,%edx
jne    1190 <main+0x60>
jmp    119f <main+0x6f>
mov    %eax,%ebx
lea    0xe60(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
imul   0xc(%rsp),%eax
cltd
idiv   %ebx
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Please input two numbers,and seprated with ','\0A\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [23 x i8] c"The max divisor is:%d\0A\00"
@.str.3 = [24 x i8] c"The min multiple is %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = 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
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = load i32, i32* %1
store i32 %12, i32* %3
%13 = load i32, i32* %2
store i32 %13, i32* %1
%14 = load i32, i32* %3
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %0
%16 = load i32, i32* %1
store i32 %16, i32* %4
%17 = load i32, i32* %2
store i32 %17, i32* %5
br label %18
18: ; preds = %21, %15
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = srem i32 %22, %23
store i32 %24, i32* %3
%25 = load i32, i32* %5
store i32 %25, i32* %4
%26 = load i32, i32* %3
store i32 %26, i32* %5
br label %18
27: ; preds = %18
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %1
%31 = load i32, i32* %2
%32 = mul nsw i32 %30, %31
%33 = load i32, i32* %4
%34 = sdiv i32 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %34)
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [23 x i8] c"The max divisor is:%d\0A\00"
@.str.3 = [24 x i8] c"The min multiple is %d\0A\00"
@str = [47 x i8] c"Please input two numbers,and seprated with ','\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 ([47 x i8], [47 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 slt i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 %8, i32* %1
store i32 %7, i32* %2
br label %11
11: ; preds = %10, %0
%12 = phi i32 [ %7, %10 ], [ %8, %0 ]
%13 = phi i32 [ %8, %10 ], [ %7, %0 ]
%14 = icmp eq i32 %12, 0
br i1 %14, label %20, label %15
15: ; preds = %11, %15
%16 = phi i32 [ %18, %15 ], [ %12, %11 ]
%17 = phi i32 [ %16, %15 ], [ %13, %11 ]
%18 = srem i32 %17, %16
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %15
20: ; preds = %15, %11
%21 = phi i32 [ %13, %11 ], [ %16, %15 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = mul nsw i32 %24, %23
%26 = sdiv i32 %25, %21
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %26)
ret void
}