#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 divisors(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  const int limit = 10000000;
  int last = 0;
  int count = 0;
  for (int i = 2; i <= limit; ++i) {
    const int d = divisors(i);
    if (d == last) {
      ++count;
    }
    last = d;
  }
  printf("%d\n", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x989680,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
cmpl   $0x989680,-0x20(%rbp)
jg     1193 <main+0x73>
mov    -0x20(%rbp),%edi
call   1040 <divisors@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    117f <main+0x5f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1152 <main+0x32>
mov    -0x1c(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x2,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %ebp,%edi
call   1040 <divisors@plt>
xor    %ecx,%ecx
cmp    %r14d,%eax
sete   %cl
add    %ecx,%ebx
add    $0x1,%ebp
mov    %eax,%r14d
cmp    $0x989681,%ebp
jne    1130 <main+0x10>
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %5
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %9, %5 ]
%7 = phi i32 [ 2, %2 ], [ %13, %5 ]
%8 = phi i32 [ 0, %2 ], [ %12, %5 ]
%9 = tail call i32 @divisors(i32 %7)
%10 = icmp eq i32 %9, %6
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %8, %11
%13 = add nuw nsw i32 %7, 1
%14 = icmp eq i32 %13, 10000001
br i1 %14, label %3, label %5
}