#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 find_index(int, int *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  srand((unsigned)time(NULL));
  int j[100], i, num;
  for (i = 0; i < 100; i++)
    j[i] = rand() % 100 + 1;
  printf("Enter a number(1-100): ");
  scanf("%d", &num);
  if (num < 0 || num > 100)
    return -1;
  printf("%d", find_index(i, j));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    11cd <main+0x6d>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x1a4(%rbp),%rax
mov    %edx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    118c <main+0x2c>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe36(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,-0x1a8(%rbp)
jl     1208 <main+0xa8>
cmpl   $0x64,-0x1a8(%rbp)
jle    1214 <main+0xb4>
movl   $0xffffffff,-0x4(%rbp)
jmp    123d <main+0xdd>
mov    -0x1a4(%rbp),%edi
lea    -0x1a0(%rbp),%rsi
call   1060 <find_index@plt>
mov    %eax,%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1180 <main+0x20>
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    $0xffffffff,%eax
cmpl   $0x64,0xc(%rsp)
ja     1201 <main+0xa1>
lea    0x10(%rsp),%rsi
mov    $0x64,%edi
call   1060 <find_index@plt>
lea    0xe22(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter a number(1-100): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 100
br i1 %28, label %29, label %30
29: ; preds = %26, %21
store i32 -1, i32* %1
br label %35
30: ; preds = %26
%31 = load i32, i32* %3
%32 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%33 = call i32 @find_index(i32 %31, i32* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %33)
store i32 0, i32* %1
br label %35
35: ; preds = %30, %29
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter a number(1-100): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = bitcast [100 x i32]* %1 to i8*
%7 = bitcast i32* %2 to i8*
br label %8
8: ; preds = %0, %8
%9 = phi i64 [ 0, %0 ], [ %14, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 100
%12 = add nsw i32 %11, 1
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %9
store i32 %12, i32* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, 100
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = icmp ugt i32 %19, 100
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%23 = call i32 @find_index(i32 100, i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %16, %21
%26 = phi i32 [ 0, %21 ], [ -1, %16 ]
ret i32 %26
}