#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 1; i <= 1000; ++i) {
    if ((i % 3 == 0) && (i % 5 == 0) && (i % 7) == 0) {
      printf("%d\n", i);
      ;
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     1191 <main+0x81>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x6e>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x6e>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x6e>
mov    -0x8(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <main+0x73>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
jmp    113b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x3e9,%ebx
je     1193 <main+0x83>
movzwl %bx,%ecx
imul   $0x2493,%ecx,%edx
shr    $0x10,%edx
mov    %ebx,%eax
sub    %edx,%eax
movzwl %ax,%eax
shr    %eax
add    %edx,%eax
shr    $0x2,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
imul   $0xcccd,%ecx,%edx
shr    $0x12,%edx
lea    (%rdx,%rdx,4),%edx
imul   $0xaaab,%ecx,%ecx
shr    $0x11,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %ebx,%esi
sub    %ecx,%esi
mov    %ebx,%ecx
sub    %edx,%ecx
or     %esi,%ecx
add    %ebx,%eax
or     %cx,%ax
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
br label %1
1: ; preds = %0, %13
%2 = phi i32 [ 1, %0 ], [ %14, %13 ]
%3 = trunc i32 %2 to i16
%4 = urem i16 %3, 3
%5 = urem i16 %3, 5
%6 = or i16 %4, %5
%7 = icmp eq i16 %6, 0
%8 = urem i16 %3, 7
%9 = icmp eq i16 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %13
13: ; preds = %1, %11
%14 = add nuw nsw i32 %2, 1
%15 = icmp eq i32 %14, 1001
br i1 %15, label %16, label %1
16: ; preds = %13
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}