#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*/ quad_interp(float *, int const, int const, float *);
int test_quad_interp() {
  const int n = 2;
  int i, j, nq = (n + 2) * (n + 2);
  float quads[4 * nq];
  float out[n * n];
  for (i = 0; i < 4 * nq; i++)
    quads[i] = 1.0f;
  quad_interp(quads, n, n, out);
  for (i = 0; i < n * n; i++)
    do {
      if (!(out[i] == 1.0f))
        return 147;
    } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_quad_interp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x2,-0x8(%rbp)
movl   $0x10,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
shl    $0x2,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    1186 <test_quad_interp+0x76>
mov    -0x48(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  0xe8d(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <test_quad_interp+0x42>
mov    -0x48(%rbp),%rdi
mov    $0x2,%edx
lea    -0x40(%rbp),%rcx
mov    %edx,%esi
call   1030 <quad_interp@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1206 <test_quad_interp+0xf6>
jmp    11b0 <test_quad_interp+0xa0>
movslq -0xc(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
movss  0xe3e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11d6 <test_quad_interp+0xc6>
jp     11d6 <test_quad_interp+0xc6>
jmp    11e9 <test_quad_interp+0xd9>
movl   $0x93,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    1214 <test_quad_interp+0x104>
jmp    11ee <test_quad_interp+0xde>
jmp    11f3 <test_quad_interp+0xe3>
jmp    11f8 <test_quad_interp+0xe8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a1 <test_quad_interp+0x91>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_quad_interp>:
sub    $0x118,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0x100(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rcx
mov    $0x2,%esi
mov    $0x2,%edx
call   1030 <quad_interp@plt>
movaps 0xe59(%rip),%xmm0
cmpneqps (%rsp),%xmm0
movmskps %xmm0,%ecx
test   %ecx,%ecx
mov    $0x93,%eax
cmove  %ecx,%eax
add    $0x118,%rsp
ret

LLVM IR (-O0):
define i32 @test_quad_interp() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 2, i32* %2
store i32 16, i32* %5
%9 = load i32, i32* %5
%10 = mul nsw i32 4, %9
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %6
%13 = alloca float, i64 %11
store i64 %11, i64* %7
%14 = alloca float, i64 4
store i32 0, i32* %3
br label %15
15: ; preds = %24, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %5
%18 = mul nsw i32 4, %17
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %13, i64 %22
store float 1.000000e+00, float* %23
br label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %15
27: ; preds = %15
%28 = call i32 @quad_interp(float* %13, i32 2, i32 2, float* %14)
store i32 0, i32* %3
br label %29
29: ; preds = %43, %27
%30 = load i32, i32* %3
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %46
32: ; preds = %29
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %14, i64 %35
%37 = load float, float* %36
%38 = fcmp oeq float %37, 1.000000e+00
br i1 %38, label %40, label %39
39: ; preds = %33
store i32 147, i32* %1
store i32 1, i32* %8
br label %47
40: ; preds = %33
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41
br label %43
43: ; preds = %42
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %29
46: ; preds = %29
store i32 0, i32* %1
store i32 1, i32* %8
br label %47
47: ; preds = %46, %39
%48 = load i8*, i8** %6
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
define i32 @test_quad_interp() {
%1 = alloca [64 x float]
%2 = alloca <4 x float>
%3 = bitcast [64 x float]* %1 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %3
%4 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 4
%5 = bitcast float* %4 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %5
%6 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 8
%7 = bitcast float* %6 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %7
%8 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 12
%9 = bitcast float* %8 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %9
%10 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 16
%11 = bitcast float* %10 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %11
%12 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 20
%13 = bitcast float* %12 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %13
%14 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 24
%15 = bitcast float* %14 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %15
%16 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 28
%17 = bitcast float* %16 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %17
%18 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 32
%19 = bitcast float* %18 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %19
%20 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 36
%21 = bitcast float* %20 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %21
%22 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 40
%23 = bitcast float* %22 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %23
%24 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 44
%25 = bitcast float* %24 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %25
%26 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 48
%27 = bitcast float* %26 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %27
%28 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 52
%29 = bitcast float* %28 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %29
%30 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 56
%31 = bitcast float* %30 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %31
%32 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 60
%33 = bitcast float* %32 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %33
%34 = getelementptr inbounds <4 x float>, <4 x float>* %2, i64 0, i64 0
%35 = getelementptr inbounds [64 x float], [64 x float]* %1, i64 0, i64 0
%36 = call i32 @quad_interp(float* %35, i32 2, i32 2, float* %34)
%37 = load <4 x float>, <4 x float>* %2
%38 = freeze <4 x float> %37
%39 = fcmp une <4 x float> %38, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
%40 = bitcast <4 x i1> %39 to i4
%41 = icmp eq i4 %40, 0
%42 = select i1 %41, i32 0, i32 147
ret i32 %42
}