#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 */
float const cosf(int);
float r_8x8(short *b, int x, int y, int u, int v) {
  const float ap0 = 0.3535533906f;
  const float aq0 = ap0;
  const float ap1 = 0.5f;
  const float aq1 = 0.5f;
  return (u == 0 ? ap0 : ap1) * (v == 0 ? aq0 : aq1) *
         cosf(((2 * x + 1) * u * (3.141592653589793f)) / 16) *
         cosf(((2 * y + 1) * v * (3.141592653589793f)) / 16);
}


x86 assembly (clang, -O0):
<r_8x8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xec1(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xeb4(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
movss  0xea0(%rip),%xmm0
movss  0xe9c(%rip),%xmm1
movss  %xmm1,-0x30(%rbp)
cmp    $0x0,%eax
movss  %xmm0,-0x2c(%rbp)
je     118d <r_8x8+0x7d>
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x18(%rbp),%eax
movss  0xe66(%rip),%xmm0
movss  0xe62(%rip),%xmm1
movss  %xmm1,-0x38(%rbp)
cmp    $0x0,%eax
movss  %xmm0,-0x34(%rbp)
je     11c7 <r_8x8+0xb7>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
imul   -0x14(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  0xe11(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe01(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <cosf@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
imul   -0x18(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  0xdce(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdbe(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <cosf@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_8x8>:
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %edx,%r14d
movss  0xede(%rip),%xmm0
movss  0xeda(%rip),%xmm1
movaps %xmm0,%xmm2
test   %ecx,%ecx
je     1134 <r_8x8+0x24>
movaps %xmm1,%xmm2
test   %ebx,%ebx
je     113b <r_8x8+0x2b>
movaps %xmm1,%xmm0
lea    (%rsi,%rsi,1),%eax
add    $0x1,%eax
imul   %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
mulss  0xeab(%rip),%xmm1
mulss  0xea7(%rip),%xmm1
cvttss2si %xmm1,%edi
call   1030 <cosf@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
lea    (%r14,%r14,1),%eax
add    $0x1,%eax
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xe75(%rip),%xmm0
mulss  0xe71(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1030 <cosf@plt>
mulss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @r_8x8(i16* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i16*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store i16* %0, i16** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store float 0x3FD6A09E60000000, float* %11
store float 0x3FD6A09E60000000, float* %12
store float 5.000000e-01, float* %13
store float 5.000000e-01, float* %14
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, float 0x3FD6A09E60000000, float 5.000000e-01
%19 = load i32, i32* %10
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, float 0x3FD6A09E60000000, float 5.000000e-01
%23 = fmul float %18, %22
%24 = load i32, i32* %7
%25 = mul nsw i32 2, %24
%26 = add nsw i32 %25, 1
%27 = load i32, i32* %9
%28 = mul nsw i32 %26, %27
%29 = sitofp i32 %28 to float
%30 = fmul float %29, 0x400921FB60000000
%31 = fdiv float %30, 1.600000e+01
%32 = fptosi float %31 to i32
%33 = call float @cosf(i32 %32)
%34 = fmul float %23, %33
%35 = load i32, i32* %8
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %10
%39 = mul nsw i32 %37, %38
%40 = sitofp i32 %39 to float
%41 = fmul float %40, 0x400921FB60000000
%42 = fdiv float %41, 1.600000e+01
%43 = fptosi float %42 to i32
%44 = call float @cosf(i32 %43)
%45 = fmul float %34, %44
ret float %45
}

LLVM IR (-O2):
define float @r_8x8(i16* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, float 0x3FD6A09E60000000, float 5.000000e-01
%8 = icmp eq i32 %4, 0
%9 = select i1 %8, float 0x3FD6A09E60000000, float 5.000000e-01
%10 = fmul float %7, %9
%11 = shl nsw i32 %1, 1
%12 = or i32 %11, 1
%13 = mul nsw i32 %12, %3
%14 = sitofp i32 %13 to float
%15 = fmul float %14, 0x400921FB60000000
%16 = fmul float %15, 6.250000e-02
%17 = fptosi float %16 to i32
%18 = tail call float @cosf(i32 %17)
%19 = fmul float %10, %18
%20 = shl nsw i32 %2, 1
%21 = or i32 %20, 1
%22 = mul nsw i32 %21, %4
%23 = sitofp i32 %22 to float
%24 = fmul float %23, 0x400921FB60000000
%25 = fmul float %24, 6.250000e-02
%26 = fptosi float %25 to i32
%27 = tail call float @cosf(i32 %26)
%28 = fmul float %19, %27
ret float %28
}