#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*/ af_filter_bilinear(float *, float *, float *, float,
                                      float *);
int /*<<< orphan*/ af_filter_prewarp(float *, float, float);
int /*<<< orphan*/ memcpy(float *, float const *, int);
int af_filter_szxform(const float *a, const float *b, float Q, float fc,
                      float fs, float *k, float *coef) {
  float at[3];
  float bt[3];
  if (!a || !b || !k || !coef || (Q > 1000.0 || Q < 1.0))
    return -1;
  memcpy(at, a, 3 * sizeof(float));
  memcpy(bt, b, 3 * sizeof(float));
  bt[1] /= Q;
  af_filter_prewarp(at, fc, fs);
  af_filter_prewarp(bt, fc, fs);
  af_filter_bilinear(at, bt, k, fs, coef);
  return 0;
}


x86 assembly (clang, -O0):
<af_filter_szxform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
movss  %xmm2,-0x24(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b9 <af_filter_szxform+0x89>
cmpq   $0x0,-0x18(%rbp)
je     11b9 <af_filter_szxform+0x89>
cmpq   $0x0,-0x30(%rbp)
je     11b9 <af_filter_szxform+0x89>
cmpq   $0x0,-0x38(%rbp)
je     11b9 <af_filter_szxform+0x89>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6c(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11b9 <af_filter_szxform+0x89>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe59(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c5 <af_filter_szxform+0x95>
movl   $0xffffffff,-0x4(%rbp)
jmp    1243 <af_filter_szxform+0x113>
lea    -0x44(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1030 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1030 <memcpy@plt>
movss  -0x1c(%rbp),%xmm1
movss  -0x4c(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
lea    -0x44(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
call   1040 <af_filter_prewarp@plt>
lea    -0x50(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
call   1040 <af_filter_prewarp@plt>
lea    -0x44(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x30(%rbp),%rdx
movss  -0x24(%rbp),%xmm0
mov    -0x38(%rbp),%rcx
call   1050 <af_filter_bilinear@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_filter_szxform>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movss  0xebb(%rip),%xmm3
ucomiss %xmm0,%xmm3
mov    $0xffffffff,%eax
ja     121c <af_filter_szxform+0xec>
ucomiss 0xeaa(%rip),%xmm0
ja     121c <af_filter_szxform+0xec>
mov    %rsi,%rbx
mov    %rdi,%rsi
test   %rdi,%rdi
je     121c <af_filter_szxform+0xec>
test   %rbx,%rbx
je     121c <af_filter_szxform+0xec>
mov    %rdx,%r15
test   %rdx,%rdx
je     121c <af_filter_szxform+0xec>
mov    %rcx,%r14
test   %rcx,%rcx
je     121c <af_filter_szxform+0xec>
lea    0x24(%rsp),%r12
mov    %r12,%rdi
mov    $0xc,%edx
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
call   1030 <memcpy@plt>
lea    0x18(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1030 <memcpy@plt>
movss  0x1c(%rsp),%xmm0
divss  0x14(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
mov    %r12,%rdi
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <af_filter_prewarp@plt>
mov    %r13,%rdi
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <af_filter_prewarp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
movss  0xc(%rsp),%xmm0
mov    %r14,%rcx
call   1050 <af_filter_bilinear@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @af_filter_szxform(float* %0, float* %1, float %2, float %3, float %4, float* %5, float* %6) {
%8 = alloca i32
%9 = alloca float*
%10 = alloca float*
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float*
%15 = alloca float*
%16 = alloca [3 x float]
%17 = alloca [3 x float]
store float* %0, float** %9
store float* %1, float** %10
store float %2, float* %11
store float %3, float* %12
store float %4, float* %13
store float* %5, float** %14
store float* %6, float** %15
%18 = load float*, float** %9
%19 = icmp ne float* %18, null
br i1 %19, label %20, label %37
20: ; preds = %7
%21 = load float*, float** %10
%22 = icmp ne float* %21, null
br i1 %22, label %23, label %37
23: ; preds = %20
%24 = load float*, float** %14
%25 = icmp ne float* %24, null
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = load float*, float** %15
%28 = icmp ne float* %27, null
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load float, float* %11
%31 = fpext float %30 to double
%32 = fcmp ogt double %31, 1.000000e+03
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load float, float* %11
%35 = fpext float %34 to double
%36 = fcmp olt double %35, 1.000000e+00
br i1 %36, label %37, label %38
37: ; preds = %33, %29, %26, %23, %20, %7
store i32 -1, i32* %8
br label %63
38: ; preds = %33
%39 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%40 = load float*, float** %9
%41 = call i32 @memcpy(float* %39, float* %40, i32 12)
%42 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%43 = load float*, float** %10
%44 = call i32 @memcpy(float* %42, float* %43, i32 12)
%45 = load float, float* %11
%46 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%47 = load float, float* %46
%48 = fdiv float %47, %45
store float %48, float* %46
%49 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%50 = load float, float* %12
%51 = load float, float* %13
%52 = call i32 @af_filter_prewarp(float* %49, float %50, float %51)
%53 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%54 = load float, float* %12
%55 = load float, float* %13
%56 = call i32 @af_filter_prewarp(float* %53, float %54, float %55)
%57 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%58 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%59 = load float*, float** %14
%60 = load float, float* %13
%61 = load float*, float** %15
%62 = call i32 @af_filter_bilinear(float* %57, float* %58, float* %59, float %60, float* %61)
store i32 0, i32* %8
br label %63
63: ; preds = %38, %37
%64 = load i32, i32* %8
ret i32 %64
}

LLVM IR (-O2):
define i32 @af_filter_szxform(float* %0, float* %1, float %2, float %3, float %4, float* %5, float* %6) {
%8 = alloca [3 x float]
%9 = alloca [3 x float]
%10 = bitcast [3 x float]* %8 to i8*
%11 = bitcast [3 x float]* %9 to i8*
%12 = icmp ne float* %0, null
%13 = icmp ne float* %1, null
%14 = and i1 %12, %13
%15 = icmp ne float* %5, null
%16 = and i1 %14, %15
%17 = icmp ne float* %6, null
%18 = and i1 %16, %17
%19 = xor i1 %18, true
%20 = fcmp ogt float %2, 1.000000e+03
%21 = or i1 %20, %19
%22 = fcmp olt float %2, 1.000000e+00
%23 = or i1 %22, %21
br i1 %23, label %35, label %24
24: ; preds = %7
%25 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%26 = call i32 @memcpy(float* %25, float* %0, i32 12)
%27 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%28 = call i32 @memcpy(float* %27, float* %1, i32 12)
%29 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%30 = load float, float* %29
%31 = fdiv float %30, %2
store float %31, float* %29
%32 = call i32 @af_filter_prewarp(float* %25, float %3, float %4)
%33 = call i32 @af_filter_prewarp(float* %27, float %3, float %4)
%34 = call i32 @af_filter_bilinear(float* %25, float* %27, float* %5, float %4, float* %6)
br label %35
35: ; preds = %7, %24
%36 = phi i32 [ 0, %24 ], [ -1, %7 ]
ret i32 %36
}