void main() {
  int stu_num[10] = {12, 5, 7, 30, 10, 13, 15, 17, 20, 9};
  char stu_name[10][30] = {"lixiang", "xijun", "aiyeliang", "boxue", "kankan",
                           "lijun",   "caiji", "doesit",    "doit",  "likeit"};
  int i, want;
  void sort(int[], char stu_name[][30]);
  void search(int, int[], char stu_name[][30]);
  sort(stu_num, stu_name);
  scanf("%d", &want);
  search(want, stu_num, stu_name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
lea    -0x30(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x160(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x12c,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x160(%rbp),%rsi
call   1030 <sort@plt>
lea    0xfcd(%rip),%rdi
lea    -0x168(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x168(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1040 <search@plt>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x178,%rsp
mov    0xecf(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xebb(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    $0x12c,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <sort@plt>
lea    0xfbe(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <search@plt>
add    $0x178,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.stu_num = [10 x i32] [i32 12, i32 5, i32 7, i32 30, i32 10, i32 13, i32 15, i32 17, i32 20, i32 9]
@__const.main.stu_name = [10 x [30 x i8]] [[30 x i8] c"lixiang\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"xijun\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"aiyeliang\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"boxue\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"kankan\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"lijun\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"caiji\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"doesit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"doit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"likeit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x [30 x i8]]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [10 x i32]* %1 to i8*
%6 = bitcast [10 x [30 x i8]]* %2 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %2, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%12 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %2, i64 0, i64 0
ret void
}

LLVM IR (-O2):
@__const.main.stu_num = [10 x i32] [i32 12, i32 5, i32 7, i32 30, i32 10, i32 13, i32 15, i32 17, i32 20, i32 9]
@__const.main.stu_name = [10 x [30 x i8]] [[30 x i8] c"lixiang\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"xijun\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"aiyeliang\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"boxue\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"kankan\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"lijun\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"caiji\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"doesit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"doit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"likeit\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x [30 x i8]]
%3 = alloca i32
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %2, i64 0, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %2, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
ret void
}