#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);
int random(int);
int /*<<< orphan*/ randomize();
void main() {
  int n, a[10], i, j;
  randomize();
  a[0] = random(10);
  for (i = 1; i < 10; i++) {
    a[i] = random(10);
    for (j = 0; j < i; j++)
      if (a[i] == a[j]) {
        i--;
        break;
      }
  }
  for (i = 0; i < 10; i++)
    printf("%3d", a[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1050 <randomize@plt>
mov    $0xa,%edi
call   1040 <random@plt>
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ce <main+0x9e>
mov    $0xa,%edi
call   1040 <random@plt>
mov    %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11bb <main+0x8b>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jne    11a8 <main+0x78>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    11bb <main+0x8b>
jmp    11ad <main+0x7d>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1178 <main+0x48>
jmp    11c0 <main+0x90>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1153 <main+0x23>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1201 <main+0xd1>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d5 <main+0xa5>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   1050 <randomize@plt>
mov    $0xa,%edi
call   1040 <random@plt>
mov    %eax,(%rsp)
mov    $0x1,%ebx
jmp    115d <main+0x2d>
add    $0xffffffff,%ebx
lea    0x1(%rbx),%eax
cmp    $0x9,%ebx
mov    %eax,%ebx
jge    1190 <main+0x60>
mov    $0xa,%edi
call   1040 <random@plt>
movslq %ebx,%rcx
mov    %eax,(%rsp,%rcx,4)
test   %ecx,%ecx
jle    1153 <main+0x23>
mov    %ebx,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    (%rsp,%rdx,4),%eax
je     1150 <main+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1180 <main+0x50>
jmp    1153 <main+0x23>
mov    (%rsp),%esi
lea    0xe66(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
add    $0x30,%rsp
pop    %rbx
jmp    1030 <printf@plt>

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

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