#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 printf(char *, int);
int scanf(char *, int *);
int main() {
  int n, c = 0;
  for (;;)
    if (scanf("%d", &n), n)
      c += n % 3 && n % 5;
    else
      return 0 * printf("%d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1190 <main+0x70>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0xd(%rbp)
je     117d <main+0x5d>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a8 <main+0x88>
mov    -0xc(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
xor    %ebx,%ebx
test   %eax,%eax
je     11a3 <main+0x83>
lea    0xeb5(%rip),%r14
lea    0xc(%rsp),%r15
jmp    118b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   $0xcccccccd,%eax,%eax
add    $0x19999999,%eax
cmp    $0x33333333,%eax
setae  %al
movzbl %al,%eax
add    %eax,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a3 <main+0x83>
imul   $0xaaaaaaab,%eax,%ecx
add    $0x2aaaaaaa,%ecx
cmp    $0x55555555,%ecx
jae    1160 <main+0x40>
xor    %eax,%eax
jmp    1173 <main+0x53>
lea    0xe59(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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