#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 */
unsigned int bsearch_seq(unsigned int, unsigned int *, unsigned int, int, int);
unsigned int i_to_T(unsigned int, unsigned int, unsigned int);
unsigned int tsearch_seq(unsigned int, unsigned int *, unsigned int,
                         unsigned int, int *, int *, int *);
unsigned int t_bsearch_seq(unsigned int key, unsigned int *D,
                           unsigned int D_size, unsigned int *T,
                           unsigned int T_size) {
  int hi, lo, hit;
  unsigned int region = tsearch_seq(key, T, T_size, D_size, &hi, &lo, &hit);
  if (hit == 1)
    return i_to_T(region, T_size, D_size);
  else
    return bsearch_seq(key, D, D_size, lo, hi);
}


x86 assembly (clang, -O0):
<t_bsearch_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    -0x28(%rbp),%r8
lea    -0x2c(%rbp),%r9
lea    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <tsearch_seq@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    118f <t_bsearch_seq+0x5f>
mov    -0x34(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <i_to_T@plt>
mov    %eax,-0x4(%rbp)
jmp    11a8 <t_bsearch_seq+0x78>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   1050 <bsearch_seq@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_bsearch_seq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r15d
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %rcx,%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1040 <tsearch_seq@plt>
cmpl   $0x1,0xc(%rsp)
jne    1179 <t_bsearch_seq+0x49>
mov    %eax,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1030 <i_to_T@plt>
jmp    118e <t_bsearch_seq+0x5e>
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%r8d
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <bsearch_seq@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @t_bsearch_seq(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
%16 = load i32, i32* %7
%17 = load i32*, i32** %10
%18 = load i32, i32* %11
%19 = load i32, i32* %9
%20 = call i32 @tsearch_seq(i32 %16, i32* %17, i32 %18, i32 %19, i32* %12, i32* %13, i32* %14)
store i32 %20, i32* %15
%21 = load i32, i32* %14
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %28
23: ; preds = %5
%24 = load i32, i32* %15
%25 = load i32, i32* %11
%26 = load i32, i32* %9
%27 = call i32 @i_to_T(i32 %24, i32 %25, i32 %26)
store i32 %27, i32* %6
br label %35
28: ; preds = %5
%29 = load i32, i32* %7
%30 = load i32*, i32** %8
%31 = load i32, i32* %9
%32 = load i32, i32* %13
%33 = load i32, i32* %12
%34 = call i32 @bsearch_seq(i32 %29, i32* %30, i32 %31, i32 %32, i32 %33)
store i32 %34, i32* %6
br label %35
35: ; preds = %28, %23
%36 = load i32, i32* %6
ret i32 %36
}

LLVM IR (-O2):
define i32 @t_bsearch_seq(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %6 to i8*
%10 = bitcast i32* %7 to i8*
%11 = bitcast i32* %8 to i8*
%12 = call i32 @tsearch_seq(i32 %0, i32* %3, i32 %4, i32 %2, i32* %6, i32* %7, i32* %8)
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = call i32 @i_to_T(i32 %12, i32 %4, i32 %2)
br label %21
17: ; preds = %5
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @bsearch_seq(i32 %0, i32* %1, i32 %2, i32 %18, i32 %19)
br label %21
21: ; preds = %17, %15
%22 = phi i32 [ %16, %15 ], [ %20, %17 ]
ret i32 %22
}