#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 */
scalar_t__ is_equal(unsigned long long);
int /*<<< orphan*/ printf(char *, unsigned long long);
int main(int argc, char *argv[]) {
  unsigned long long sum = 0;
  for (unsigned long long i = 2; i <= 1000000; i++)
    if (is_equal(i))
      sum += i;
  printf("Sum: %llu\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
cmpq   $0xf4240,-0x20(%rbp)
ja     1189 <main+0x69>
mov    -0x20(%rbp),%rdi
call   1040 <is_equal@plt>
cmp    $0x0,%rax
je     1173 <main+0x53>
mov    -0x20(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1178 <main+0x58>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1146 <main+0x26>
mov    -0x18(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <is_equal@plt>
test   %rax,%rax
cmovne %rbx,%rax
add    %rax,%r14
add    $0x1,%rbx
cmp    $0xf4241,%rbx
jne    1130 <main+0x10>
lea    0xeaa(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"Sum: %llu\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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %11)
ret i32 0
5: ; preds = %2, %5
%6 = phi i64 [ 2, %2 ], [ %12, %5 ]
%7 = phi i64 [ 0, %2 ], [ %11, %5 ]
%8 = tail call i64 @is_equal(i64 %6)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i64 0, i64 %6
%11 = add i64 %10, %7
%12 = add nuw nsw i64 %6, 1
%13 = icmp eq i64 %12, 1000001
br i1 %13, label %3, label %5
}