#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 *, long *);
int main() {
  long int l;
  printf("Enter your limit: ");
  scanf("%ld", &l);
  long int x;
  printf("2,\t");
  for (x = 3; x <= l; x = x + 2) {
    long int y;
    int z = 1;
    for (y = 3; y <= x / 3; y = y + 2) {
      if (x % y == 0)
        z = 0;
    }
    if (z == 1)
      printf("%ld,\t", x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x3,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1209 <main+0xe9>
movl   $0x1,-0x24(%rbp)
movq   $0x3,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x3,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jg     11d7 <main+0xb7>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    11c1 <main+0xa1>
movl   $0x0,-0x24(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    1180 <main+0x60>
cmpl   $0x1,-0x24(%rbp)
jne    11f3 <main+0xd3>
mov    -0x18(%rbp),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xd8>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <main+0x43>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%r8
cmp    $0x3,%r8
jge    116d <main+0x4d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    $0x3,%ebx
movabs $0xaaaaaaaaaaaaaaab,%r15
aa aa aa
lea    0xe98(%rip),%r14
jmp    11ab <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%r8
add    $0x2,%rbx
cmp    %r8,%rbx
jg     1161 <main+0x41>
mov    %rbx,%rax
mul    %r15
cmp    $0x9,%rbx
jb     1190 <main+0x70>
mov    %rdx,%rcx
shr    %rcx
mov    $0x1,%esi
mov    $0x3,%edi
jmp    11db <main+0xbb>
nopl   0x0(%rax)
add    $0x2,%rdi
mov    %eax,%esi
cmp    %rcx,%rdi
ja     1220 <main+0x100>
mov    %rbx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1200 <main+0xe0>
mov    %rbx,%rax
xor    %edx,%edx
div    %rdi
jmp    1206 <main+0xe6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
xor    %edx,%edx
div    %edi
xor    %eax,%eax
test   %rdx,%rdx
je     11d0 <main+0xb0>
mov    %esi,%eax
jmp    11d0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%eax
je     1190 <main+0x70>
jmp    11a2 <main+0x82>

LLVM IR (-O0):
@.str = [19 x i8] c"Enter your limit: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [4 x i8] c"2,\09\00"
@.str.3 = [6 x i8] c"%ld,\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i64 3, i64* %3
br label %9
9: ; preds = %36, %0
%10 = load i64, i64* %3
%11 = load i64, i64* %2
%12 = icmp sle i64 %10, %11
br i1 %12, label %13, label %39
13: ; preds = %9
store i32 1, i32* %5
store i64 3, i64* %4
br label %14
14: ; preds = %26, %13
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = sdiv i64 %16, 3
%18 = icmp sle i64 %15, %17
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = srem i64 %20, %21
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 0, i32* %5
br label %25
25: ; preds = %24, %19
br label %26
26: ; preds = %25
%27 = load i64, i64* %4
%28 = add nsw i64 %27, 2
store i64 %28, i64* %4
br label %14
29: ; preds = %14
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i64, i64* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %33)
br label %35
35: ; preds = %32, %29
br label %36
36: ; preds = %35
%37 = load i64, i64* %3
%38 = add nsw i64 %37, 2
store i64 %38, i64* %3
br label %9
39: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter your limit: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [4 x i8] c"2,\09\00"
@.str.3 = [6 x i8] c"%ld,\09\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = load i64, i64* %1
%7 = icmp slt i64 %6, 3
br i1 %7, label %30, label %8
8: ; preds = %0, %26
%9 = phi i64 [ %27, %26 ], [ %6, %0 ]
%10 = phi i64 [ %28, %26 ], [ 3, %0 ]
%11 = udiv i64 %10, 3
%12 = icmp ult i64 %10, 9
br i1 %12, label %23, label %13
13: ; preds = %8, %13
%14 = phi i32 [ %18, %13 ], [ 1, %8 ]
%15 = phi i64 [ %19, %13 ], [ 3, %8 ]
%16 = urem i64 %10, %15
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i32 0, i32 %14
%19 = add nuw nsw i64 %15, 2
%20 = icmp ugt i64 %19, %11
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = icmp eq i32 %18, 1
br i1 %22, label %23, label %26
23: ; preds = %8, %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %10)
%25 = load i64, i64* %1
br label %26
26: ; preds = %23, %21
%27 = phi i64 [ %25, %23 ], [ %9, %21 ]
%28 = add nuw nsw i64 %10, 2
%29 = icmp sgt i64 %28, %27
br i1 %29, label %30, label %8
30: ; preds = %26, %0
ret i32 0
}