#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*/ make_delta(int);
int /*<<< orphan*/ printf(char *, int, int);
int unisearch(int *, int);
int main(void) {
  int i, a[10] = {1, 3, 5, 6, 7, 9, 14, 15, 17, 19};
  make_delta(10);
  for (i = 0; i < 20; ++i)
    printf("%d is at index %d\n", i, unisearch(a, i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    $0xa,%edi
call   1030 <make_delta@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    11b0 <main+0x70>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <unisearch@plt>
mov    -0x34(%rbp),%esi
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x35>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xee0(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <make_delta@plt>
xor    %ebx,%ebx
mov    %rsp,%r14
lea    0xeb6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <unisearch@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x14,%ebx
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 3, i32 5, i32 6, i32 7, i32 9, i32 14, i32 15, i32 17, i32 19]
@.str = [19 x i8] c"%d is at index %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %3 to i8*
%5 = call i32 @make_delta(i32 10)
store i32 0, i32* %2
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %2
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 @unisearch(i32* %11, i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %6
18: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 3, i32 5, i32 6, i32 7, i32 9, i32 14, i32 15, i32 17, i32 19]
@.str = [19 x i8] c"%d is at index %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @make_delta(i32 10)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %9, %5 ]
%7 = call i32 @unisearch(i32* %4, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 20
br i1 %10, label %11, label %5
11: ; preds = %5
ret i32 0
}