#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 main() {
  int sum = 0, n = 1;
  while (n < 1000) {
    if (n % 3 == 0) {
      sum += n;
    }
    if ((n % 5 == 0) && (n % 3 != 0)) {
      sum += n;
    }
    n++;
  }
  printf("A soma eh %d", sum);
}


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)
cmpl   $0x3e8,-0xc(%rbp)
jge    1196 <main+0x86>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1157 <main+0x47>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1188 <main+0x78>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1188 <main+0x78>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee6(%rip),%xmm9
pxor   %xmm15,%xmm15
movdqa 0xee9(%rip),%xmm2
mov    $0x3e0,%eax
movdqa 0xf0c(%rip),%xmm5
movdqa 0xf34(%rip),%xmm3
movdqa 0xf3c(%rip),%xmm4
movdqa 0xf43(%rip),%xmm12
movdqa 0xf4a(%rip),%xmm13
movdqa 0xf51(%rip),%xmm14
pxor   %xmm7,%xmm7
pxor   %xmm6,%xmm6
nopw   0x0(%rax,%rax,1)
movdqa %xmm2,%xmm1
paddd  0xea4(%rip),%xmm1
movdqa %xmm9,%xmm0
pmullw 0xea7(%rip),%xmm0
movdqa %xmm0,%xmm11
psubusw %xmm5,%xmm11
pcmpeqw %xmm15,%xmm11
punpcklwd %xmm11,%xmm8
psrad  $0x10,%xmm8
paddw  0xea5(%rip),%xmm0
psubusw %xmm5,%xmm0
pcmpeqw %xmm15,%xmm0
punpcklwd %xmm0,%xmm10
psrad  $0x10,%xmm10
pand   %xmm2,%xmm8
paddd  %xmm7,%xmm8
pand   %xmm1,%xmm10
paddd  %xmm6,%xmm10
movdqa %xmm9,%xmm6
pmullw 0xe80(%rip),%xmm6
movdqa %xmm6,%xmm7
pxor   %xmm3,%xmm7
pcmpgtw %xmm4,%xmm7
por    %xmm11,%xmm7
paddw  %xmm12,%xmm6
pxor   %xmm3,%xmm6
pcmpgtw %xmm4,%xmm6
por    %xmm0,%xmm6
punpcklwd %xmm7,%xmm7
psrad  $0x10,%xmm7
pandn  %xmm2,%xmm7
paddd  %xmm8,%xmm7
punpcklwd %xmm6,%xmm6
psrad  $0x10,%xmm6
pandn  %xmm1,%xmm6
paddd  %xmm10,%xmm6
paddd  %xmm13,%xmm2
paddw  %xmm14,%xmm9
add    $0xfffffff8,%eax
jne    1170 <main+0x60>
paddd  %xmm7,%xmm6
pshufd $0xee,%xmm6,%xmm0
paddd  %xmm6,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    $0xf8f,%esi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"A soma eh %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 = %27, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %30
7: ; preds = %4
%8 = load i32, i32* %3
%9 = srem i32 %8, 3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = add nsw i32 %13, %12
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %7
%16 = load i32, i32* %3
%17 = srem i32 %16, 5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i32, i32* %3
%21 = srem i32 %20, 3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = add nsw i32 %25, %24
store i32 %26, i32* %2
br label %27
27: ; preds = %23, %19, %15
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %4
30: ; preds = %4
%31 = load i32, i32* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %1
ret i32 %33
}

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