#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 cosf(float);
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
float sinf(float);
void mtxRotateXY(float *_result, float _ax, float _ay) {
  const float sx = sinf(_ax);
  const float cx = cosf(_ax);
  const float sy = sinf(_ay);
  const float cy = cosf(_ay);
  memset(_result, 0, sizeof(float) * 16);
  _result[0] = cy;
  _result[2] = sy;
  _result[4] = sx * sy;
  _result[5] = cx;
  _result[6] = -sx * cy;
  _result[8] = -cx * sy;
  _result[9] = sx;
  _result[10] = cx * cy;
  _result[15] = 1.0f;
}


x86 assembly (clang, -O0):
<mtxRotateXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
movss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x14(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x10(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x18(%rax)
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x20(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x24(%rax)
movss  -0x18(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movss  0xdc5(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtxRotateXY>:
push   %rbx
sub    $0x30,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
call   1030 <sinf@plt>
movaps %xmm0,0x20(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cosf@plt>
movaps %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
movss  0x8(%rsp),%xmm5
movss  %xmm5,(%rbx)
movss  0xc(%rsp),%xmm1
movss  %xmm1,0x8(%rbx)
movaps 0x20(%rsp),%xmm2
movaps %xmm2,%xmm0
mulss  %xmm1,%xmm0
movaps %xmm1,%xmm4
movss  %xmm0,0x10(%rbx)
movaps 0x10(%rsp),%xmm3
movss  %xmm3,0x14(%rbx)
movaps 0xe37(%rip),%xmm0
movaps %xmm2,%xmm1
xorps  %xmm0,%xmm1
mulss  %xmm5,%xmm1
movss  %xmm1,0x18(%rbx)
xorps  %xmm3,%xmm0
mulss  %xmm4,%xmm0
movss  %xmm0,0x20(%rbx)
movss  %xmm2,0x24(%rbx)
mulss  %xmm5,%xmm3
movss  %xmm3,0x28(%rbx)
movl   $0x3f800000,0x3c(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @mtxRotateXY(float* %0, float %1, float %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %4
store float %1, float* %5
store float %2, float* %6
%11 = load float, float* %5
%12 = call float @sinf(float %11)
store float %12, float* %7
%13 = load float, float* %5
%14 = call float @cosf(float %13)
store float %14, float* %8
%15 = load float, float* %6
%16 = call float @sinf(float %15)
store float %16, float* %9
%17 = load float, float* %6
%18 = call float @cosf(float %17)
store float %18, float* %10
%19 = load float*, float** %4
%20 = call i32 @memset(float* %19, i32 0, i32 64)
%21 = load float, float* %10
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 0
store float %21, float* %23
%24 = load float, float* %9
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
store float %24, float* %26
%27 = load float, float* %7
%28 = load float, float* %9
%29 = fmul float %27, %28
%30 = load float*, float** %4
%31 = getelementptr inbounds float, float* %30, i64 4
store float %29, float* %31
%32 = load float, float* %8
%33 = load float*, float** %4
%34 = getelementptr inbounds float, float* %33, i64 5
store float %32, float* %34
%35 = load float, float* %7
%36 = fneg float %35
%37 = load float, float* %10
%38 = fmul float %36, %37
%39 = load float*, float** %4
%40 = getelementptr inbounds float, float* %39, i64 6
store float %38, float* %40
%41 = load float, float* %8
%42 = fneg float %41
%43 = load float, float* %9
%44 = fmul float %42, %43
%45 = load float*, float** %4
%46 = getelementptr inbounds float, float* %45, i64 8
store float %44, float* %46
%47 = load float, float* %7
%48 = load float*, float** %4
%49 = getelementptr inbounds float, float* %48, i64 9
store float %47, float* %49
%50 = load float, float* %8
%51 = load float, float* %10
%52 = fmul float %50, %51
%53 = load float*, float** %4
%54 = getelementptr inbounds float, float* %53, i64 10
store float %52, float* %54
%55 = load float*, float** %4
%56 = getelementptr inbounds float, float* %55, i64 15
store float 1.000000e+00, float* %56
ret void
}

LLVM IR (-O2):
define void @mtxRotateXY(float* %0, float %1, float %2) {
%4 = tail call float @sinf(float %1)
%5 = tail call float @cosf(float %1)
%6 = tail call float @sinf(float %2)
%7 = tail call float @cosf(float %2)
%8 = tail call i32 @memset(float* %0, i32 0, i32 64)
store float %7, float* %0
%9 = getelementptr inbounds float, float* %0, i64 2
store float %6, float* %9
%10 = fmul float %4, %6
%11 = getelementptr inbounds float, float* %0, i64 4
store float %10, float* %11
%12 = getelementptr inbounds float, float* %0, i64 5
store float %5, float* %12
%13 = fneg float %4
%14 = fmul float %7, %13
%15 = getelementptr inbounds float, float* %0, i64 6
store float %14, float* %15
%16 = fneg float %5
%17 = fmul float %6, %16
%18 = getelementptr inbounds float, float* %0, i64 8
store float %17, float* %18
%19 = getelementptr inbounds float, float* %0, i64 9
store float %4, float* %19
%20 = fmul float %5, %7
%21 = getelementptr inbounds float, float* %0, i64 10
store float %20, float* %21
%22 = getelementptr inbounds float, float* %0, i64 15
store float 1.000000e+00, float* %22
ret void
}