#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 *, size_t *);
int main() {
  size_t n;
  printf("Please enter positive integer: ");
  scanf("%d", &n);
  int i;
  for (i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 7 != 0) {
      printf("%d ", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11ae <main+0x8e>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     119b <main+0x7b>
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     119b <main+0x7b>
mov    -0x14(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x80>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rax
test   %rax,%rax
je     11c9 <main+0xa9>
mov    $0x1,%ebp
mov    $0xaaaaaaab,%r15d
lea    0xec4(%rip),%r14
xor    %ebx,%ebx
jmp    1178 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmp    %rbx,%rax
jbe    11c9 <main+0xa9>
mov    %rbx,%rcx
mov    %ebp,%edx
mov    %rdx,%rsi
imul   %r15,%rsi
shr    $0x21,%rsi
lea    (%rsi,%rsi,2),%esi
add    $0xffffffff,%esi
add    $0x1,%rbx
cmp    %ecx,%esi
je     1170 <main+0x50>
imul   $0x24924925,%rdx,%rdx
shr    $0x20,%rdx
mov    %ebp,%esi
sub    %edx,%esi
shr    %esi
add    %edx,%esi
shr    $0x2,%esi
mov    %esi,%edx
not    %edx
lea    (%rdx,%rsi,8),%edx
cmp    %ecx,%edx
je     1170 <main+0x50>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rax
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [32 x i8] c"Please enter positive integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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), i64* %1)
%5 = load i64, i64* %1
%6 = icmp eq i64 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %0, %19
%8 = phi i64 [ %20, %19 ], [ %5, %0 ]
%9 = phi i64 [ %21, %19 ], [ 1, %0 ]
%10 = trunc i64 %9 to i32
%11 = urem i32 %10, 3
%12 = icmp eq i32 %11, 0
%13 = urem i32 %10, 7
%14 = icmp eq i32 %13, 0
%15 = or i1 %12, %14
br i1 %15, label %19, label %16
16: ; preds = %7
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%18 = load i64, i64* %1
br label %19
19: ; preds = %7, %16
%20 = phi i64 [ %8, %7 ], [ %18, %16 ]
%21 = add nuw i64 %9, 1
%22 = icmp ugt i64 %20, %9
br i1 %22, label %7, label %23
23: ; preds = %19, %0
ret i32 0
}