#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 RecurBianrySearch(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n, m, a[100000], b[100000];
  printf("Please input the number of integers:");
  scanf("%d", &n);
  printf("Please input the number of you want to search:");
  scanf("%d", &m);
  printf("Please input the integers:");
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);
  printf("Please input the integers you want to search:");
  for (i = 0; i < m; i++)
    scanf("%d", &b[i]);
  printf("The elements' sudirript in the array are:");
  for (i = 0; i < m; i++)
    printf("%d ", RecurBianrySearch(a, 0, n - 1, b[i]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3510,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cb <main+0x9b>
movslq -0x8(%rbp),%rax
lea    -0x61a90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe6d(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <main+0x63>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1218 <main+0xe8>
movslq -0x8(%rbp),%rax
lea    -0xc3510(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe20(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e0 <main+0xb0>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1276 <main+0x146>
lea    -0x61a90(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
movslq -0x8(%rbp),%rax
mov    -0xc3510(%rbp,%rax,4),%ecx
xor    %esi,%esi
call   1050 <RecurBianrySearch@plt>
mov    %eax,%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122d <main+0xfd>
xor    %eax,%eax
add    $0xc3510,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xc3510,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11bd <main+0x8d>
lea    0x61a90(%rsp),%r15
xor    %ebx,%ebx
lea    0xe86(%rip),%r14
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x70>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11fd <main+0xcd>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe45(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11e0 <main+0xb0>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    125f <main+0x12f>
lea    0x61a90(%rsp),%r14
lea    0xea9(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    0x10(%rsp,%rbx,4),%ecx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <RecurBianrySearch@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1230 <main+0x100>
xor    %eax,%eax
add    $0xc3510,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Please input the number of integers:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"Please input the number of you want to search:\00"
@.str.3 = [27 x i8] c"Please input the integers:\00"
@.str.4 = [46 x i8] c"Please input the integers you want to search:\00"
@.str.5 = [42 x i8] c"The elements' sudirript in the array are:\00"
@.str.6 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100000 x i32]
%6 = alloca [100000 x i32]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %21, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100000 x i32], [100000 x i32]* %5, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %12
24: ; preds = %12
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %26
26: ; preds = %35, %24
%27 = load i32, i32* %2
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %38
30: ; preds = %26
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
br label %35
35: ; preds = %30
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %26
38: ; preds = %26
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %2
br label %40
40: ; preds = %54, %38
%41 = load i32, i32* %2
%42 = load i32, i32* %4
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %57
44: ; preds = %40
%45 = getelementptr inbounds [100000 x i32], [100000 x i32]* %5, i64 0, i64 0
%46 = load i32, i32* %3
%47 = sub nsw i32 %46, 1
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 @RecurBianrySearch(i32* %45, i32 0, i32 %47, i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %44
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %40
57: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Please input the number of integers:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"Please input the number of you want to search:\00"
@.str.3 = [27 x i8] c"Please input the integers:\00"
@.str.4 = [46 x i8] c"Please input the integers you want to search:\00"
@.str.5 = [42 x i8] c"The elements' sudirript in the array are:\00"
@.str.6 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100000 x i32]
%4 = alloca [100000 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast [100000 x i32]* %3 to i8*
%8 = bitcast [100000 x i32]* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %0, %16
%17 = phi i64 [ %20, %16 ], [ 0, %0 ]
%18 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = add nuw nsw i64 %17, 1
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %16, label %24
24: ; preds = %16, %0
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%26 = load i32, i32* %2
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %24, %28
%29 = phi i64 [ %32, %28 ], [ 0, %24 ]
%30 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %30)
%32 = add nuw nsw i64 %29, 1
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %28, label %36
36: ; preds = %28, %24
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* %2
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %54
40: ; preds = %36
%41 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 0
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %50, %42 ]
%44 = load i32, i32* %1
%45 = add nsw i32 %44, -1
%46 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %43
%47 = load i32, i32* %46
%48 = call i32 @RecurBianrySearch(i32* %41, i32 0, i32 %45, i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %48)
%50 = add nuw nsw i64 %43, 1
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %50, %52
br i1 %53, label %42, label %54
54: ; preds = %42, %36
ret i32 0
}