#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__ EOF;
scalar_t__ has7(int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int N, i, out;
  while (scanf("%d", &N) != EOF) {
    out = 0;
    for (i = 1; i <= N; i++)
      if (!(i % 7 == 0 || has7(i)))
        out += i * i;
    printf("%d\n", out);
  }
}


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>
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
je     11d3 <main+0xa3>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11bf <main+0x8f>
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11ac <main+0x7c>
mov    -0xc(%rbp),%edi
call   1050 <has7@plt>
cmp    $0x0,%rax
jne    11ac <main+0x7c>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11b1 <main+0x81>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116d <main+0x3d>
mov    -0x10(%rbp),%esi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e95(%rip),%r13
cmp    0x0(%r13),%rax
jne    116a <main+0x3a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe8f(%rip),%r15
lea    0x4(%rsp),%r12
jmp    11a1 <main+0x71>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
lea    0xe7a(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     1159 <main+0x29>
cmpl   $0x0,0x4(%rsp)
jle    1180 <main+0x50>
mov    $0x1,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11ca <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14d
cmp    0x4(%rsp),%ebx
jge    1182 <main+0x52>
mov    %ebx,%eax
lea    0x1(%rax),%ebx
mov    %r14d,%ecx
imul   $0x24924925,%rcx,%rcx
shr    $0x20,%rcx
mov    %r14d,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x2,%edx
mov    %edx,%ecx
not    %ecx
lea    (%rcx,%rdx,8),%ecx
cmp    %eax,%ecx
je     11c0 <main+0x90>
mov    %ebx,%edi
call   1050 <has7@plt>
test   %rax,%rax
jne    11c0 <main+0x90>
mov    %ebx,%eax
imul   %ebx,%eax
add    %eax,%ebp
jmp    11c0 <main+0x90>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.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
br label %5
5: ; preds = %32, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %35
9: ; preds = %5
store i32 0, i32* %4
store i32 1, i32* %3
br label %10
10: ; preds = %29, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load i32, i32* %3
%16 = srem i32 %15, 7
%17 = icmp eq i32 %16, 0
br i1 %17, label %28, label %18
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i64 @has7(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = load i32, i32* %3
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, %25
store i32 %27, i32* %4
br label %28
28: ; preds = %22, %18, %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %10
32: ; preds = %10
%33 = load i32, i32* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %5
35: ; preds = %5
%36 = load i32, i32* %1
ret i32 %36
}

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