void reduce_image(image, reduced, nx, ny) float *image, *reduced;
int nx, ny;
{
  float filter[3][3] = {
      {0.0625, 0.125, 0.0625}, {0.125, 0.25, 0.125}, {0.0625, 0.125, 0.0625}};
  int sample = 2, filter_size = 3;
  convolve3(image, nx, ny, filter, filter_size, reduced, sample);
}


x86 assembly (clang, -O0):
<reduce_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
movl   $0x2,-0x44(%rbp)
movl   $0x3,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8d
mov    -0x10(%rbp),%r9
mov    -0x44(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <convolve3@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reduce_image>:
sub    $0x38,%rsp
mov    %rsi,%r9
mov    0xf03(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x2,(%rsp)
lea    0x10(%rsp),%rax
mov    %edx,%esi
mov    %ecx,%edx
mov    %rax,%rcx
mov    $0x3,%r8d
xor    %eax,%eax
call   1030 <convolve3@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.reduce_image.filter = [3 x [3 x float]] [[3 x float] [float 6.250000e-02, float 1.250000e-01, float 6.250000e-02], [3 x float] [float 1.250000e-01, float 2.500000e-01, float 1.250000e-01], [3 x float] [float 6.250000e-02, float 1.250000e-01, float 6.250000e-02]]
define void @reduce_image(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [3 x [3 x float]]
%10 = alloca i32
%11 = alloca i32
store float* %0, float** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = bitcast [3 x [3 x float]]* %9 to i8*
store i32 2, i32* %10
store i32 3, i32* %11
%13 = load float*, float** %5
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %9, i64 0, i64 0
%17 = load i32, i32* %11
%18 = load float*, float** %6
%19 = load i32, i32* %10
%20 = call i32 (float*, i32, i32, [3 x float]*, i32, float*, i32, ...) bitcast (i32 (...)* @convolve3 to i32 (float*, i32, i32, [3 x float]*, i32, float*, i32, ...)*)(float* %13, i32 %14, i32 %15, [3 x float]* %16, i32 %17, float* %18, i32 %19)
ret void
}

LLVM IR (-O2):
@__const.reduce_image.filter = [3 x [3 x float]] [[3 x float] [float 6.250000e-02, float 1.250000e-01, float 6.250000e-02], [3 x float] [float 1.250000e-01, float 2.500000e-01, float 1.250000e-01], [3 x float] [float 6.250000e-02, float 1.250000e-01, float 6.250000e-02]]
define void @reduce_image(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca [3 x [3 x float]]
%6 = bitcast [3 x [3 x float]]* %5 to i8*
%7 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %5, i64 0, i64 0
%8 = call i32 (float*, i32, i32, [3 x float]*, i32, float*, i32, ...) bitcast (i32 (...)* @convolve3 to i32 (float*, i32, i32, [3 x float]*, i32, float*, i32, ...)*)(float* %0, i32 %2, i32 %3, [3 x float]* %7, i32 3, float* %1, i32 2)
ret void
}