#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 rank(int *, int, int);
int test_non_repeating() {
  int array[] = {5, 3, 8, 7, 1, 4, 9, 2, 6};
  return 1 == rank(array, 9, 0) && 2 == rank(array, 9, 1) &&
         3 == rank(array, 9, 2) && 4 == rank(array, 9, 3) &&
         5 == rank(array, 9, 4) && 6 == rank(array, 9, 5) &&
         7 == rank(array, 9, 6) && 8 == rank(array, 9, 7) &&
         9 == rank(array, 9, 8);
}


x86 assembly (clang, -O0):
<test_non_repeating>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
xor    %edx,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x2,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x2,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x3,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x4,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x4,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x5,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x5,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x6,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x6,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x7,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x7,%edx
call   1030 <rank@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x8,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    1294 <test_non_repeating+0x174>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0x8,%edx
call   1030 <rank@plt>
mov    %eax,%ecx
mov    $0x9,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_non_repeating>:
push   %rbx
sub    $0x30,%rsp
mov    0xf05(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %ebx,%ebx
mov    $0x9,%esi
xor    %edx,%edx
call   1030 <rank@plt>
cmp    $0x1,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   1030 <rank@plt>
cmp    $0x2,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x2,%edx
call   1030 <rank@plt>
cmp    $0x3,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x3,%edx
call   1030 <rank@plt>
cmp    $0x4,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x4,%edx
call   1030 <rank@plt>
cmp    $0x5,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x5,%edx
call   1030 <rank@plt>
cmp    $0x6,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x6,%edx
call   1030 <rank@plt>
cmp    $0x7,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x7,%edx
call   1030 <rank@plt>
cmp    $0x8,%eax
jne    1213 <test_non_repeating+0x103>
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0x8,%edx
call   1030 <rank@plt>
xor    %ebx,%ebx
cmp    $0x9,%eax
sete   %bl
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_non_repeating.array = [9 x i32] [i32 5, i32 3, i32 8, i32 7, i32 1, i32 4, i32 9, i32 2, i32 6]
define i32 @test_non_repeating() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @rank(i32* %3, i32 9, i32 0)
%5 = icmp eq i32 1, %4
br i1 %5, label %6, label %38
6: ; preds = %0
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%8 = call i32 @rank(i32* %7, i32 9, i32 1)
%9 = icmp eq i32 2, %8
br i1 %9, label %10, label %38
10: ; preds = %6
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%12 = call i32 @rank(i32* %11, i32 9, i32 2)
%13 = icmp eq i32 3, %12
br i1 %13, label %14, label %38
14: ; preds = %10
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%16 = call i32 @rank(i32* %15, i32 9, i32 3)
%17 = icmp eq i32 4, %16
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%20 = call i32 @rank(i32* %19, i32 9, i32 4)
%21 = icmp eq i32 5, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%24 = call i32 @rank(i32* %23, i32 9, i32 5)
%25 = icmp eq i32 6, %24
br i1 %25, label %26, label %38
26: ; preds = %22
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%28 = call i32 @rank(i32* %27, i32 9, i32 6)
%29 = icmp eq i32 7, %28
br i1 %29, label %30, label %38
30: ; preds = %26
%31 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%32 = call i32 @rank(i32* %31, i32 9, i32 7)
%33 = icmp eq i32 8, %32
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%36 = call i32 @rank(i32* %35, i32 9, i32 8)
%37 = icmp eq i32 9, %36
br label %38
38: ; preds = %34, %30, %26, %22, %18, %14, %10, %6, %0
%39 = phi i1 [ false, %30 ], [ false, %26 ], [ false, %22 ], [ false, %18 ], [ false, %14 ], [ false, %10 ], [ false, %6 ], [ false, %0 ], [ %37, %34 ]
%40 = zext i1 %39 to i32
ret i32 %40
}

LLVM IR (-O2):
@__const.test_non_repeating.array = [9 x i32] [i32 5, i32 3, i32 8, i32 7, i32 1, i32 4, i32 9, i32 2, i32 6]
define i32 @test_non_repeating() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @rank(i32* %3, i32 9, i32 0)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %31
6: ; preds = %0
%7 = call i32 @rank(i32* %3, i32 9, i32 1)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %31
9: ; preds = %6
%10 = call i32 @rank(i32* %3, i32 9, i32 2)
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = call i32 @rank(i32* %3, i32 9, i32 3)
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = call i32 @rank(i32* %3, i32 9, i32 4)
%17 = icmp eq i32 %16, 5
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = call i32 @rank(i32* %3, i32 9, i32 5)
%20 = icmp eq i32 %19, 6
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = call i32 @rank(i32* %3, i32 9, i32 6)
%23 = icmp eq i32 %22, 7
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = call i32 @rank(i32* %3, i32 9, i32 7)
%26 = icmp eq i32 %25, 8
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = call i32 @rank(i32* %3, i32 9, i32 8)
%29 = icmp eq i32 %28, 9
%30 = zext i1 %29 to i32
br label %31
31: ; preds = %27, %24, %21, %18, %15, %12, %9, %6, %0
%32 = phi i32 [ 0, %24 ], [ 0, %21 ], [ 0, %18 ], [ 0, %15 ], [ 0, %12 ], [ 0, %9 ], [ 0, %6 ], [ 0, %0 ], [ %30, %27 ]
ret i32 %32
}