#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 */
typedef int /*<<< orphan*/ size;

/* Variables and functions */
int array_sum(int *);
int main(int argc, char *argv[]) {
  int size = 1000;
  int multiple[sizeof(size)] = {0};
  int total = 0;
  for (int i = 0; i < size; i++) {
    if ((i % 3 == 0) || (i % 5 == 0))
      multiple[i] = i;
  }
  total = array_sum(multiple);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ad <main+0x8d>
mov    -0x38(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118f <main+0x6f>
mov    -0x38(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119a <main+0x7a>
mov    -0x38(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    119f <main+0x7f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    115b <main+0x3b>
lea    -0x30(%rbp),%rdi
call   1040 <array_sum@plt>
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
pxor   %xmm0,%xmm0
movdqa %xmm0,(%rsp)
movdqa 0xedb(%rip),%xmm1
xor    %eax,%eax
movdqa 0xee0(%rip),%xmm8
movdqa 0xee8(%rip),%xmm3
movdqa 0xef0(%rip),%xmm4
movdqa 0xef8(%rip),%xmm5
movdqa 0xf00(%rip),%xmm6
jmp    1170 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x4,%rax
paddw  %xmm6,%xmm1
cmp    $0x3e8,%rax
je     11e6 <main+0xd6>
movdqa %xmm1,%xmm7
pmullw %xmm8,%xmm7
psubusw %xmm3,%xmm7
pcmpeqw %xmm0,%xmm7
punpcklwd %xmm7,%xmm2
movdqa %xmm1,%xmm7
pmullw %xmm4,%xmm7
psubusw %xmm5,%xmm7
pcmpeqw %xmm0,%xmm7
punpcklwd %xmm7,%xmm7
por    %xmm2,%xmm7
psrad  $0x10,%xmm7
movd   %xmm7,%ecx
test   $0x1,%cl
je     11ae <main+0x9e>
mov    %eax,(%rsp,%rax,4)
pextrw $0x2,%xmm7,%ecx
test   $0x1,%cl
je     11bf <main+0xaf>
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%rsp,%rax,4)
pextrw $0x4,%xmm7,%ecx
test   $0x1,%cl
je     11d0 <main+0xc0>
lea    0x2(%rax),%ecx
mov    %ecx,0x8(%rsp,%rax,4)
pextrw $0x6,%xmm7,%ecx
test   $0x1,%cl
je     1160 <main+0x50>
lea    0x3(%rax),%ecx
mov    %ecx,0xc(%rsp,%rax,4)
jmp    1160 <main+0x50>
mov    %rsp,%rdi
call   1030 <array_sum@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
br label %5
5: ; preds = %35, %2
%6 = phi i64 [ 0, %2 ], [ %36, %35 ]
%7 = phi <4 x i16> [ <i16 0, i16 1, i16 2, i16 3>, %2 ], [ %37, %35 ]
%8 = trunc i64 %6 to i32
%9 = urem <4 x i16> %7, <i16 3, i16 3, i16 3, i16 3>
%10 = icmp eq <4 x i16> %9, zeroinitializer
%11 = urem <4 x i16> %7, <i16 5, i16 5, i16 5, i16 5>
%12 = icmp eq <4 x i16> %11, zeroinitializer
%13 = or <4 x i1> %10, %12
%14 = extractelement <4 x i1> %13, i64 0
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %6
store i32 %8, i32* %16
br label %17
17: ; preds = %15, %5
%18 = extractelement <4 x i1> %13, i64 1
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = or i32 %8, 1
%21 = or i64 %6, 1
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %21
store i32 %20, i32* %22
br label %23
23: ; preds = %19, %17
%24 = extractelement <4 x i1> %13, i64 2
br i1 %24, label %25, label %29
25: ; preds = %23
%26 = or i32 %8, 2
%27 = or i64 %6, 2
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %27
store i32 %26, i32* %28
br label %29
29: ; preds = %25, %23
%30 = extractelement <4 x i1> %13, i64 3
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = or i32 %8, 3
%33 = or i64 %6, 3
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %33
store i32 %32, i32* %34
br label %35
35: ; preds = %31, %29
%36 = add nuw i64 %6, 4
%37 = add <4 x i16> %7, <i16 4, i16 4, i16 4, i16 4>
%38 = icmp eq i64 %36, 1000
br i1 %38, label %39, label %5
39: ; preds = %35
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%41 = call i32 @array_sum(i32* %40)
ret i32 0
}