#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 betterNumber(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i;
  scanf("%d", &n);
  int betterNum = 0;
  for (i = 1; i <= n; i++) {
    if (n % i == 0)
      betterNum = betterNumber(betterNum, i);
  }
  printf("%d\n", betterNum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119a <main+0x6a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1187 <main+0x57>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <betterNumber@plt>
mov    %eax,-0x10(%rbp)
jmp    118c <main+0x5c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x2d>
mov    -0x10(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    1181 <main+0x51>
xor    %ebx,%ebx
xor    %esi,%esi
jmp    1164 <main+0x34>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %ecx,%ebx
jge    1183 <main+0x53>
add    $0x1,%ebx
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1160 <main+0x30>
mov    %esi,%edi
mov    %ebx,%esi
call   1050 <betterNumber@plt>
mov    %eax,%esi
mov    0xc(%rsp),%ecx
jmp    1160 <main+0x30>
xor    %esi,%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%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 = icmp slt i32 %4, 1
br i1 %5, label %20, label %6
6: ; preds = %0, %15
%7 = phi i32 [ %16, %15 ], [ %4, %0 ]
%8 = phi i32 [ %17, %15 ], [ 0, %0 ]
%9 = phi i32 [ %18, %15 ], [ 1, %0 ]
%10 = srem i32 %7, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = call i32 @betterNumber(i32 %8, i32 %9)
%14 = load i32, i32* %1
br label %15
15: ; preds = %6, %12
%16 = phi i32 [ %14, %12 ], [ %7, %6 ]
%17 = phi i32 [ %13, %12 ], [ %8, %6 ]
%18 = add nuw nsw i32 %9, 1
%19 = icmp slt i32 %9, %16
br i1 %19, label %6, label %20
20: ; preds = %15, %0
%21 = phi i32 [ 0, %0 ], [ %17, %15 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}