#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 */
double cos(float);
int /*<<< orphan*/ floats_mat44_identity(float *);
double sin(float);
void floats_mat44_rotate_x(float rad, float out[16]) {
  floats_mat44_identity(out);
  double s = sin(rad), c = cos(rad);
  out[1 * 4 + 1] = c;
  out[1 * 4 + 2] = -s;
  out[2 * 4 + 1] = s;
  out[2 * 4 + 2] = c;
}


x86 assembly (clang, -O0):
<floats_mat44_rotate_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <floats_mat44_identity@plt>
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x14(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x18(%rax)
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x24(%rax)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x28(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floats_mat44_rotate_x>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm0,0x4(%rsp)
call   1040 <floats_mat44_identity@plt>
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
call   1050 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rbx)
movsd  0x8(%rsp),%xmm1
cvtsd2ss %xmm1,%xmm1
movaps 0xe87(%rip),%xmm2
xorps  %xmm1,%xmm2
movss  %xmm2,0x18(%rbx)
movss  %xmm1,0x24(%rbx)
movss  %xmm0,0x28(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @floats_mat44_rotate_x(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca double
%6 = alloca double
store float %0, float* %3
store float* %1, float** %4
%7 = load float*, float** %4
%8 = call i32 @floats_mat44_identity(float* %7)
%9 = load float, float* %3
%10 = call double @sin(float %9)
store double %10, double* %5
%11 = load float, float* %3
%12 = call double @cos(float %11)
store double %12, double* %6
%13 = load double, double* %6
%14 = fptrunc double %13 to float
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 5
store float %14, float* %16
%17 = load double, double* %5
%18 = fneg double %17
%19 = fptrunc double %18 to float
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 6
store float %19, float* %21
%22 = load double, double* %5
%23 = fptrunc double %22 to float
%24 = load float*, float** %4
%25 = getelementptr inbounds float, float* %24, i64 9
store float %23, float* %25
%26 = load double, double* %6
%27 = fptrunc double %26 to float
%28 = load float*, float** %4
%29 = getelementptr inbounds float, float* %28, i64 10
store float %27, float* %29
ret void
}

LLVM IR (-O2):
define void @floats_mat44_rotate_x(float %0, float* %1) {
%3 = tail call i32 @floats_mat44_identity(float* %1)
%4 = tail call double @sin(float %0)
%5 = tail call double @cos(float %0)
%6 = fptrunc double %5 to float
%7 = getelementptr inbounds float, float* %1, i64 5
store float %6, float* %7
%8 = fptrunc double %4 to float
%9 = fneg float %8
%10 = getelementptr inbounds float, float* %1, i64 6
store float %9, float* %10
%11 = getelementptr inbounds float, float* %1, i64 9
store float %8, float* %11
%12 = getelementptr inbounds float, float* %1, i64 10
store float %6, float* %12
ret void
}