#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 *, unsigned long *);
int main() {
  unsigned long N, i;
  printf("Input\n");
  scanf("%lu", &N);
  i = 2;
  while (N > 1) {
    if ((N % i) == 0) {
      printf("%lu%c", i, N > i ? '*' : '\n');
      N /= i;
      continue;
    }
    i++;
  }
  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    0xec3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x2,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jbe    11c7 <main+0xa7>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    11b6 <main+0x96>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdi
mov    $0xa,%edx
mov    $0x2a,%eax
cmp    %rdi,%rcx
cmova  %eax,%edx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
jmp    1155 <main+0x35>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1155 <main+0x35>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rcx
cmp    $0x2,%rcx
jb     11e1 <main+0xb1>
mov    $0x2,%ebx
lea    0xe9b(%rip),%r14
jmp    1182 <main+0x52>
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %rbx
mov    %rax,%rcx
mov    %rcx,(%rsp)
cmp    $0x1,%rcx
jbe    11e1 <main+0xb1>
mov    %rcx,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     11d0 <main+0xa0>
mov    %rcx,%rax
xor    %edx,%edx
div    %rbx
test   %rdx,%rdx
jne    11db <main+0xab>
xor    %edx,%edx
cmp    %rbx,%rcx
seta   %dl
shl    $0x5,%edx
or     $0xa,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
jne    1170 <main+0x40>
xor    %edx,%edx
div    %ebx
mov    %eax,%ecx
jmp    1178 <main+0x48>
xchg   %ax,%ax
mov    %ecx,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     119b <main+0x6b>
add    $0x1,%rbx
jmp    1182 <main+0x52>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Input\0A\00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [6 x i8] c"%lu%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
store i64 2, i64* %3
br label %6
6: ; preds = %25, %14, %0
%7 = load i64, i64* %2
%8 = icmp ugt i64 %7, 1
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i64, i64* %2
%11 = load i64, i64* %3
%12 = urem i64 %10, %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %9
%15 = load i64, i64* %3
%16 = load i64, i64* %2
%17 = load i64, i64* %3
%18 = icmp ugt i64 %16, %17
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 42, i32 10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %15, i32 %20)
%22 = load i64, i64* %3
%23 = load i64, i64* %2
%24 = udiv i64 %23, %22
store i64 %24, i64* %2
br label %6
25: ; preds = %9
%26 = load i64, i64* %3
%27 = add i64 %26, 1
store i64 %27, i64* %3
br label %6
28: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [6 x i8] c"%lu%c\00"
@str = [6 x i8] c"Input\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = icmp ugt i64 %5, 1
br i1 %6, label %7, label %23
7: ; preds = %0, %21
%8 = phi i64 [ %11, %21 ], [ %5, %0 ]
%9 = phi i64 [ %22, %21 ], [ 2, %0 ]
br label %10
10: ; preds = %7, %14
%11 = phi i64 [ %8, %7 ], [ %19, %14 ]
%12 = urem i64 %11, %9
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = icmp ugt i64 %11, %9
%16 = select i1 %15, i32 42, i32 10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %9, i32 %16)
%18 = load i64, i64* %1
%19 = udiv i64 %18, %9
store i64 %19, i64* %1
%20 = icmp ugt i64 %19, 1
br i1 %20, label %10, label %23
21: ; preds = %10
%22 = add i64 %9, 1
br label %7
23: ; preds = %14, %0
ret i32 0
}