#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i;
  int sum = 0;
  int input;
  printf("Please insert an integer value: ");
  scanf("%d", &input);
  for (i = 0; i < input; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      sum = sum + i;
    }
  }
  printf("The answer is %d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ab <main+0x8b>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118f <main+0x6f>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1198 <main+0x78>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    119d <main+0x7d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x3b>
mov    -0xc(%rbp),%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf74(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf85(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r8d
test   %r8d,%r8d
jle    12ad <main+0x18d>
xor    %ebx,%ebx
mov    $0x0,%eax
cmp    $0x8,%r8d
jb     12c5 <main+0x1a5>
mov    %r8d,%eax
and    $0xfffffff8,%eax
movdqa 0xe8c(%rip),%xmm8
pxor   %xmm0,%xmm0
movdqa 0xe9f(%rip),%xmm10
movdqa 0xea7(%rip),%xmm4
movdqa 0xeae(%rip),%xmm13
pcmpeqd %xmm6,%xmm6
movdqa 0xeb1(%rip),%xmm9
movdqa 0xeb8(%rip),%xmm14
movdqa 0xebf(%rip),%xmm15
movdqa 0xec6(%rip),%xmm11
movdqa 0xecd(%rip),%xmm12
mov    %eax,%edx
pxor   %xmm7,%xmm7
nopl   0x0(%rax)
movdqa %xmm8,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pshufd $0xf5,%xmm8,%xmm3
movdqa %xmm3,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm5
movdqa %xmm5,%xmm2
pxor   %xmm4,%xmm2
pcmpgtd %xmm13,%xmm2
pxor   %xmm6,%xmm2
movdqa %xmm8,%xmm1
pmuludq %xmm14,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm14,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
movdqa %xmm1,%xmm3
pxor   %xmm4,%xmm3
pcmpgtd %xmm15,%xmm3
pxor   %xmm6,%xmm3
por    %xmm2,%xmm3
paddd  %xmm9,%xmm5
pxor   %xmm4,%xmm5
pcmpgtd %xmm13,%xmm5
pxor   %xmm6,%xmm5
paddd  %xmm11,%xmm1
pxor   %xmm4,%xmm1
pcmpgtd %xmm15,%xmm1
pxor   %xmm6,%xmm1
por    %xmm5,%xmm1
movdqa %xmm8,%xmm2
paddd  0xda1(%rip),%xmm2
pand   %xmm2,%xmm1
paddd  %xmm1,%xmm7
pand   %xmm8,%xmm3
paddd  %xmm3,%xmm0
paddd  %xmm12,%xmm8
add    $0xfffffff8,%edx
jne    11d0 <main+0xb0>
paddd  %xmm0,%xmm7
pshufd $0xee,%xmm7,%xmm0
paddd  %xmm7,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%ebx
cmp    %eax,%r8d
jne    12c5 <main+0x1a5>
lea    0xe10(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    $0xaaaaaaab,%r9d
mov    $0xcccccccd,%esi
jmp    12f2 <main+0x1d2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rdi,%rdi,2),%edx
cmp    %eax,%edx
cmove  %eax,%ecx
add    %ecx,%ebx
add    $0x1,%eax
cmp    %eax,%r8d
je     12ad <main+0x18d>
mov    %eax,%ecx
mov    %rcx,%rdi
imul   %r9,%rdi
shr    $0x21,%rdi
imul   %rsi,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%edx
mov    %eax,%ecx
cmp    %eax,%edx
je     12e0 <main+0x1c0>
xor    %ecx,%ecx
jmp    12e0 <main+0x1c0>

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

LLVM IR (-O2):
@.str = [33 x i8] c"Please insert an integer value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"The answer is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %53
7: ; preds = %0
%8 = icmp ult i32 %5, 8
br i1 %8, label %38, label %9
9: ; preds = %7
%10 = and i32 %5, -8
br label %11
11: ; preds = %11, %9
%12 = phi i32 [ 0, %9 ], [ %31, %11 ]
%13 = phi <4 x i32> [ zeroinitializer, %9 ], [ %29, %11 ]
%14 = phi <4 x i32> [ zeroinitializer, %9 ], [ %30, %11 ]
%15 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %9 ], [ %32, %11 ]
%16 = add <4 x i32> %15, <i32 4, i32 4, i32 4, i32 4>
%17 = urem <4 x i32> %15, <i32 3, i32 3, i32 3, i32 3>
%18 = urem <4 x i32> %16, <i32 3, i32 3, i32 3, i32 3>
%19 = icmp eq <4 x i32> %17, zeroinitializer
%20 = icmp eq <4 x i32> %18, zeroinitializer
%21 = urem <4 x i32> %15, <i32 5, i32 5, i32 5, i32 5>
%22 = urem <4 x i32> %16, <i32 5, i32 5, i32 5, i32 5>
%23 = icmp eq <4 x i32> %21, zeroinitializer
%24 = icmp eq <4 x i32> %22, zeroinitializer
%25 = or <4 x i1> %19, %23
%26 = or <4 x i1> %20, %24
%27 = select <4 x i1> %25, <4 x i32> %15, <4 x i32> zeroinitializer
%28 = select <4 x i1> %26, <4 x i32> %16, <4 x i32> zeroinitializer
%29 = add <4 x i32> %27, %13
%30 = add <4 x i32> %28, %14
%31 = add nuw i32 %12, 8
%32 = add <4 x i32> %15, <i32 8, i32 8, i32 8, i32 8>
%33 = icmp eq i32 %31, %10
br i1 %33, label %34, label %11
34: ; preds = %11
%35 = add <4 x i32> %30, %29
%36 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %35)
%37 = icmp eq i32 %5, %10
br i1 %37, label %53, label %38
38: ; preds = %7, %34
%39 = phi i32 [ 0, %7 ], [ %36, %34 ]
%40 = phi i32 [ 0, %7 ], [ %10, %34 ]
br label %41
41: ; preds = %38, %41
%42 = phi i32 [ %50, %41 ], [ %39, %38 ]
%43 = phi i32 [ %51, %41 ], [ %40, %38 ]
%44 = urem i32 %43, 3
%45 = icmp eq i32 %44, 0
%46 = urem i32 %43, 5
%47 = icmp eq i32 %46, 0
%48 = or i1 %45, %47
%49 = select i1 %48, i32 %43, i32 0
%50 = add nuw nsw i32 %49, %42
%51 = add nuw nsw i32 %43, 1
%52 = icmp eq i32 %51, %5
br i1 %52, label %53, label %41
53: ; preds = %41, %34, %0
%54 = phi i32 [ 0, %0 ], [ %36, %34 ], [ %50, %41 ]
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %54)
ret i32 0
}