#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);
void main() {
  const short LIMIT = 1000;
  int total = 23;
  short i;
  for (i = 10; i < LIMIT; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      total += i;
    }
  }
  printf("%d\n", total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x3e8,-0x2(%rbp)
movl   $0x17,-0x8(%rbp)
movw   $0xa,-0xa(%rbp)
movswl -0xa(%rbp),%eax
cmp    $0x3e8,%eax
jge    1184 <main+0x74>
movswl -0xa(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1164 <main+0x54>
movswl -0xa(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116e <main+0x5e>
movswl -0xa(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1173 <main+0x63>
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    112b <main+0x1b>
mov    -0x8(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movdqa 0xee7(%rip),%xmm8
pxor   %xmm2,%xmm2
movdqa 0xeeb(%rip),%xmm0
movdqa 0xef3(%rip),%xmm3
mov    $0x3d8,%eax
movdqa 0xf15(%rip),%xmm15
movdqa 0xf1c(%rip),%xmm10
movdqa 0xf23(%rip),%xmm11
movdqa 0xf2b(%rip),%xmm5
movdqa 0xf32(%rip),%xmm12
movdqa 0xf39(%rip),%xmm13
movdqa 0xf40(%rip),%xmm14
pxor   %xmm4,%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm8,%xmm1
pmullw 0xeb3(%rip),%xmm1
movdqa %xmm1,%xmm6
psubusw %xmm15,%xmm6
pcmpeqw %xmm2,%xmm6
movdqa %xmm8,%xmm7
pmullw %xmm11,%xmm7
movdqa %xmm7,%xmm9
psubusw %xmm5,%xmm9
pcmpeqw %xmm2,%xmm9
por    %xmm6,%xmm9
paddw  %xmm10,%xmm1
psubusw %xmm15,%xmm1
pcmpeqw %xmm2,%xmm1
paddw  %xmm12,%xmm7
psubusw %xmm5,%xmm7
pcmpeqw %xmm2,%xmm7
por    %xmm1,%xmm7
movdqa %xmm3,%xmm1
paddd  0xe4d(%rip),%xmm1
punpcklwd %xmm7,%xmm6
psrad  $0x10,%xmm6
pand   %xmm1,%xmm6
paddd  %xmm6,%xmm4
punpcklwd %xmm9,%xmm1
psrad  $0x10,%xmm1
pand   %xmm3,%xmm1
paddd  %xmm1,%xmm0
paddd  %xmm13,%xmm3
paddw  %xmm14,%xmm8
add    $0xfffffff8,%eax
jne    1180 <main+0x70>
paddd  %xmm0,%xmm4
pshufd $0xee,%xmm4,%xmm0
paddd  %xmm4,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    $0xbae,%esi
lea    0xe80(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %23, %1 ]
%3 = phi <4 x i32> [ <i32 10, i32 11, i32 12, i32 13>, %0 ], [ %24, %1 ]
%4 = phi <4 x i32> [ <i32 23, i32 0, i32 0, i32 0>, %0 ], [ %21, %1 ]
%5 = phi <4 x i32> [ zeroinitializer, %0 ], [ %22, %1 ]
%6 = phi <4 x i16> [ <i16 10, i16 11, i16 12, i16 13>, %0 ], [ %25, %1 ]
%7 = add <4 x i32> %3, <i32 4, i32 4, i32 4, i32 4>
%8 = add <4 x i16> %6, <i16 4, i16 4, i16 4, i16 4>
%9 = urem <4 x i16> %6, <i16 3, i16 3, i16 3, i16 3>
%10 = urem <4 x i16> %8, <i16 3, i16 3, i16 3, i16 3>
%11 = icmp eq <4 x i16> %9, zeroinitializer
%12 = icmp eq <4 x i16> %10, zeroinitializer
%13 = urem <4 x i16> %6, <i16 5, i16 5, i16 5, i16 5>
%14 = urem <4 x i16> %8, <i16 5, i16 5, i16 5, i16 5>
%15 = icmp eq <4 x i16> %13, zeroinitializer
%16 = icmp eq <4 x i16> %14, zeroinitializer
%17 = or <4 x i1> %11, %15
%18 = or <4 x i1> %12, %16
%19 = select <4 x i1> %17, <4 x i32> %3, <4 x i32> zeroinitializer
%20 = select <4 x i1> %18, <4 x i32> %7, <4 x i32> zeroinitializer
%21 = add <4 x i32> %19, %4
%22 = add <4 x i32> %20, %5
%23 = add nuw i32 %2, 8
%24 = add <4 x i32> %3, <i32 8, i32 8, i32 8, i32 8>
%25 = add <4 x i16> %6, <i16 8, i16 8, i16 8, i16 8>
%26 = icmp eq i32 %23, 984
br i1 %26, label %27, label %1
27: ; preds = %1
%28 = add <4 x i32> %22, %21
%29 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %28)
%30 = add nuw nsw i32 %29, 2990
%31 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
ret void
}