#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*/ exit(int);
int fibsearch(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int found;
  int value;
  while (1) {
    printf("\n请输入查找值（0-500） == >");
    scanf("%d", &value);
    if (value != -1) {
      found = fibsearch(21, value);
      if (found != -1) {
        printf("找到查找值：%d[%d]\n", value, found);
      } else {
        printf("没有找到查找值：%d\n", value);
      }
    } else
      exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     11c0 <main+0x80>
mov    -0xc(%rbp),%esi
mov    $0x15,%edi
call   1040 <fibsearch@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     11aa <main+0x6a>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <main+0x7b>
mov    -0xc(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ca <main+0x8a>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    114f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0xffffffff,%esi
jne    117f <main+0x3f>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xebb(%rip),%r14
lea    0xe73(%rip),%r15
lea    0xe90(%rip),%r12
lea    0xc(%rsp),%rbx
lea    0xe87(%rip),%r13
jmp    11d8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0xffffffff,%esi
je     1175 <main+0x35>
mov    $0x15,%edi
call   1040 <fibsearch@plt>
mov    0xc(%rsp),%esi
cmp    $0xffffffff,%eax
je     11b0 <main+0x70>
mov    %r13,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11ba <main+0x7a>

LLVM IR (-O0):
@.str = [36 x i8] c"\0A\E8\AF\B7\E8\BE\93\E5\85\A5\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\880-500\EF\BC\89 == >\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\E6\89\BE\E5\88\B0\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\9A%d[%d]\0A\00"
@.str.3 = [28 x i8] c"\E6\B2\A1\E6\9C\89\E6\89\BE\E5\88\B0\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\9A%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %24
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %22
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i32 @fibsearch(i32 21, i32 %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
br label %21
18: ; preds = %9
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %14
br label %24
22: ; preds = %4
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %21
br label %4
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0A\E8\AF\B7\E8\BE\93\E5\85\A5\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\880-500\EF\BC\89 == >\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\E6\89\BE\E5\88\B0\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\9A%d[%d]\0A\00"
@.str.3 = [28 x i8] c"\E6\B2\A1\E6\9C\89\E6\89\BE\E5\88\B0\E6\9F\A5\E6\89\BE\E5\80\BC\EF\BC\9A%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %16, label %7
7: ; preds = %0, %18
%8 = phi i32 [ %21, %18 ], [ %5, %0 ]
%9 = call i32 @fibsearch(i32 21, i32 %8)
%10 = icmp eq i32 %9, -1
%11 = load i32, i32* %1
br i1 %10, label %14, label %12
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %9)
br label %18
14: ; preds = %7
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %11)
br label %18
16: ; preds = %18, %0
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %12, %14
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = icmp eq i32 %21, -1
br i1 %22, label %16, label %7
}