#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 */
struct mat {
  int dummy;
};

/* Variables and functions */
float cos(float);
int /*<<< orphan*/ mat_set(struct mat *, float, float, float, float,
                           int /*<<< orphan*/, int /*<<< orphan*/);
float sin(float);
void mat_setrotate(struct mat *this, float angle) {
  angle = angle * 3.1415926535897932384626433832795 / 180.0f;
  float a = cos(angle);
  float b = sin(angle);
  mat_set(this, a, b, -(b), a, 0, 0);
}


x86 assembly (clang, -O0):
<mat_setrotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <cos@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0x10(%rbp),%xmm3
xor    %edx,%edx
mov    %edx,%esi
call   1040 <mat_set@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_setrotate>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
cvtss2sd %xmm0,%xmm0
mulsd  0xebc(%rip),%xmm0
divsd  0xebc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
call   1050 <cos@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movaps 0xe9a(%rip),%xmm2
xorps  %xmm0,%xmm2
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
movaps %xmm0,%xmm3
xor    %esi,%esi
xor    %edx,%edx
add    $0x10,%rsp
pop    %rbx
jmp    1040 <mat_set@plt>

LLVM IR (-O0):
%struct.mat = type { i32 }
define void @mat_setrotate(%struct.mat* %0, float %1) {
%3 = alloca %struct.mat*
%4 = alloca float
%5 = alloca float
%6 = alloca float
store %struct.mat* %0, %struct.mat** %3
store float %1, float* %4
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = fmul double %8, 0x400921FB54442D18
%10 = fdiv double %9, 1.800000e+02
%11 = fptrunc double %10 to float
store float %11, float* %4
%12 = load float, float* %4
%13 = call float @cos(float %12)
store float %13, float* %5
%14 = load float, float* %4
%15 = call float @sin(float %14)
store float %15, float* %6
%16 = load %struct.mat*, %struct.mat** %3
%17 = load float, float* %5
%18 = load float, float* %6
%19 = load float, float* %6
%20 = fneg float %19
%21 = load float, float* %5
%22 = call i32 @mat_set(%struct.mat* %16, float %17, float %18, float %20, float %21, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
%struct.mat = type { i32 }
define void @mat_setrotate(%struct.mat* %0, float %1) {
%3 = fpext float %1 to double
%4 = fmul double %3, 0x400921FB54442D18
%5 = fdiv double %4, 1.800000e+02
%6 = fptrunc double %5 to float
%7 = tail call float @cos(float %6)
%8 = tail call float @sin(float %6)
%9 = fneg float %8
%10 = tail call i32 @mat_set(%struct.mat* %0, float %7, float %8, float %9, float %7, i32 0, i32 0)
ret void
}