#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int i = 1, j = 0;
  scanf("%i", &i);
  ++i;
  while (i--) {
    if (i % 3 == 2 && i % 5 == 3 && i % 7 == 2)
      ++j;
  }
  printf("%i\n", j);
  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)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11bb <main+0x9b>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    11b6 <main+0x96>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
jne    11b6 <main+0x96>
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    11b6 <main+0x96>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <main+0x3d>
mov    -0x18(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movl   $0x1,0xc(%rsp)
lea    0xf4d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     14b7 <main+0x397>
lea    0x1(%rax),%ecx
xor    %esi,%esi
cmp    $0x8,%ecx
jb     1440 <main+0x320>
mov    %ecx,%edx
and    $0xfffffff8,%edx
movd   %eax,%xmm0
sub    %edx,%eax
pshufd $0x0,%xmm0,%xmm5
paddd  0xe90(%rip),%xmm5
pxor   %xmm0,%xmm0
mov    %edx,%esi
pxor   %xmm12,%xmm12
movdqa 0xecc(%rip),%xmm14
movdqa 0xed3(%rip),%xmm15
nopl   (%rax)
movdqa %xmm0,0x10(%rsp)
movdqa %xmm5,%xmm7
paddd  0xe6e(%rip),%xmm7
movdqa %xmm5,%xmm0
movdqa 0xe71(%rip),%xmm10
pmuludq %xmm10,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm5,%xmm13
movdqa %xmm13,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
pxor   %xmm3,%xmm3
pcmpgtd %xmm5,%xmm3
movdqa %xmm3,%xmm1
pand   %xmm10,%xmm1
psubd  %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrld  $0x1f,%xmm1
paddd  %xmm0,%xmm1
movdqa %xmm1,%xmm0
paddd  %xmm1,%xmm0
paddd  %xmm1,%xmm0
movdqa %xmm5,%xmm6
psubd  %xmm0,%xmm6
pshufd $0xf5,%xmm7,%xmm8
pxor   %xmm1,%xmm1
pcmpgtd %xmm7,%xmm1
movdqa %xmm7,%xmm9
movdqa %xmm7,%xmm2
movdqa %xmm7,%xmm0
pmuludq %xmm10,%xmm0
pshufd $0xed,%xmm0,%xmm0
movdqa %xmm8,%xmm4
pmuludq %xmm10,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm0
movdqa %xmm1,%xmm4
pand   %xmm10,%xmm4
psubd  %xmm4,%xmm0
movdqa %xmm0,%xmm4
psrld  $0x1f,%xmm4
paddd  %xmm0,%xmm4
movdqa %xmm4,%xmm0
paddd  %xmm4,%xmm0
paddd  %xmm4,%xmm0
psubd  %xmm0,%xmm9
movdqa %xmm5,%xmm0
pmuludq %xmm14,%xmm0
pshufd $0xed,%xmm0,%xmm0
movdqa %xmm13,%xmm4
pmuludq %xmm14,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm0
movdqa %xmm3,%xmm4
pand   %xmm14,%xmm4
psubd  %xmm4,%xmm0
movdqa %xmm0,%xmm4
psrld  $0x1f,%xmm4
psrad  $0x1,%xmm0
paddd  %xmm4,%xmm0
movdqa %xmm0,%xmm4
pslld  $0x2,%xmm4
paddd  %xmm0,%xmm4
movdqa %xmm5,%xmm0
psubd  %xmm4,%xmm0
pmuludq %xmm14,%xmm2
pshufd $0xed,%xmm2,%xmm10
movdqa %xmm8,%xmm2
pmuludq %xmm14,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm10
movdqa %xmm7,%xmm2
pmuludq %xmm15,%xmm2
pshufd $0xed,%xmm2,%xmm11
pmuludq %xmm15,%xmm8
pshufd $0xed,%xmm8,%xmm2
punpckldq %xmm2,%xmm11
movdqa %xmm1,%xmm2
pand   %xmm15,%xmm1
paddd  %xmm7,%xmm1
psubd  %xmm1,%xmm11
paddd  %xmm7,%xmm11
pand   %xmm14,%xmm2
psubd  %xmm2,%xmm10
movdqa %xmm10,%xmm1
psrld  $0x1f,%xmm1
psrad  $0x1,%xmm10
paddd  %xmm1,%xmm10
movdqa %xmm10,%xmm1
pslld  $0x2,%xmm1
paddd  %xmm10,%xmm1
movdqa %xmm11,%xmm2
psrld  $0x1f,%xmm2
psrad  $0x2,%xmm11
paddd  %xmm2,%xmm11
movdqa %xmm11,%xmm2
pslld  $0x3,%xmm2
psubd  %xmm2,%xmm11
paddd  %xmm7,%xmm11
psubd  %xmm1,%xmm7
movdqa 0xcc8(%rip),%xmm4
pcmpeqd %xmm4,%xmm6
movdqa 0xcac(%rip),%xmm1
pcmpeqd %xmm1,%xmm0
pand   %xmm6,%xmm0
pcmpeqd %xmm4,%xmm9
pcmpeqd %xmm1,%xmm7
pand   %xmm9,%xmm7
movdqa %xmm5,%xmm1
pmuludq %xmm15,%xmm1
pshufd $0xed,%xmm1,%xmm1
pmuludq %xmm15,%xmm13
pshufd $0xed,%xmm13,%xmm2
punpckldq %xmm2,%xmm1
pand   %xmm15,%xmm3
paddd  %xmm5,%xmm3
psubd  %xmm3,%xmm1
paddd  %xmm5,%xmm1
movdqa %xmm1,%xmm2
psrld  $0x1f,%xmm2
psrad  $0x2,%xmm1
paddd  %xmm2,%xmm1
movdqa %xmm1,%xmm2
pslld  $0x3,%xmm2
psubd  %xmm2,%xmm1
paddd  %xmm5,%xmm1
pcmpeqd %xmm4,%xmm1
pand   %xmm0,%xmm1
movdqa 0x10(%rsp),%xmm0
psubd  %xmm1,%xmm0
pcmpeqd %xmm4,%xmm11
pand   %xmm7,%xmm11
psubd  %xmm11,%xmm12
paddd  0xc5c(%rip),%xmm5
add    $0xfffffff8,%esi
jne    1190 <main+0x70>
paddd  %xmm0,%xmm12
pshufd $0xee,%xmm12,%xmm0
paddd  %xmm12,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
cmp    %edx,%ecx
je     14b9 <main+0x399>
xchg   %ax,%ax
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%edx
sub    %ecx,%edx
xor    $0x2,%edx
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
shr    $0x20,%rcx
sar    %ecx
add    %edi,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edi
sub    %ecx,%edi
xor    $0x3,%edi
or     %edx,%edi
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
xor    $0x2,%ecx
xor    %edx,%edx
or     %edi,%ecx
sete   %dl
add    %edx,%esi
add    $0xffffffff,%eax
jb     1440 <main+0x320>
jmp    14b9 <main+0x399>
xor    %esi,%esi
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xbbb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = add nsw i32 %9, 1
store i32 %10, i32* %6
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %6
%13 = add nsw i32 %12, -1
store i32 %13, i32* %6
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i32, i32* %6
%17 = srem i32 %16, 3
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32, i32* %6
%21 = srem i32 %20, 5
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* %6
%25 = srem i32 %24, 7
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %30
30: ; preds = %27, %23, %19, %15
br label %11
31: ; preds = %11
%32 = load i32, i32* %7
%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"%i\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%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 eq i32 %6, -1
br i1 %7, label %68, label %8
8: ; preds = %2
%9 = add i32 %6, 1
%10 = icmp ult i32 %9, 8
br i1 %10, label %50, label %11
11: ; preds = %8
%12 = and i32 %9, -8
%13 = sub i32 %6, %12
%14 = insertelement <4 x i32> poison, i32 %6, i64 0
%15 = shufflevector <4 x i32> %14, <4 x i32> poison, <4 x i32> zeroinitializer
%16 = add <4 x i32> %15, <i32 0, i32 -1, i32 -2, i32 -3>
br label %17
17: ; preds = %17, %11
%18 = phi i32 [ 0, %11 ], [ %43, %17 ]
%19 = phi <4 x i32> [ %16, %11 ], [ %44, %17 ]
%20 = phi <4 x i32> [ zeroinitializer, %11 ], [ %41, %17 ]
%21 = phi <4 x i32> [ zeroinitializer, %11 ], [ %42, %17 ]
%22 = add <4 x i32> %19, <i32 -4, i32 -4, i32 -4, i32 -4>
%23 = srem <4 x i32> %19, <i32 3, i32 3, i32 3, i32 3>
%24 = srem <4 x i32> %22, <i32 3, i32 3, i32 3, i32 3>
%25 = icmp eq <4 x i32> %23, <i32 2, i32 2, i32 2, i32 2>
%26 = icmp eq <4 x i32> %24, <i32 2, i32 2, i32 2, i32 2>
%27 = srem <4 x i32> %19, <i32 5, i32 5, i32 5, i32 5>
%28 = srem <4 x i32> %22, <i32 5, i32 5, i32 5, i32 5>
%29 = icmp eq <4 x i32> %27, <i32 3, i32 3, i32 3, i32 3>
%30 = icmp eq <4 x i32> %28, <i32 3, i32 3, i32 3, i32 3>
%31 = and <4 x i1> %25, %29
%32 = and <4 x i1> %26, %30
%33 = srem <4 x i32> %19, <i32 7, i32 7, i32 7, i32 7>
%34 = srem <4 x i32> %22, <i32 7, i32 7, i32 7, i32 7>
%35 = icmp eq <4 x i32> %33, <i32 2, i32 2, i32 2, i32 2>
%36 = icmp eq <4 x i32> %34, <i32 2, i32 2, i32 2, i32 2>
%37 = select <4 x i1> %31, <4 x i1> %35, <4 x i1> zeroinitializer
%38 = select <4 x i1> %32, <4 x i1> %36, <4 x i1> zeroinitializer
%39 = zext <4 x i1> %37 to <4 x i32>
%40 = zext <4 x i1> %38 to <4 x i32>
%41 = add <4 x i32> %20, %39
%42 = add <4 x i32> %21, %40
%43 = add nuw i32 %18, 8
%44 = add <4 x i32> %19, <i32 -8, i32 -8, i32 -8, i32 -8>
%45 = icmp eq i32 %43, %12
br i1 %45, label %46, label %17
46: ; preds = %17
%47 = add <4 x i32> %42, %41
%48 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %47)
%49 = icmp eq i32 %9, %12
br i1 %49, label %68, label %50
50: ; preds = %8, %46
%51 = phi i32 [ %6, %8 ], [ %13, %46 ]
%52 = phi i32 [ 0, %8 ], [ %48, %46 ]
br label %53
53: ; preds = %50, %53
%54 = phi i32 [ %66, %53 ], [ %51, %50 ]
%55 = phi i32 [ %65, %53 ], [ %52, %50 ]
%56 = srem i32 %54, 3
%57 = icmp eq i32 %56, 2
%58 = srem i32 %54, 5
%59 = icmp eq i32 %58, 3
%60 = and i1 %57, %59
%61 = srem i32 %54, 7
%62 = icmp eq i32 %61, 2
%63 = select i1 %60, i1 %62, i1 false
%64 = zext i1 %63 to i32
%65 = add nuw nsw i32 %55, %64
%66 = add nsw i32 %54, -1
%67 = icmp eq i32 %54, 0
br i1 %67, label %68, label %53
68: ; preds = %53, %46, %2
%69 = phi i32 [ 0, %2 ], [ %48, %46 ], [ %65, %53 ]
store i32 -1, i32* %3
%70 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %69)
ret i32 0
}