#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 *, float);
int /*<<< orphan*/ scanf(char *, int *, int *);
float *search(float **, int);
void returnPointerFunction() {
  float score[][4] = {{66, 77, 88, 99},
                      {666, 727, 868, 994},
                      {666, 757, 848, 939},
                      {166, 277, 188, 199}};
  float(*ps)[4] = score;
  float *p;
  int i, k;
  scanf("%d %d", &i, &k);
  p = search(score, k);
  printf("%f", *(p + i));
}


x86 assembly (clang, -O0):
<returnPointerFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x40(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xed4(%rip),%rdi
lea    -0x54(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1060 <scanf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1040 <search@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnPointerFunction>:
sub    $0x58,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1040 <search@plt>
movslq 0xc(%rsp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.returnPointerFunction.score = [4 x [4 x float]] [[4 x float] [float 6.600000e+01, float 7.700000e+01, float 8.800000e+01, float 9.900000e+01], [4 x float] [float 6.660000e+02, float 7.270000e+02, float 8.680000e+02, float 9.940000e+02], [4 x float] [float 6.660000e+02, float 7.570000e+02, float 8.480000e+02, float 9.390000e+02], [4 x float] [float 1.660000e+02, float 2.770000e+02, float 1.880000e+02, float 1.990000e+02]]
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%f\00"
define void @returnPointerFunction() {
%1 = alloca [4 x [4 x float]]
%2 = alloca [4 x float]*
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [4 x [4 x float]]* %1 to i8*
%7 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %1, i64 0, i64 0
store [4 x float]* %7, [4 x float]** %2
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%9 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %1, i64 0, i64 0
%10 = bitcast [4 x float]* %9 to float**
%11 = load i32, i32* %5
%12 = call float* @search(float** %10, i32 %11)
store float* %12, float** %3
%13 = load float*, float** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds float, float* %13, i64 %15
%17 = load float, float* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %17)
ret void
}

LLVM IR (-O2):
@__const.returnPointerFunction.score = [4 x [4 x float]] [[4 x float] [float 6.600000e+01, float 7.700000e+01, float 8.800000e+01, float 9.900000e+01], [4 x float] [float 6.660000e+02, float 7.270000e+02, float 8.680000e+02, float 9.940000e+02], [4 x float] [float 6.660000e+02, float 7.570000e+02, float 8.480000e+02, float 9.390000e+02], [4 x float] [float 1.660000e+02, float 2.770000e+02, float 1.880000e+02, float 1.990000e+02]]
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%f\00"
define void @returnPointerFunction() {
%1 = alloca [4 x [4 x float]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [4 x [4 x float]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%8 = bitcast [4 x [4 x float]]* %1 to float**
%9 = load i32, i32* %3
%10 = call float* @search(float** %8, i32 %9)
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds float, float* %10, i64 %12
%14 = load float, float* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %14)
ret void
}