#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int n;
  int i;
  printf("输入一个整数：");
  scanf("%d", &n);
  printf("%d=", n);
  for (i = 2; i <= n; i++) {
    while (n != i) {
      if (n % i == 0) {
        printf("%d*", i);
        n = n / i;
      } else
        break;
    }
  }
  printf("%d\n", n);
  getchar();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11d8 <main+0xa8>
jmp    117f <main+0x4f>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11c5 <main+0x95>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    11bb <main+0x8b>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    11c0 <main+0x90>
jmp    11c5 <main+0x95>
jmp    117f <main+0x4f>
jmp    11ca <main+0x9a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x3e>
mov    -0x4(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x2,%esi
jge    1192 <main+0x62>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x2,%ebx
lea    0xe7f(%rip),%r14
jmp    11a9 <main+0x79>
lea    0x1(%rbx),%eax
cmp    %esi,%ebx
mov    %eax,%ebx
jge    116e <main+0x3e>
cmp    %ebx,%esi
je     11a0 <main+0x70>
nopl   (%rax)
mov    %esi,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    11a0 <main+0x70>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cltd
idiv   %ebx
mov    %eax,%esi
mov    %eax,0x4(%rsp)
cmp    %ebx,%eax
jne    11b0 <main+0x80>
mov    %ebx,%esi
jmp    11a0 <main+0x70>

LLVM IR (-O0):
@.str = [22 x i8] c"\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B4\E6\95\B0\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d=\00"
@.str.3 = [4 x i8] c"%d*\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %5)
store i32 2, i32* %2
br label %7
7: ; preds = %30, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %33
11: ; preds = %7
br label %12
12: ; preds = %28, %11
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = srem i32 %17, %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = sdiv i32 %24, %25
store i32 %26, i32* %1
br label %28
27: ; preds = %16
br label %29
28: ; preds = %21
br label %12
29: ; preds = %27, %12
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %7
33: ; preds = %7
%34 = load i32, i32* %1
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = call i32 (...) @getchar()
%37 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B4\E6\95\B0\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d=\00"
@.str.3 = [4 x i8] c"%d*\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 2
br i1 %8, label %26, label %9
9: ; preds = %0, %22
%10 = phi i32 [ %23, %22 ], [ %7, %0 ]
%11 = phi i32 [ %24, %22 ], [ 2, %0 ]
%12 = icmp eq i32 %10, %11
br i1 %12, label %22, label %13
13: ; preds = %9, %17
%14 = phi i32 [ %20, %17 ], [ %10, %9 ]
%15 = srem i32 %14, %11
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%19 = load i32, i32* %1
%20 = sdiv i32 %19, %11
store i32 %20, i32* %1
%21 = icmp eq i32 %20, %11
br i1 %21, label %22, label %13
22: ; preds = %13, %17, %9
%23 = phi i32 [ %10, %9 ], [ %14, %13 ], [ %11, %17 ]
%24 = add nuw nsw i32 %11, 1
%25 = icmp slt i32 %11, %23
br i1 %25, label %9, label %26
26: ; preds = %22, %0
%27 = phi i32 [ %7, %0 ], [ %23, %22 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = call i32 (...) @getchar()
%30 = call i32 (...) @getchar()
ret void
}