#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 m, n, orig_m, orig_n, t;
  printf("输入m,n的值(格式m,n)\n");
  scanf("%d,%d", &m, &n);
  orig_n = n, orig_m = m;
  if (m < n) {
    m = orig_n;
    n = orig_m;
  }
  while (0 != m % n) {
    t = m % n;
    m = n;
    n = t;
  }
  printf("%d与%d的最大公约数是%d，最小公倍数是%d", orig_m, orig_n, n,
         orig_m * orig_n / n);
  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    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1175 <main+0x55>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117a <main+0x5a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
je     11a6 <main+0x86>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117a <main+0x5a>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x1c(%rbp),%edx
mov    %eax,%r8d
lea    0xe58(%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    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    (%rsp),%r8d
mov    0x4(%rsp),%esi
mov    %r8d,%ecx
mov    %esi,%eax
cmp    %r8d,%esi
jge    1170 <main+0x40>
mov    %r8d,0x4(%rsp)
mov    %esi,(%rsp)
mov    %esi,%ecx
mov    %r8d,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1194 <main+0x64>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edi
mov    %edx,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1180 <main+0x50>
mov    %edi,0x4(%rsp)
mov    %ecx,(%rsp)
mov    %esi,%eax
imul   %r8d,%eax
cltd
idiv   %ecx
lea    0xe62(%rip),%rdi
mov    %r8d,%edx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\E8\BE\93\E5\85\A5m,n\E7\9A\84\E5\80\BC(\E6\A0\BC\E5\BC\8Fm,n)\0A\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [54 x i8] c"%d\E4\B8\8E%d\E7\9A\84\E6\9C\80\E5\A4\A7\E5\85\AC\E7\BA\A6\E6\95\B0\E6\98\AF%d\EF\BC\8C\E6\9C\80\E5\B0\8F\E5\85\AC\E5\80\8D\E6\95\B0\E6\98\AF%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 ([28 x i8], [28 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* %3
store i32 %9, i32* %5
%10 = load i32, i32* %2
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i32, i32* %5
store i32 %15, i32* %2
%16 = load i32, i32* %4
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %0
br label %18
18: ; preds = %23, %17
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = srem i32 %19, %20
%22 = icmp ne i32 0, %21
br i1 %22, label %23, label %29
23: ; preds = %18
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = srem i32 %24, %25
store i32 %26, i32* %6
%27 = load i32, i32* %3
store i32 %27, i32* %2
%28 = load i32, i32* %6
store i32 %28, i32* %3
br label %18
29: ; preds = %18
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %3
%37 = sdiv i32 %35, %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31, i32 %32, i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [54 x i8] c"%d\E4\B8\8E%d\E7\9A\84\E6\9C\80\E5\A4\A7\E5\85\AC\E7\BA\A6\E6\95\B0\E6\98\AF%d\EF\BC\8C\E6\9C\80\E5\B0\8F\E5\85\AC\E5\80\8D\E6\95\B0\E6\98\AF%d\00"
@str = [27 x i8] c"\E8\BE\93\E5\85\A5m,n\E7\9A\84\E5\80\BC(\E6\A0\BC\E5\BC\8Fm,n)\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 ([27 x i8], [27 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* %2
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, %7
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 %7, i32* %1
store i32 %8, i32* %2
br label %11
11: ; preds = %10, %0
%12 = phi i32 [ %8, %10 ], [ %7, %0 ]
%13 = phi i32 [ %7, %10 ], [ %8, %0 ]
%14 = srem i32 %13, %12
%15 = icmp eq i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %11, %16
%17 = phi i32 [ %19, %16 ], [ %14, %11 ]
%18 = phi i32 [ %17, %16 ], [ %12, %11 ]
%19 = srem i32 %18, %17
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %16
21: ; preds = %16
store i32 %18, i32* %1
store i32 %17, i32* %2
br label %22
22: ; preds = %21, %11
%23 = phi i32 [ %17, %21 ], [ %12, %11 ]
%24 = mul nsw i32 %8, %7
%25 = sdiv i32 %24, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %7, i32 %23, i32 %25)
ret i32 0
}