#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*/ matrix_get_rotation(float *, float const, float const,
                                       float const, float const);
int /*<<< orphan*/ matrix_multiply_ext(float const *, float *, float *);
float *matrix_rotate_ext(const float matrix[4 * 4], const float angle,
                         const float x, const float y, const float z,
                         float matrix_out[4 * 4]) {
  float matrix_tmp[4 * 4];
  matrix_get_rotation(matrix_tmp, angle, x, y, z);
  matrix_multiply_ext(matrix, matrix_tmp, matrix_out);
  return matrix_out;
}


x86 assembly (clang, -O0):
<matrix_rotate_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1030 <matrix_get_rotation@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <matrix_multiply_ext@plt>
mov    -0x20(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_rotate_ext>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <matrix_get_rotation@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <matrix_multiply_ext@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float* @matrix_rotate_ext(float* %0, float %1, float %2, float %3, float %4, float* %5) {
%7 = alloca float*
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float*
%13 = alloca [16 x float]
store float* %0, float** %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float* %5, float** %12
%14 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 0
%15 = load float, float* %8
%16 = load float, float* %9
%17 = load float, float* %10
%18 = load float, float* %11
%19 = call i32 @matrix_get_rotation(float* %14, float %15, float %16, float %17, float %18)
%20 = load float*, float** %7
%21 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 0
%22 = load float*, float** %12
%23 = call i32 @matrix_multiply_ext(float* %20, float* %21, float* %22)
%24 = load float*, float** %12
ret float* %24
}

LLVM IR (-O2):
define float* @matrix_rotate_ext(float* %0, float %1, float %2, float %3, float %4, float* returned %5) {
%7 = alloca [16 x float]
%8 = bitcast [16 x float]* %7 to i8*
%9 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 0
%10 = call i32 @matrix_get_rotation(float* %9, float %1, float %2, float %3, float %4)
%11 = call i32 @matrix_multiply_ext(float* %0, float* %9, float* %5)
ret float* %5
}