#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 */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int search(int *, int, int);
int main(int argc, char *argv[]) {
  int nums[] = {279, 284, 285, 287, 288, 296, 2,   8,   10,  11,  12,  13,
                14,  19,  20,  22,  25,  26,  27,  28,  29,  33,  37,  39,
                42,  43,  47,  48,  49,  50,  57,  62,  63,  66,  68,  69,
                71,  73,  74,  77,  78,  79,  85,  89,  92,  94,  99,  111,
                113, 117, 120, 122, 125, 134, 145, 152, 155, 157, 160, 161,
                167, 168, 181, 182, 188, 189, 190, 194, 199, 201, 204, 208,
                213, 220, 223, 225, 226, 227, 231, 237, 240, 242, 247, 254,
                259, 260, 261, 264, 267, 271, 275};
  int idx = search(nums, sizeof(nums) / 4, 298);
  printf("idx = %d\n", idx);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x180(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x16c,%edx
call   1050 <memcpy@plt>
lea    -0x180(%rbp),%rdi
mov    $0x5b,%esi
mov    $0x12a,%edx
call   1040 <search@plt>
mov    %eax,-0x184(%rbp)
mov    -0x184(%rbp),%esi
lea    0xfe2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x170,%rsp
lea    0xec1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x16c,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x5b,%esi
mov    $0x12a,%edx
call   1040 <search@plt>
lea    0x1004(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x170,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [91 x i32] [i32 279, i32 284, i32 285, i32 287, i32 288, i32 296, i32 2, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 19, i32 20, i32 22, i32 25, i32 26, i32 27, i32 28, i32 29, i32 33, i32 37, i32 39, i32 42, i32 43, i32 47, i32 48, i32 49, i32 50, i32 57, i32 62, i32 63, i32 66, i32 68, i32 69, i32 71, i32 73, i32 74, i32 77, i32 78, i32 79, i32 85, i32 89, i32 92, i32 94, i32 99, i32 111, i32 113, i32 117, i32 120, i32 122, i32 125, i32 134, i32 145, i32 152, i32 155, i32 157, i32 160, i32 161, i32 167, i32 168, i32 181, i32 182, i32 188, i32 189, i32 190, i32 194, i32 199, i32 201, i32 204, i32 208, i32 213, i32 220, i32 223, i32 225, i32 226, i32 227, i32 231, i32 237, i32 240, i32 242, i32 247, i32 254, i32 259, i32 260, i32 261, i32 264, i32 267, i32 271, i32 275]
@.str = [10 x i8] c"idx = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [91 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [91 x i32]* %6 to i8*
%9 = getelementptr inbounds [91 x i32], [91 x i32]* %6, i64 0, i64 0
%10 = call i32 @search(i32* %9, i32 91, i32 298)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [91 x i32] [i32 279, i32 284, i32 285, i32 287, i32 288, i32 296, i32 2, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 19, i32 20, i32 22, i32 25, i32 26, i32 27, i32 28, i32 29, i32 33, i32 37, i32 39, i32 42, i32 43, i32 47, i32 48, i32 49, i32 50, i32 57, i32 62, i32 63, i32 66, i32 68, i32 69, i32 71, i32 73, i32 74, i32 77, i32 78, i32 79, i32 85, i32 89, i32 92, i32 94, i32 99, i32 111, i32 113, i32 117, i32 120, i32 122, i32 125, i32 134, i32 145, i32 152, i32 155, i32 157, i32 160, i32 161, i32 167, i32 168, i32 181, i32 182, i32 188, i32 189, i32 190, i32 194, i32 199, i32 201, i32 204, i32 208, i32 213, i32 220, i32 223, i32 225, i32 226, i32 227, i32 231, i32 237, i32 240, i32 242, i32 247, i32 254, i32 259, i32 260, i32 261, i32 264, i32 267, i32 271, i32 275]
@.str = [10 x i8] c"idx = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [91 x i32]
%4 = bitcast [91 x i32]* %3 to i8*
%5 = getelementptr inbounds [91 x i32], [91 x i32]* %3, i64 0, i64 0
%6 = call i32 @search(i32* %5, i32 91, i32 298)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}