#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 abs(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int number = 1;
  int factor = 2;
  scanf("%d", &number);
  printf("The number you input is:%d\n", number);
  if (number < 0)
    printf("%d=-", number);
  else
    printf("%d=", number);
  number = abs(number);
  while (factor < number) {
    if (0 == number % factor) {
      printf("%d*", factor);
      number = number / factor;
    } else {
      factor++;
    }
    if (factor == number)
      break;
  }
  printf("%d\n", number);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jge    1183 <main+0x53>
mov    -0x4(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
jmp    1192 <main+0x62>
mov    -0x4(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f7 <main+0xc7>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    11d8 <main+0xa8>
mov    -0x8(%rbp),%esi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    11e1 <main+0xb1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    11f2 <main+0xc2>
jmp    11f7 <main+0xc7>
jmp    119d <main+0x6d>
mov    -0x4(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
lea    0xec5(%rip),%rax
lea    0xec3(%rip),%rdi
cmovs  %rax,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%esi
neg    %esi
cmovs  %eax,%esi
mov    %esi,0x4(%rsp)
mov    $0x2,%ebx
lea    0xea3(%rip),%r14
jmp    11ab <main+0x8b>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cltd
idiv   %ebx
mov    %eax,%esi
mov    %eax,0x4(%rsp)
cmp    %esi,%ebx
je     11bf <main+0x9f>
cmp    %esi,%ebx
jge    11bf <main+0x9f>
mov    %esi,%eax
cltd
idiv   %ebx
test   %edx,%edx
je     1190 <main+0x70>
add    $0x1,%ebx
cmp    %esi,%ebx
jne    11ab <main+0x8b>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [28 x i8] c"The number you input is:%d\0A\00"
@.str.2 = [5 x i8] c"%d=-\00"
@.str.3 = [4 x i8] c"%d=\00"
@.str.4 = [4 x i8] c"%d*\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
store i32 2, i32* %2
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %14
11: ; preds = %0
%12 = load i32, i32* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %1
%16 = call i32 @abs(i32 %15)
store i32 %16, i32* %1
br label %17
17: ; preds = %40, %14
%18 = load i32, i32* %2
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %41
21: ; preds = %17
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = srem i32 %22, %23
%25 = icmp eq i32 0, %24
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i32, i32* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = sdiv i32 %29, %30
store i32 %31, i32* %1
br label %35
32: ; preds = %21
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %35
35: ; preds = %32, %26
%36 = load i32, i32* %2
%37 = load i32, i32* %1
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %35
br label %41
40: ; preds = %35
br label %17
41: ; preds = %39, %17
%42 = load i32, i32* %1
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %42)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [28 x i8] c"The number you input is:%d\0A\00"
@.str.2 = [5 x i8] c"%d=-\00"
@.str.3 = [4 x i8] c"%d=\00"
@.str.4 = [4 x i8] c"%d*\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%9 = call i32 @printf(i8* %8, i32 %6)
%10 = load i32, i32* %1
%11 = call i32 @llvm.abs.i32(i32 %10, i1 true)
store i32 %11, i32* %1
br label %12
12: ; preds = %25, %0
%13 = phi i32 [ %11, %0 ], [ %26, %25 ]
%14 = phi i32 [ 2, %0 ], [ %27, %25 ]
%15 = icmp slt i32 %14, %13
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = srem i32 %13, %14
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%21 = load i32, i32* %1
%22 = sdiv i32 %21, %14
store i32 %22, i32* %1
br label %25
23: ; preds = %16
%24 = add nsw i32 %14, 1
br label %25
25: ; preds = %23, %19
%26 = phi i32 [ %22, %19 ], [ %13, %23 ]
%27 = phi i32 [ %14, %19 ], [ %24, %23 ]
%28 = icmp eq i32 %27, %26
br i1 %28, label %29, label %12
29: ; preds = %25, %12
%30 = phi i32 [ %26, %25 ], [ %13, %12 ]
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %30)
ret void
}