#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*/ OsdComputeTensorProductPatchWeights(
    float, int /*<<< orphan*/, float *, float *, float *, float *, float *,
    float *, float *, float *, float *, float *, float *, float *);
int /*<<< orphan*/ OsdGetBezierWeights(float, float *, float *, float *);
void OsdGetBezierPatchWeights(float s, float t, float dScale, float wP[16],
                              float wDS[16], float wDT[16], float wDSS[16],
                              float wDST[16], float wDTT[16]) {
  float sWeights[4], tWeights[4], dsWeights[4], dtWeights[4], dssWeights[4],
      dttWeights[4];
  OsdGetBezierWeights(s, (wP ? sWeights : 0), (wDS ? dsWeights : 0),
                      (wDSS ? dssWeights : 0));
  OsdGetBezierWeights(t, (wP ? tWeights : 0), (wDT ? dtWeights : 0),
                      (wDTT ? dttWeights : 0));
  OsdComputeTensorProductPatchWeights(dScale, 0, sWeights, tWeights, dsWeights,
                                      dtWeights, dssWeights, dttWeights, wP,
                                      wDS, wDT, wDSS, wDST, wDTT);
}


x86 assembly (clang, -O0):
<OsdGetBezierPatchWeights>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x140,%rsp
movss  %xmm0,-0x24(%rbp)
movss  %xmm1,-0x28(%rbp)
movss  %xmm2,-0x2c(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x48(%rbp)
mov    %rcx,-0x50(%rbp)
mov    %r8,-0x58(%rbp)
mov    %r9,-0x60(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0xc4(%rbp)
ff
cmpq   $0x0,-0x38(%rbp)
je     1181 <OsdGetBezierPatchWeights+0x61>
lea    -0x70(%rbp),%rax
mov    %rax,-0xd0(%rbp)
jmp    118f <OsdGetBezierPatchWeights+0x6f>
xor    %eax,%eax
mov    %rax,-0xd0(%rbp)
jmp    118f <OsdGetBezierPatchWeights+0x6f>
mov    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     11bb <OsdGetBezierPatchWeights+0x9b>
lea    -0x90(%rbp),%rax
mov    %rax,-0xe0(%rbp)
jmp    11c9 <OsdGetBezierPatchWeights+0xa9>
xor    %eax,%eax
mov    %rax,-0xe0(%rbp)
jmp    11c9 <OsdGetBezierPatchWeights+0xa9>
mov    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     11f5 <OsdGetBezierPatchWeights+0xd5>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
jmp    1203 <OsdGetBezierPatchWeights+0xe3>
xor    %eax,%eax
mov    %rax,-0xf0(%rbp)
jmp    1203 <OsdGetBezierPatchWeights+0xe3>
mov    -0xe8(%rbp),%rsi
mov    -0xd8(%rbp),%rdi
movss  -0xc4(%rbp),%xmm0
ff
mov    -0xf0(%rbp),%rdx
call   1030 <OsdGetBezierWeights@plt>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0xf4(%rbp)
ff
cmpq   $0x0,-0x38(%rbp)
je     124d <OsdGetBezierPatchWeights+0x12d>
lea    -0x80(%rbp),%rax
mov    %rax,-0x100(%rbp)
jmp    125b <OsdGetBezierPatchWeights+0x13b>
xor    %eax,%eax
mov    %rax,-0x100(%rbp)
jmp    125b <OsdGetBezierPatchWeights+0x13b>
mov    -0x100(%rbp),%rax
mov    %rax,-0x108(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1287 <OsdGetBezierPatchWeights+0x167>
lea    -0xa0(%rbp),%rax
mov    %rax,-0x110(%rbp)
jmp    1295 <OsdGetBezierPatchWeights+0x175>
xor    %eax,%eax
mov    %rax,-0x110(%rbp)
jmp    1295 <OsdGetBezierPatchWeights+0x175>
mov    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     12c1 <OsdGetBezierPatchWeights+0x1a1>
lea    -0xc0(%rbp),%rax
mov    %rax,-0x120(%rbp)
jmp    12cf <OsdGetBezierPatchWeights+0x1af>
xor    %eax,%eax
mov    %rax,-0x120(%rbp)
jmp    12cf <OsdGetBezierPatchWeights+0x1af>
mov    -0x118(%rbp),%rsi
mov    -0x108(%rbp),%rdi
movss  -0xf4(%rbp),%xmm0
ff
mov    -0x120(%rbp),%rdx
call   1030 <OsdGetBezierWeights@plt>
movss  -0x2c(%rbp),%xmm0
lea    -0x70(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    -0xa0(%rbp),%r8
lea    -0xb0(%rbp),%r9
lea    -0xc0(%rbp),%r12
mov    -0x38(%rbp),%r15
mov    -0x40(%rbp),%r14
mov    -0x48(%rbp),%rbx
mov    -0x50(%rbp),%r11
mov    -0x58(%rbp),%r10
mov    -0x60(%rbp),%rax
xor    %edi,%edi
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1040 <OsdComputeTensorProductPatchWeights@plt>
add    $0x140,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<OsdGetBezierPatchWeights>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%rbp
mov    %r8,0x8(%rsp)
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movss  %xmm2,0x4(%rsp)
movss  %xmm1,(%rsp)
test   %rsi,%rsi
lea    0x40(%rsp),%rsi
cmove  %r14,%rsi
test   %rcx,%rcx
lea    0x20(%rsp),%rdx
cmove  %rcx,%rdx
test   %rdi,%rdi
lea    0x60(%rsp),%rdi
cmove  %rbx,%rdi
lea    0x50(%rsp),%r13
cmove  %rbx,%r13
call   1030 <OsdGetBezierWeights@plt>
test   %r15,%r15
lea    0x30(%rsp),%rsi
cmove  %r15,%rsi
test   %rbp,%rbp
lea    0x10(%rsp),%rdx
cmove  %rbp,%rdx
movss  (%rsp),%xmm0
mov    %r13,%rdi
call   1030 <OsdGetBezierWeights@plt>
sub    $0x8,%rsp
movss  0xc(%rsp),%xmm0
xor    %edi,%edi
lea    0x68(%rsp),%rsi
lea    0x58(%rsp),%rdx
lea    0x48(%rsp),%rcx
lea    0x38(%rsp),%r8
lea    0x28(%rsp),%r9
push   %rbp
push   0x18(%rsp)
push   %r12
push   %r15
push   %r14
push   %rbx
lea    0x48(%rsp),%rax
push   %rax
call   1040 <OsdComputeTensorProductPatchWeights@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @OsdGetBezierPatchWeights(float %0, float %1, float %2, float* %3, float* %4, float* %5, float* %6, float* %7, float* %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca float*
%17 = alloca float*
%18 = alloca float*
%19 = alloca [4 x float]
%20 = alloca [4 x float]
%21 = alloca [4 x float]
%22 = alloca [4 x float]
%23 = alloca [4 x float]
%24 = alloca [4 x float]
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store float* %3, float** %13
store float* %4, float** %14
store float* %5, float** %15
store float* %6, float** %16
store float* %7, float** %17
store float* %8, float** %18
%25 = load float, float* %10
%26 = load float*, float** %13
%27 = icmp ne float* %26, null
br i1 %27, label %28, label %30
28: ; preds = %9
%29 = getelementptr inbounds [4 x float], [4 x float]* %19, i64 0, i64 0
br label %31
30: ; preds = %9
br label %31
31: ; preds = %30, %28
%32 = phi float* [ %29, %28 ], [ null, %30 ]
%33 = load float*, float** %14
%34 = icmp ne float* %33, null
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = getelementptr inbounds [4 x float], [4 x float]* %21, i64 0, i64 0
br label %38
37: ; preds = %31
br label %38
38: ; preds = %37, %35
%39 = phi float* [ %36, %35 ], [ null, %37 ]
%40 = load float*, float** %16
%41 = icmp ne float* %40, null
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = getelementptr inbounds [4 x float], [4 x float]* %23, i64 0, i64 0
br label %45
44: ; preds = %38
br label %45
45: ; preds = %44, %42
%46 = phi float* [ %43, %42 ], [ null, %44 ]
%47 = call i32 @OsdGetBezierWeights(float %25, float* %32, float* %39, float* %46)
%48 = load float, float* %11
%49 = load float*, float** %13
%50 = icmp ne float* %49, null
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = getelementptr inbounds [4 x float], [4 x float]* %20, i64 0, i64 0
br label %54
53: ; preds = %45
br label %54
54: ; preds = %53, %51
%55 = phi float* [ %52, %51 ], [ null, %53 ]
%56 = load float*, float** %15
%57 = icmp ne float* %56, null
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = getelementptr inbounds [4 x float], [4 x float]* %22, i64 0, i64 0
br label %61
60: ; preds = %54
br label %61
61: ; preds = %60, %58
%62 = phi float* [ %59, %58 ], [ null, %60 ]
%63 = load float*, float** %18
%64 = icmp ne float* %63, null
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = getelementptr inbounds [4 x float], [4 x float]* %24, i64 0, i64 0
br label %68
67: ; preds = %61
br label %68
68: ; preds = %67, %65
%69 = phi float* [ %66, %65 ], [ null, %67 ]
%70 = call i32 @OsdGetBezierWeights(float %48, float* %55, float* %62, float* %69)
%71 = load float, float* %12
%72 = getelementptr inbounds [4 x float], [4 x float]* %19, i64 0, i64 0
%73 = getelementptr inbounds [4 x float], [4 x float]* %20, i64 0, i64 0
%74 = getelementptr inbounds [4 x float], [4 x float]* %21, i64 0, i64 0
%75 = getelementptr inbounds [4 x float], [4 x float]* %22, i64 0, i64 0
%76 = getelementptr inbounds [4 x float], [4 x float]* %23, i64 0, i64 0
%77 = getelementptr inbounds [4 x float], [4 x float]* %24, i64 0, i64 0
%78 = load float*, float** %13
%79 = load float*, float** %14
%80 = load float*, float** %15
%81 = load float*, float** %16
%82 = load float*, float** %17
%83 = load float*, float** %18
%84 = call i32 @OsdComputeTensorProductPatchWeights(float %71, i32 0, float* %72, float* %73, float* %74, float* %75, float* %76, float* %77, float* %78, float* %79, float* %80, float* %81, float* %82, float* %83)
ret void
}

LLVM IR (-O2):
define void @OsdGetBezierPatchWeights(float %0, float %1, float %2, float* %3, float* %4, float* %5, float* %6, float* %7, float* %8) {
%10 = alloca [4 x float]
%11 = alloca [4 x float]
%12 = alloca [4 x float]
%13 = alloca [4 x float]
%14 = alloca [4 x float]
%15 = alloca [4 x float]
%16 = bitcast [4 x float]* %10 to i8*
%17 = bitcast [4 x float]* %11 to i8*
%18 = bitcast [4 x float]* %12 to i8*
%19 = bitcast [4 x float]* %13 to i8*
%20 = bitcast [4 x float]* %14 to i8*
%21 = bitcast [4 x float]* %15 to i8*
%22 = icmp eq float* %3, null
%23 = getelementptr inbounds [4 x float], [4 x float]* %10, i64 0, i64 0
%24 = select i1 %22, float* null, float* %23
%25 = icmp eq float* %4, null
%26 = getelementptr inbounds [4 x float], [4 x float]* %12, i64 0, i64 0
%27 = select i1 %25, float* null, float* %26
%28 = icmp eq float* %6, null
%29 = getelementptr inbounds [4 x float], [4 x float]* %14, i64 0, i64 0
%30 = select i1 %28, float* null, float* %29
%31 = call i32 @OsdGetBezierWeights(float %0, float* %24, float* %27, float* %30)
%32 = getelementptr inbounds [4 x float], [4 x float]* %11, i64 0, i64 0
%33 = select i1 %22, float* null, float* %32
%34 = icmp eq float* %5, null
%35 = getelementptr inbounds [4 x float], [4 x float]* %13, i64 0, i64 0
%36 = select i1 %34, float* null, float* %35
%37 = icmp eq float* %8, null
%38 = getelementptr inbounds [4 x float], [4 x float]* %15, i64 0, i64 0
%39 = select i1 %37, float* null, float* %38
%40 = call i32 @OsdGetBezierWeights(float %1, float* %33, float* %36, float* %39)
%41 = call i32 @OsdComputeTensorProductPatchWeights(float %2, i32 0, float* %23, float* %32, float* %26, float* %35, float* %29, float* %38, float* %3, float* %4, float* %5, float* %6, float* %7, float* %8)
ret void
}