#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 *, long);
int /*<<< orphan*/ scanf(char *, long long *);
long long sqrt(long long);
int main() {
  long long n, sqrtn;
  long i, tmp;
  scanf("%lld", &n);
  sqrtn = sqrt(n);
  for (i = 2; i <= sqrtn && n > 1; i++)
    while (n % i == 0) {
      n /= i;
      tmp = i;
    }
  printf("%lld\n", (n == 1) ? tmp : n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <sqrt@plt>
mov    %rax,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x29(%rbp)
jg     1182 <main+0x52>
cmpq   $0x1,-0x10(%rbp)
setg   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1192 <main+0x62>
jmp    11df <main+0xaf>
jmp    1197 <main+0x67>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    11c9 <main+0x99>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1197 <main+0x67>
jmp    11ce <main+0x9e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1164 <main+0x34>
cmpq   $0x1,-0x10(%rbp)
jne    11f7 <main+0xc7>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    11ff <main+0xcf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rdi
call   1050 <sqrt@plt>
mov    (%rsp),%rcx
cmp    $0x2,%rax
jl     121d <main+0xed>
cmp    $0x2,%rcx
jl     121d <main+0xed>
mov    %rax,%r8
mov    $0x2,%edi
nopl   0x0(%rax)
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1190 <main+0x60>
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
jne    119b <main+0x6b>
jmp    11bb <main+0x8b>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
je     11bb <main+0x8b>
cmp    %r8,%rdi
jl     120d <main+0xdd>
jmp    121d <main+0xed>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
jne    1201 <main+0xd1>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     11e0 <main+0xb0>
mov    %rcx,%rax
cqto
idiv   %rdi
mov    %rax,%rcx
jmp    11e8 <main+0xb8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
mov    %eax,%ecx
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     11b0 <main+0x80>
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
je     11bb <main+0x8b>
mov    %rcx,(%rsp)
mov    %rdi,%rsi
cmp    %r8,%rdi
jge    121d <main+0xed>
add    $0x1,%rdi
cmp    $0x1,%rcx
jg     1170 <main+0x40>
jmp    121d <main+0xed>
cmp    $0x1,%rcx
cmovne %rcx,%rsi
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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