#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  float score[][4] = {{60, 70, 80, 90}, {56, 89, 67, 88}, {34, 78, 90, 66}};
  float *search(float(*p)[4], int n);
  float *p;
  int i, k;
  printf("enter the number of students:");
  scanf("%d", &k);
  if (k > 2) {
    printf("please input nuber 0 or 1 or 2.\n");
    return 0;
  }
  printf("The scores of No.%d are :\n", k);
  p = search(score, k);
  for (i = 0; i < 4; i++)
    printf("%5.2f\t", *(p + i));
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x2,-0x50(%rbp)
jle    11a6 <main+0x66>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121a <main+0xda>
mov    -0x50(%rbp),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%esi
call   1040 <search@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    1205 <main+0xc5>
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11ce <main+0x8e>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x3,%esi
jl     11b1 <main+0x61>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
jmp    122c <main+0xdc>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1060 <search@plt>
mov    %rax,%rbx
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8d(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.score = [3 x [4 x float]] [[4 x float] [float 6.000000e+01, float 7.000000e+01, float 8.000000e+01, float 9.000000e+01], [4 x float] [float 5.600000e+01, float 8.900000e+01, float 6.700000e+01, float 8.800000e+01], [4 x float] [float 3.400000e+01, float 7.800000e+01, float 9.000000e+01, float 6.600000e+01]]
@.str = [30 x i8] c"enter the number of students:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"please input nuber 0 or 1 or 2.\0A\00"
@.str.3 = [27 x i8] c"The scores of No.%d are :\0A\00"
@.str.4 = [7 x i8] c"%5.2f\09\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x float]]
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [3 x [4 x float]]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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* %5)
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %35
13: ; preds = %0
%14 = load i32, i32* %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %2, i64 0, i64 0
%17 = load i32, i32* %5
%18 = call float* @search([4 x float]* %16, i32 %17)
store float* %18, float** %3
store i32 0, i32* %4
br label %19
19: ; preds = %30, %13
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load float*, float** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %23, i64 %25
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %28)
br label %30
30: ; preds = %22
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %19
33: ; preds = %19
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %35
35: ; preds = %33, %11
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@__const.main.score = [3 x [4 x float]] [[4 x float] [float 6.000000e+01, float 7.000000e+01, float 8.000000e+01, float 9.000000e+01], [4 x float] [float 5.600000e+01, float 8.900000e+01, float 6.700000e+01, float 8.800000e+01], [4 x float] [float 3.400000e+01, float 7.800000e+01, float 9.000000e+01, float 6.600000e+01]]
@.str = [30 x i8] c"enter the number of students:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [27 x i8] c"The scores of No.%d are :\0A\00"
@.str.4 = [7 x i8] c"%5.2f\09\00"
@str = [32 x i8] c"please input nuber 0 or 1 or 2.\00"
define i32 @main() {
%1 = alloca [3 x [4 x float]]
%2 = alloca i32
%3 = bitcast [3 x [4 x float]]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 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* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %32
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%13 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %1, i64 0, i64 0
%14 = load i32, i32* %2
%15 = call float* @search([4 x float]* %13, i32 %14)
%16 = load float, float* %15
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = getelementptr inbounds float, float* %15, i64 1
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %21)
%23 = getelementptr inbounds float, float* %15, i64 2
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %25)
%27 = getelementptr inbounds float, float* %15, i64 3
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %29)
%31 = call i32 @putchar(i32 10)
br label %32
32: ; preds = %11, %9
ret i32 0
}