#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__ have7(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int n, i, sum = 0, now, t;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    if (i % 7 == 0 || have7(i)) {
      sum++;
    }
  }
  printf("%d\n", sum);
  return 0;
}


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   $0x0,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b2 <main+0x82>
mov    -0x18(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1196 <main+0x66>
mov    -0x18(%rbp),%edi
call   1050 <have7@plt>
cmp    $0x0,%rax
je     119f <main+0x6f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a4 <main+0x74>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <main+0x34>
mov    -0x1c(%rbp),%esi
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
xor    %ebx,%ebx
cmpl   $0x2,0x4(%rsp)
jl     119f <main+0x6f>
xor    %ebx,%ebx
mov    $0x1,%ebp
jmp    116c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    119f <main+0x6f>
mov    %ebp,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %ebp,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x2,%ecx
lea    0x0(,%rcx,8),%eax
sub    %eax,%ecx
add    %ebp,%ecx
je     1160 <main+0x30>
mov    %ebp,%edi
call   1050 <have7@plt>
test   %rax,%rax
jne    1160 <main+0x30>
jmp    1163 <main+0x33>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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