#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*/ checkIntInput(int *);
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int n;
  checkIntInput(&n);
  srand(time(NULL));
  int numbers[n];
  int i;
  for (i = 0; i < n; i++) {
    numbers[i] = 0;
  }
  for (i = 0; i < n; i++) {
    int random = rand() % n;
    while (numbers[random] != 0) {
      random = rand() % n;
    }
    printf("%d ", random + 1);
    numbers[random] = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <checkIntInput@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cf <main+0x7f>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a6 <main+0x56>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1244 <main+0xf4>
mov    $0x0,%al
call   1070 <rand@plt>
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x20(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1215 <main+0xc5>
mov    $0x0,%al
call   1070 <rand@plt>
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x20(%rbp)
jmp    11f0 <main+0xa0>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
lea    0xdde(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d6 <main+0x86>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    -0x2c(%rbp),%rdi
call   1030 <checkIntInput@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    %rsp,%r15
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x2c(%rbp),%edx
test   %edx,%edx
jle    11f6 <main+0x96>
shl    $0x2,%rdx
mov    %r13,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe44(%rip),%r14
xor    %r12d,%r12d
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idivl  -0x2c(%rbp)
movslq %edx,%rbx
cmpl   $0x0,0x0(%r13,%rbx,4)
jne    11c0 <main+0x60>
add    $0x1,%edx
mov    %r14,%rdi
mov    %edx,%esi
call   1040 <printf@plt>
movl   $0x1,0x0(%r13,%rbx,4)
add    $0x1,%r12d
cmp    -0x2c(%rbp),%r12d
jl     11c0 <main+0x60>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @checkIntInput(i32* %2)
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i32, i64 %11
store i64 %11, i64* %4
store i32 0, i32* %5
br label %14
14: ; preds = %22, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %13, i64 %20
store i32 0, i32* %21
br label %22
22: ; preds = %18
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %14
25: ; preds = %14
store i32 0, i32* %5
br label %26
26: ; preds = %51, %25
%27 = load i32, i32* %5
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %54
30: ; preds = %26
%31 = call i32 (...) @rand()
%32 = load i32, i32* %2
%33 = srem i32 %31, %32
store i32 %33, i32* %6
br label %34
34: ; preds = %40, %30
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %13, i64 %36
%38 = load i32, i32* %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = call i32 (...) @rand()
%42 = load i32, i32* %2
%43 = srem i32 %41, %42
store i32 %43, i32* %6
br label %34
44: ; preds = %34
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %13, i64 %49
store i32 1, i32* %50
br label %51
51: ; preds = %44
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %26
54: ; preds = %26
store i32 0, i32* %1
%55 = load i8*, i8** %3
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @checkIntInput(i32* %1)
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i32, i64 %7
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %42
12: ; preds = %0
%13 = bitcast i32* %9 to i8*
%14 = zext i32 %10 to i64
%15 = shl nuw nsw i64 %14, 2
br label %16
16: ; preds = %12, %33
%17 = phi i32 [ %39, %33 ], [ 0, %12 ]
%18 = call i32 (...) @rand()
%19 = load i32, i32* %1
%20 = srem i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %9, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %16, %25
%26 = call i32 (...) @rand()
%27 = load i32, i32* %1
%28 = srem i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %9, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %25
33: ; preds = %25, %16
%34 = phi i64 [ %21, %16 ], [ %29, %25 ]
%35 = phi i32 [ %20, %16 ], [ %28, %25 ]
%36 = getelementptr inbounds i32, i32* %9, i64 %34
%37 = add nsw i32 %35, 1
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
store i32 1, i32* %36
%39 = add nuw nsw i32 %17, 1
%40 = load i32, i32* %1
%41 = icmp slt i32 %39, %40
br i1 %41, label %16, label %42
42: ; preds = %33, %0
ret i32 0
}