#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 cos(float const);
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
float sin(float const);
void floats_xyt_to_mat44(const float xyt[3], float r[16]) {
  float s = sin(xyt[2]), c = cos(xyt[2]);
  memset(r, 0, sizeof(float) * 16);
  r[0] = c;
  r[1] = -s;
  r[3] = xyt[0];
  r[4] = s;
  r[5] = c;
  r[7] = xyt[1];
  r[10] = 1;
  r[15] = 1;
}


x86 assembly (clang, -O0):
<floats_xyt_to_mat44>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1050 <cos@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x10(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x1c(%rax)
mov    -0x10(%rbp),%rax
movss  0xe17(%rip),%xmm0
movss  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
movss  0xe06(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floats_xyt_to_mat44>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movss  0x8(%rdi),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x10(%rsp)
movss  0x8(%r14),%xmm0
call   1050 <cos@plt>
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movss  0xc(%rsp),%xmm2
movss  %xmm2,(%rbx)
movaps 0xe83(%rip),%xmm0
movaps 0x10(%rsp),%xmm1
xorps  %xmm1,%xmm0
movss  %xmm0,0x4(%rbx)
movss  (%r14),%xmm0
movss  %xmm0,0xc(%rbx)
movss  %xmm1,0x10(%rbx)
movss  %xmm2,0x14(%rbx)
movss  0x4(%r14),%xmm0
movss  %xmm0,0x1c(%rbx)
movl   $0x3f800000,0x28(%rbx)
movl   $0x3f800000,0x3c(%rbx)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @floats_xyt_to_mat44(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%7 = load float*, float** %3
%8 = getelementptr inbounds float, float* %7, i64 2
%9 = load float, float* %8
%10 = call float @sin(float %9)
store float %10, float* %5
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 2
%13 = load float, float* %12
%14 = call float @cos(float %13)
store float %14, float* %6
%15 = load float*, float** %4
%16 = call i32 @memset(float* %15, i32 0, i32 64)
%17 = load float, float* %6
%18 = load float*, float** %4
%19 = getelementptr inbounds float, float* %18, i64 0
store float %17, float* %19
%20 = load float, float* %5
%21 = fneg float %20
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 1
store float %21, float* %23
%24 = load float*, float** %3
%25 = getelementptr inbounds float, float* %24, i64 0
%26 = load float, float* %25
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 3
store float %26, float* %28
%29 = load float, float* %5
%30 = load float*, float** %4
%31 = getelementptr inbounds float, float* %30, i64 4
store float %29, float* %31
%32 = load float, float* %6
%33 = load float*, float** %4
%34 = getelementptr inbounds float, float* %33, i64 5
store float %32, float* %34
%35 = load float*, float** %3
%36 = getelementptr inbounds float, float* %35, i64 1
%37 = load float, float* %36
%38 = load float*, float** %4
%39 = getelementptr inbounds float, float* %38, i64 7
store float %37, float* %39
%40 = load float*, float** %4
%41 = getelementptr inbounds float, float* %40, i64 10
store float 1.000000e+00, float* %41
%42 = load float*, float** %4
%43 = getelementptr inbounds float, float* %42, i64 15
store float 1.000000e+00, float* %43
ret void
}

LLVM IR (-O2):
define void @floats_xyt_to_mat44(float* nocapture %0, float* %1) {
%3 = getelementptr inbounds float, float* %0, i64 2
%4 = load float, float* %3
%5 = tail call float @sin(float %4)
%6 = load float, float* %3
%7 = tail call float @cos(float %6)
%8 = tail call i32 @memset(float* %1, i32 0, i32 64)
store float %7, float* %1
%9 = fneg float %5
%10 = getelementptr inbounds float, float* %1, i64 1
store float %9, float* %10
%11 = load float, float* %0
%12 = getelementptr inbounds float, float* %1, i64 3
store float %11, float* %12
%13 = getelementptr inbounds float, float* %1, i64 4
store float %5, float* %13
%14 = getelementptr inbounds float, float* %1, i64 5
store float %7, float* %14
%15 = getelementptr inbounds float, float* %0, i64 1
%16 = load float, float* %15
%17 = getelementptr inbounds float, float* %1, i64 7
store float %16, float* %17
%18 = getelementptr inbounds float, float* %1, i64 10
store float 1.000000e+00, float* %18
%19 = getelementptr inbounds float, float* %1, i64 15
store float 1.000000e+00, float* %19
ret void
}