#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*/ assert(long *);
long *calloc(int, int);
int /*<<< orphan*/ free(long *);
scalar_t__ is_square(long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int freed_from_squares() {
  int number_of_input_numbers = -2048;
  scanf("%i", &number_of_input_numbers);
  long *input_numbers = calloc(number_of_input_numbers, sizeof(*input_numbers));
  assert(input_numbers);
  for (int i = 0; i < number_of_input_numbers; i++) {
    scanf("%li", &input_numbers[i]);
  }
  for (int i = 0; i < number_of_input_numbers; i++) {
    int this_is_freed_from_squares = 1;
    for (long j = 2; j <= input_numbers[i] / 2 + 1; j++) {
      if (j == input_numbers[i] / 2 + 1) {
        j = input_numbers[i];
      }
      if (input_numbers[i] % j == 0 && is_square(j)) {
        this_is_freed_from_squares = 0;
        break;
      }
    }
    if (this_is_freed_from_squares) {
      printf("%li ", input_numbers[i]);
    }
  }
  printf("\n");
  free(input_numbers);
  input_numbers = 0;
  return 0;
}


x86 assembly (clang, -O0):
<freed_from_squares>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0xfffff800,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <assert@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d9 <freed_from_squares+0x79>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <freed_from_squares+0x42>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12f7 <freed_from_squares+0x197>
movl   $0x1,-0x1c(%rbp)
movq   $0x2,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    $0x1,%rcx
cmp    %rcx,%rax
jg     12c0 <freed_from_squares+0x160>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    $0x1,%rcx
cmp    %rcx,%rax
jne    126f <freed_from_squares+0x10f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cqto
idivq  -0x28(%rbp)
cmp    $0x0,%rdx
jne    12aa <freed_from_squares+0x14a>
mov    -0x28(%rbp),%rdi
call   1070 <is_square@plt>
cmp    $0x0,%rax
je     12aa <freed_from_squares+0x14a>
movl   $0x0,-0x1c(%rbp)
jmp    12c0 <freed_from_squares+0x160>
jmp    12af <freed_from_squares+0x14f>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11fb <freed_from_squares+0x9b>
cmpl   $0x0,-0x1c(%rbp)
je     12e4 <freed_from_squares+0x184>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12e9 <freed_from_squares+0x189>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e0 <freed_from_squares+0x80>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freed_from_squares>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0xfffff800,0x4(%rsp)
ff
lea    0xe79(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1070 <assert@plt>
cmpl   $0x0,0x4(%rsp)
jle    12bd <freed_from_squares+0x14d>
lea    0xe45(%rip),%r14
mov    %r15,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x8,%r12
cmp    %rax,%rbx
jl     11d0 <freed_from_squares+0x60>
test   %eax,%eax
jle    12bd <freed_from_squares+0x14d>
lea    0xe09(%rip),%r14
xor    %r12d,%r12d
jmp    122c <freed_from_squares+0xbc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
movslq 0x4(%rsp),%rax
cmp    %rax,%r12
jge    12bd <freed_from_squares+0x14d>
mov    (%r15,%r12,8),%rsi
cmp    $0x2,%rsi
jl     1210 <freed_from_squares+0xa0>
mov    %rsi,%rax
shr    %rax
mov    $0x2,%ebx
jmp    126d <freed_from_squares+0xfd>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15,%r12,8),%rsi
lea    0x1(%rbx),%rcx
mov    %rsi,%rax
shr    $0x3f,%rax
add    %rsi,%rax
sar    %rax
cmp    %rax,%rbx
mov    %rcx,%rbx
jg     1210 <freed_from_squares+0xa0>
add    $0x1,%rax
cmp    %rax,%rbx
cmove  %rsi,%rbx
mov    %rsi,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     12a0 <freed_from_squares+0x130>
mov    %rsi,%rax
cqto
idiv   %rbx
test   %rdx,%rdx
jne    1254 <freed_from_squares+0xe4>
jmp    12ab <freed_from_squares+0x13b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %esi,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
jne    1254 <freed_from_squares+0xe4>
mov    %rbx,%rdi
call   1080 <is_square@plt>
test   %rax,%rax
je     1250 <freed_from_squares+0xe0>
jmp    121a <freed_from_squares+0xaa>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"%li\00"
@.str.2 = [5 x i8] c"%li \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @freed_from_squares() {
%1 = alloca i32
%2 = alloca i64*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 -2048, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = call i64* @calloc(i32 %8, i32 8)
store i64* %9, i64** %2
%10 = load i64*, i64** %2
%11 = call i32 @assert(i64* %10)
store i32 0, i32* %3
br label %12
12: ; preds = %22, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i64*, i64** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i64, i64* %17, i64 %19
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %12
25: ; preds = %12
store i32 0, i32* %4
br label %26
26: ; preds = %86, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %1
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %89
30: ; preds = %26
store i32 1, i32* %5
store i64 2, i64* %6
br label %31
31: ; preds = %72, %30
%32 = load i64, i64* %6
%33 = load i64*, i64** %2
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i64, i64* %33, i64 %35
%37 = load i64, i64* %36
%38 = sdiv i64 %37, 2
%39 = add nsw i64 %38, 1
%40 = icmp sle i64 %32, %39
br i1 %40, label %41, label %75
41: ; preds = %31
%42 = load i64, i64* %6
%43 = load i64*, i64** %2
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i64, i64* %43, i64 %45
%47 = load i64, i64* %46
%48 = sdiv i64 %47, 2
%49 = add nsw i64 %48, 1
%50 = icmp eq i64 %42, %49
br i1 %50, label %51, label %57
51: ; preds = %41
%52 = load i64*, i64** %2
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i64, i64* %52, i64 %54
%56 = load i64, i64* %55
store i64 %56, i64* %6
br label %57
57: ; preds = %51, %41
%58 = load i64*, i64** %2
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i64, i64* %58, i64 %60
%62 = load i64, i64* %61
%63 = load i64, i64* %6
%64 = srem i64 %62, %63
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %57
%67 = load i64, i64* %6
%68 = call i64 @is_square(i64 %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 0, i32* %5
br label %75
71: ; preds = %66, %57
br label %72
72: ; preds = %71
%73 = load i64, i64* %6
%74 = add nsw i64 %73, 1
store i64 %74, i64* %6
br label %31
75: ; preds = %70, %31
%76 = load i32, i32* %5
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %85
78: ; preds = %75
%79 = load i64*, i64** %2
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i64, i64* %79, i64 %81
%83 = load i64, i64* %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %83)
br label %85
85: ; preds = %78, %75
br label %86
86: ; preds = %85
%87 = load i32, i32* %4
%88 = add nsw i32 %87, 1
store i32 %88, i32* %4
br label %26
89: ; preds = %26
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%91 = load i64*, i64** %2
%92 = call i32 @free(i64* %91)
store i64* null, i64** %2
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"%li\00"
@.str.2 = [5 x i8] c"%li \00"
define i32 @freed_from_squares() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -2048, i32* %1
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i64* @calloc(i32 %4, i32 8)
%6 = call i32 @assert(i64* %5)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %11, label %26
9: ; preds = %11
%10 = icmp sgt i32 %16, 0
br i1 %10, label %19, label %26
11: ; preds = %0, %11
%12 = phi i64 [ %15, %11 ], [ 0, %0 ]
%13 = getelementptr inbounds i64, i64* %5, i64 %12
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %13)
%15 = add nuw nsw i64 %12, 1
%16 = load i32, i32* %1
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %11, label %9
19: ; preds = %9, %51
%20 = phi i64 [ %52, %51 ], [ 0, %9 ]
%21 = getelementptr inbounds i64, i64* %5, i64 %20
%22 = load i64, i64* %21
%23 = icmp slt i64 %22, 2
br i1 %23, label %48, label %24
24: ; preds = %19
%25 = lshr i64 %22, 1
br label %29
26: ; preds = %51, %0, %9
%27 = call i32 @putchar(i32 10)
%28 = call i32 @free(i64* %5)
ret i32 0
29: ; preds = %24, %43
%30 = phi i64 [ %44, %43 ], [ %22, %24 ]
%31 = phi i64 [ %46, %43 ], [ %25, %24 ]
%32 = phi i64 [ %45, %43 ], [ 2, %24 ]
%33 = add nsw i64 %31, 1
%34 = icmp eq i64 %32, %33
%35 = select i1 %34, i64 %30, i64 %32
%36 = srem i64 %30, %35
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %29
%39 = call i64 @is_square(i64 %35)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = load i64, i64* %21
br label %43
43: ; preds = %41, %29
%44 = phi i64 [ %42, %41 ], [ %30, %29 ]
%45 = add nsw i64 %35, 1
%46 = sdiv i64 %44, 2
%47 = icmp sgt i64 %35, %46
br i1 %47, label %48, label %29
48: ; preds = %43, %19
%49 = phi i64 [ %22, %19 ], [ %44, %43 ]
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %49)
br label %51
51: ; preds = %38, %48
%52 = add nuw nsw i64 %20, 1
%53 = load i32, i32* %1
%54 = sext i32 %53 to i64
%55 = icmp slt i64 %52, %54
br i1 %55, label %19, label %26
}