#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;
  int i;
  for (i = 3; i < 1000; i += 3)
    sum += i;
  for (i = 5; i < 1000; i += 5)
    sum += (1 ^ !(i % 3)) * i;
  printf("Problem 1: %d\n", 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   $0x3,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1151 <main+0x41>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
movl   $0x5,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1198 <main+0x88>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
xor    $0x1,%eax
imul   -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x48>
mov    -0x8(%rbp),%esi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee7(%rip),%xmm2
pxor   %xmm13,%xmm13
movdqa 0xeea(%rip),%xmm0
movdqa 0xef2(%rip),%xmm3
mov    $0xc0,%eax
movdqa 0xef4(%rip),%xmm8
movdqa 0xefb(%rip),%xmm9
movdqa 0xf03(%rip),%xmm6
movdqa 0xf0a(%rip),%xmm10
movdqa 0xf11(%rip),%xmm11
movdqa 0xf18(%rip),%xmm12
pxor   %xmm4,%xmm4
nopl   0x0(%rax)
movdqa %xmm3,%xmm5
paddd  %xmm8,%xmm5
movdqa %xmm2,%xmm7
pmullw %xmm9,%xmm7
movdqa %xmm7,%xmm1
psubusw %xmm6,%xmm1
pcmpeqw %xmm13,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x10,%xmm1
paddw  %xmm10,%xmm7
psubusw %xmm6,%xmm7
pcmpeqw %xmm13,%xmm7
punpcklwd %xmm7,%xmm7
psrad  $0x10,%xmm7
pandn  %xmm5,%xmm7
paddd  %xmm7,%xmm4
pandn  %xmm3,%xmm1
paddd  %xmm1,%xmm0
paddd  %xmm11,%xmm3
paddw  %xmm12,%xmm2
add    $0xfffffff8,%eax
jne    1170 <main+0x60>
paddd  %xmm0,%xmm4
pshufd $0xee,%xmm4,%xmm0
paddd  %xmm4,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    $0x131f,%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"Problem 1: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %17, %1 ]
%3 = phi <4 x i32> [ <i32 5, i32 10, i32 15, i32 20>, %0 ], [ %18, %1 ]
%4 = phi <4 x i32> [ <i32 166833, i32 0, i32 0, i32 0>, %0 ], [ %15, %1 ]
%5 = phi <4 x i32> [ zeroinitializer, %0 ], [ %16, %1 ]
%6 = phi <4 x i16> [ <i16 5, i16 10, i16 15, i16 20>, %0 ], [ %19, %1 ]
%7 = add <4 x i32> %3, <i32 20, i32 20, i32 20, i32 20>
%8 = add <4 x i16> %6, <i16 20, i16 20, i16 20, i16 20>
%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> zeroinitializer, <4 x i32> %3
%14 = select <4 x i1> %12, <4 x i32> zeroinitializer, <4 x i32> %7
%15 = add <4 x i32> %13, %4
%16 = add <4 x i32> %14, %5
%17 = add nuw i32 %2, 8
%18 = add <4 x i32> %3, <i32 40, i32 40, i32 40, i32 40>
%19 = add <4 x i16> %6, <i16 40, i16 40, i16 40, i16 40>
%20 = icmp eq i32 %17, 192
br i1 %20, label %21, label %1
21: ; preds = %1
%22 = add <4 x i32> %16, %15
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %22)
%24 = add nuw nsw i32 %23, 4895
%25 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}