#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 sum = 0, i = 1;
  while (1) {
    scanf("%d", &i);
    if (!(i % 10)) {
      break;
    }
    sum += (!(i % 3) || !(i % 5)) ? i : 0;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1166 <main+0x46>
jmp    11b1 <main+0x91>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118e <main+0x6e>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1199 <main+0x79>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a3 <main+0x83>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    11a3 <main+0x83>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
imul   $0xcccccccd,%eax,%ecx
add    $0x19999998,%ecx
ror    %ecx
xor    %ebx,%ebx
cmp    $0x19999999,%ecx
jb     11c6 <main+0xa6>
lea    0xe9b(%rip),%r14
lea    0xc(%rsp),%r15
nopw   0x0(%rax,%rax,1)
imul   $0xaaaaaaab,%eax,%ecx
add    $0x2aaaaaaa,%ecx
imul   $0xcccccccd,%eax,%edx
add    $0x19999999,%edx
cmp    $0x33333333,%edx
mov    $0x0,%edx
cmovb  %eax,%edx
cmp    $0x55555555,%ecx
cmovb  %eax,%edx
add    %edx,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
imul   $0xcccccccd,%eax,%ecx
add    $0x19999998,%ecx
ror    %ecx
cmp    $0x19999998,%ecx
ja     1170 <main+0x50>
lea    0xe33(%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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %0, %21
%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 = srem i32 %6, 10
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %4
br label %25
10: ; preds = %4
%11 = load i32, i32* %3
%12 = srem i32 %11, 3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %3
%16 = srem i32 %15, 5
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14, %10
%19 = load i32, i32* %3
br label %21
20: ; preds = %14
br label %21
21: ; preds = %20, %18
%22 = phi i32 [ %19, %18 ], [ 0, %20 ]
%23 = load i32, i32* %2
%24 = add nsw i32 %23, %22
store i32 %24, i32* %2
br label %4
25: ; preds = %9
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}

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