#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 n, i;
  printf("Enter n: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    if (i % 3 == 0 || i % 7 == 0) {
      continue;
    }
    if (i == n) {
      printf("%d\n", i);
      break;
    }
    printf("%d ", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ce <main+0xae>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1188 <main+0x68>
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118d <main+0x6d>
jmp    11c0 <main+0xa0>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11af <main+0x8f>
mov    -0xc(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <main+0xae>
mov    -0xc(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x10,%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    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11d8 <main+0xb8>
mov    $0x1,%ebx
mov    $0xaaaaaaab,%r15d
lea    0xead(%rip),%r14
xor    %ebp,%ebp
jmp    1177 <main+0x57>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %esi,%ebp
jge    11d8 <main+0xb8>
mov    %ebp,%eax
lea    0x1(%rax),%ebp
mov    %ebx,%ecx
mov    %rcx,%rdx
imul   %r15,%rdx
shr    $0x21,%rdx
lea    (%rdx,%rdx,2),%edx
add    $0xffffffff,%edx
cmp    %eax,%edx
je     1170 <main+0x50>
imul   $0x24924925,%rcx,%rcx
shr    $0x20,%rcx
mov    %ebx,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x2,%edx
mov    %edx,%ecx
not    %ecx
lea    (%rcx,%rdx,8),%ecx
cmp    %eax,%ecx
je     1170 <main+0x50>
cmp    %esi,%ebp
je     11ca <main+0xaa>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
jmp    1170 <main+0x50>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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