#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, r, p, temp;
  printf("请输入m,n两个数：");
  scanf("%d,%d", &m, &n);
  p = m * n;
  if (n < m) {
    temp = m;
    m = n;
    n = temp;
  }
  while (m != 0) {
    r = n % m;
    n = m;
    m = r;
  }
  printf("他们的最大公约数为%d\n", n);
  printf("他们的最小公倍数为%d\n", p / 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    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1179 <main+0x59>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117e <main+0x5e>
cmpl   $0x0,-0x8(%rbp)
je     11a3 <main+0x83>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%ebx
mov    %ebx,%esi
mov    %ecx,%edx
cmp    %ecx,%ebx
jge    1165 <main+0x45>
mov    %ebx,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ecx,%esi
mov    %ebx,%edx
test   %edx,%edx
je     1187 <main+0x67>
nopl   0x0(%rax)
mov    %esi,%eax
mov    %edx,%esi
cltd
idiv   %esi
test   %edx,%edx
jne    1170 <main+0x50>
mov    %esi,0x8(%rsp)
movl   $0x0,0xc(%rsp)
imul   %ecx,%ebx
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
cltd
idivl  0x8(%rsp)
lea    0xe98(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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