#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 */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, i = 1, j = 0;
  scanf("%d", &n);
  while (++i <= n) {
    if (isPrime(i)) {
      printf("%d\t", i);
      if (j++ % 5 == 4)
        putchar('\n');
    }
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe9c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    -0x8(%rbp),%eax
jg     11d0 <main+0x90>
mov    -0xc(%rbp),%edi
call   1050 <isPrime@plt>
cmp    $0x0,%rax
je     11cb <main+0x8b>
mov    -0xc(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    11c6 <main+0x86>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11cb <main+0x8b>
jmp    116d <main+0x2d>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x2,0xc(%rsp)
jl     11bf <main+0x7f>
xor    %ebp,%ebp
mov    $0x1,%ebx
lea    0xe95(%rip),%r14
jmp    1176 <main+0x36>
cmp    0xc(%rsp),%ebx
jge    11bf <main+0x7f>
add    $0x1,%ebx
mov    %ebx,%edi
call   1050 <isPrime@plt>
test   %rax,%rax
je     1170 <main+0x30>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
movslq %ebp,%rax
add    $0x1,%ebp
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    $0x4,%eax
jne    1170 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %23
6: ; preds = %0, %18
%7 = phi i32 [ %20, %18 ], [ 2, %0 ]
%8 = phi i32 [ %19, %18 ], [ 0, %0 ]
%9 = call i64 @isPrime(i32 %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %6
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%13 = add nsw i32 %8, 1
%14 = srem i32 %8, 5
%15 = icmp eq i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @putchar(i8 signext 10)
br label %18
18: ; preds = %11, %16, %6
%19 = phi i32 [ %13, %16 ], [ %13, %11 ], [ %8, %6 ]
%20 = add nuw nsw i32 %7, 1
%21 = load i32, i32* %1
%22 = icmp slt i32 %7, %21
br i1 %22, label %6, label %23
23: ; preds = %18, %0
%24 = call i32 @putchar(i8 signext 10)
ret i32 0
}