rotate(a, dir, val) double a[4][4], val;
char dir;
{
  double cose, sine;
  cose = cos(val * 3.14159265358979324 / 180.0);
  sine = sin(val * 3.14159265358979324 / 180.0);
  if (dir == 'x')
    rot2(a, cose, sine, 1, 2);
  else if (dir == 'y')
    rot2(a, cose, -sine, 0, 2);
  else
    rot2(a, cose, sine, 0, 1);
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb9(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe96(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x78,%eax
jne    11be <rotate+0x8e>
mov    -0x10(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x2,%al
call   1050 <rot2@plt>
jmp    1224 <rotate+0xf4>
movsbl -0x11(%rbp),%eax
cmp    $0x79,%eax
jne    1203 <rotate+0xd3>
mov    -0x10(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x2,%al
call   1050 <rot2@plt>
jmp    121f <rotate+0xef>
mov    -0x10(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%al
call   1050 <rot2@plt>
jmp    1224 <rotate+0xf4>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mulsd  0xebd(%rip),%xmm0
divsd  0xebd(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
shl    $0x18,%ebp
cmp    $0x79000000,%ebp
je     1192 <rotate+0x62>
mov    %rbx,%rdi
cmp    $0x78000000,%ebp
jne    11ab <rotate+0x7b>
movsd  0x8(%rsp),%xmm0
mov    $0x1,%esi
mov    $0x2,%edx
jmp    11b8 <rotate+0x88>
xorps  0xe77(%rip),%xmm1
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
xor    %esi,%esi
mov    $0x2,%edx
jmp    11b8 <rotate+0x88>
movsd  0x8(%rsp),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%al
call   1050 <rot2@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rotate([4 x double]* %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca [4 x double]*
%6 = alloca i8
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = trunc i32 %1 to i8
store [4 x double]* %0, [4 x double]** %5
store i8 %10, i8* %6
store double %2, double* %7
%11 = load double, double* %7
%12 = fmul double %11, 0x400921FB54442D18
%13 = fdiv double %12, 1.800000e+02
%14 = call double @cos(double %13)
store double %14, double* %8
%15 = load double, double* %7
%16 = fmul double %15, 0x400921FB54442D18
%17 = fdiv double %16, 1.800000e+02
%18 = call double @sin(double %17)
store double %18, double* %9
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 120
br i1 %21, label %22, label %27
22: ; preds = %3
%23 = load [4 x double]*, [4 x double]** %5
%24 = load double, double* %8
%25 = load double, double* %9
%26 = call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %23, double %24, double %25, i32 1, i32 2)
br label %43
27: ; preds = %3
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 121
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load [4 x double]*, [4 x double]** %5
%33 = load double, double* %8
%34 = load double, double* %9
%35 = fneg double %34
%36 = call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %32, double %33, double %35, i32 0, i32 2)
br label %42
37: ; preds = %27
%38 = load [4 x double]*, [4 x double]** %5
%39 = load double, double* %8
%40 = load double, double* %9
%41 = call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %38, double %39, double %40, i32 0, i32 1)
br label %42
42: ; preds = %37, %31
br label %43
43: ; preds = %42, %22
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
define i32 @rotate([4 x double]* %0, i32 %1, double %2) {
%4 = fmul double %2, 0x400921FB54442D18
%5 = fdiv double %4, 1.800000e+02
%6 = tail call double @cos(double %5)
%7 = tail call double @sin(double %5)
%8 = shl i32 %1, 24
switch i32 %8, label %14 [
i32 2013265920, label %9
i32 2030043136, label %11
]
9: ; preds = %3
%10 = tail call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %0, double %6, double %7, i32 1, i32 2)
br label %16
11: ; preds = %3
%12 = fneg double %7
%13 = tail call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %0, double %6, double %12, i32 0, i32 2)
br label %16
14: ; preds = %3
%15 = tail call i32 ([4 x double]*, double, double, i32, i32, ...) bitcast (i32 (...)* @rot2 to i32 ([4 x double]*, double, double, i32, i32, ...)*)([4 x double]* %0, double %6, double %7, i32 0, i32 1)
br label %16
16: ; preds = %11, %14, %9
ret i32 undef
}