void rotmat(axes, rot1, rot2, rot3, matrix) int axes;
double rot1;
double rot2;
double rot3;
double *matrix;
{
  int i, j, k, naxis, iaxes, iaxis;
  double rot[3], srot, crot, *mati, w, wm[9], *wmi, matn[9];
  int axis[3];
  mati = matrix;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      if (i == j)
        *mati++ = 1.0;
      else
        *mati++ = 0.0;
    }
  }
  naxis = 0;
  iaxes = axes;
  axis[0] = iaxes / 100;
  if (axis[0] > 0) {
    naxis++;
    iaxes = iaxes - (100 * axis[0]);
  }
  axis[naxis] = iaxes / 10;
  if (axis[naxis] > 0) {
    iaxes = iaxes - (10 * axis[naxis]);
    naxis++;
  }
  axis[naxis] = iaxes;
  if (axis[naxis] > 0)
    naxis++;
  rot[0] = rot1;
  rot[1] = rot2;
  rot[2] = rot3;
  for (iaxis = 0; iaxis < naxis; iaxis++) {
    mati = matn;
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        if (i == j)
          *mati++ = 1.0;
        else
          *mati++ = 0.0;
      }
    }
    srot = sin(rot[iaxis]);
    crot = cos(rot[iaxis]);
    if (axis[iaxis] == 1) {
      matn[4] = crot;
      matn[5] = srot;
      matn[7] = -srot;
      matn[8] = crot;
    } else if (axis[iaxis] == 2) {
      matn[0] = crot;
      matn[2] = -srot;
      matn[6] = srot;
      matn[8] = crot;
    } else {
      matn[0] = crot;
      matn[1] = srot;
      matn[3] = -srot;
      matn[4] = crot;
    }
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        w = 0.0;
        for (k = 0; k < 3; k++)
          w += matn[3 * i + k] * matrix[3 * k + j];
        wm[3 * i + j] = w;
      }
    }
    mati = matrix;
    wmi = wm;
    for (i = 0; i < 9; i++) {
      *mati++ = *wmi++;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<rotmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11d3 <rotmat+0xb3>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    11c0 <rotmat+0xa0>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jne    1197 <rotmat+0x77>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
movsd  0xe72(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    11ad <rotmat+0x8d>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11b2 <rotmat+0x92>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1161 <rotmat+0x41>
jmp    11c5 <rotmat+0xa5>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1150 <rotmat+0x30>
movl   $0x0,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x12c(%rbp)
cmpl   $0x0,-0x12c(%rbp)
jle    1216 <rotmat+0xf6>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
imul   $0x64,-0x12c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x12c(%rbp,%rax,4)
movslq -0x38(%rbp),%rax
cmpl   $0x0,-0x12c(%rbp,%rax,4)
jle    125d <rotmat+0x13d>
mov    -0x3c(%rbp),%eax
movslq -0x38(%rbp),%rcx
imul   $0xa,-0x12c(%rbp,%rcx,4),%ecx
0a
sub    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x12c(%rbp,%rax,4)
movslq -0x38(%rbp),%rax
cmpl   $0x0,-0x12c(%rbp,%rax,4)
jle    1286 <rotmat+0x166>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    15b4 <rotmat+0x494>
lea    -0x120(%rbp),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    134c <rotmat+0x22c>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1339 <rotmat+0x219>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jne    1310 <rotmat+0x1f0>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
movsd  0xcf9(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    1326 <rotmat+0x206>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    132b <rotmat+0x20b>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12da <rotmat+0x1ba>
jmp    133e <rotmat+0x21e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12c9 <rotmat+0x1a9>
movslq -0x40(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x68(%rbp)
movslq -0x40(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movslq -0x40(%rbp),%rax
cmpl   $0x1,-0x12c(%rbp,%rax,4)
01
jne    13d6 <rotmat+0x2b6>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
jmp    1488 <rotmat+0x368>
movslq -0x40(%rbp),%rax
cmpl   $0x2,-0x12c(%rbp,%rax,4)
02
jne    1438 <rotmat+0x318>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
jmp    1483 <rotmat+0x363>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
jmp    1488 <rotmat+0x368>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1540 <rotmat+0x420>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    152d <rotmat+0x40d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jge    1508 <rotmat+0x3e8>
imul   $0x3,-0x2c(%rbp),%eax
add    -0x34(%rbp),%eax
cltq
movsd  -0x120(%rbp,%rax,8),%xmm0
ff ff
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14b9 <rotmat+0x399>
movsd  -0x80(%rbp),%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  %xmm0,-0xd0(%rbp,%rax,8)
ff ff
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14a0 <rotmat+0x380>
jmp    1532 <rotmat+0x412>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    148f <rotmat+0x36f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x9,-0x2c(%rbp)
jge    15a1 <rotmat+0x481>
mov    -0xd8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0xd8(%rbp)
movsd  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
movsd  %xmm0,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    155d <rotmat+0x43d>
jmp    15a6 <rotmat+0x486>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12ab <rotmat+0x18b>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotmat>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%rbx
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rsi)
xorpd  %xmm3,%xmm3
movupd %xmm3,0x8(%rsi)
movq   $0x0,0x18(%rsi)
mov    %rax,0x20(%rsi)
movupd %xmm3,0x28(%rsi)
movq   $0x0,0x38(%rsi)
mov    %rax,0x40(%rsi)
movslq %edi,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
mov    %eax,0x24(%rsp)
imul   $0xffffff9c,%eax,%esi
xor    %eax,%eax
xor    %ecx,%ecx
cmp    $0x64,%edx
cmovl  %eax,%esi
setge  %cl
add    %edx,%esi
movslq %esi,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
shr    $0x20,%rsi
sar    $0x2,%esi
add    %edi,%esi
mov    %esi,0x24(%rsp,%rcx,4)
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
neg    %esi
lea    0x1(%rcx),%edi
cmp    $0xa,%edx
cmovl  %ecx,%edi
cmovl  %eax,%esi
add    %edx,%esi
mov    %esi,0x24(%rsp,%rdi,4)
xor    %eax,%eax
test   %esi,%esi
setg   %al
movsd  %xmm0,0x30(%rsp)
movsd  %xmm1,0x38(%rsp)
movq   %xmm2,0x40(%rsp)
add    %edi,%eax
je     1474 <rotmat+0x354>
mov    %eax,%r14d
add    $0xffffffffffffffff,%r14
xor    %r15d,%r15d
xorpd  %xmm1,%xmm1
movhpd 0xe13(%rip),%xmm1
movapd %xmm1,0x50(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movq   (%rsp),%xmm0
call   1040 <cos@plt>
movdqa %xmm0,%xmm8
mov    0x24(%rsp,%r15,4),%eax
cmp    $0x2,%eax
je     1280 <rotmat+0x160>
cmp    $0x1,%eax
jne    12b0 <rotmat+0x190>
pxor   %xmm2,%xmm2
movdqa 0x10(%rsp),%xmm11
punpcklqdq %xmm11,%xmm2
pxor   0xdaa(%rip),%xmm11
pxor   %xmm15,%xmm15
punpcklqdq %xmm8,%xmm15
pxor   %xmm0,%xmm0
movdqa %xmm8,(%rsp)
movq   0xd9d(%rip),%xmm8
jmp    12e8 <rotmat+0x1c8>
cs nopw 0x0(%rax,%rax,1)
nop
movdqa 0x10(%rsp),%xmm0
movdqa %xmm0,%xmm1
pxor   0xd6e(%rip),%xmm1
movq   %xmm1,%xmm2
movdqa %xmm8,(%rsp)
movq   %xmm8,%xmm8
pxor   %xmm11,%xmm11
movdqa 0x50(%rsp),%xmm15
jmp    12e8 <rotmat+0x1c8>
nop
movdqa 0x10(%rsp),%xmm1
movdqa %xmm1,%xmm15
pxor   0xd3d(%rip),%xmm1
punpcklqdq %xmm8,%xmm15
punpcklqdq %xmm1,%xmm8
pxor   %xmm2,%xmm2
pxor   %xmm11,%xmm11
movsd  0xd31(%rip),%xmm14
movaps %xmm14,(%rsp)
pxor   %xmm0,%xmm0
movupd (%rbx),%xmm3
movdqa %xmm8,%xmm1
punpcklqdq %xmm8,%xmm1
mulpd  %xmm3,%xmm1
movdqa %xmm8,%xmm7
movapd %xmm3,%xmm4
xorpd  %xmm3,%xmm3
addpd  %xmm3,%xmm1
xorpd  %xmm10,%xmm10
movupd 0x18(%rbx),%xmm6
movdqa %xmm15,%xmm5
punpcklqdq %xmm15,%xmm5
mulpd  %xmm6,%xmm5
movapd %xmm6,%xmm3
addpd  %xmm1,%xmm5
movupd 0x30(%rbx),%xmm9
movdqa %xmm2,%xmm14
movdqa %xmm2,%xmm13
punpcklqdq %xmm2,%xmm13
mulpd  %xmm9,%xmm13
addpd  %xmm5,%xmm13
movsd  0x10(%rbx),%xmm6
movsd  0x28(%rbx),%xmm12
movapd %xmm4,0x10(%rsp)
movapd %xmm4,%xmm8
shufpd $0x1,%xmm6,%xmm8
movdqa %xmm0,%xmm1
mulsd  %xmm6,%xmm0
unpcklpd %xmm4,%xmm6
mulpd  %xmm7,%xmm6
addpd  %xmm10,%xmm6
movapd %xmm3,0x60(%rsp)
movapd %xmm3,%xmm2
shufpd $0x1,%xmm12,%xmm2
movdqa %xmm11,%xmm4
mulsd  %xmm12,%xmm11
unpcklpd %xmm3,%xmm12
movdqa %xmm15,%xmm10
mulpd  %xmm15,%xmm12
addpd  %xmm6,%xmm12
movsd  0x40(%rbx),%xmm6
movapd %xmm9,%xmm3
shufpd $0x1,%xmm6,%xmm3
movapd %xmm0,%xmm5
movapd (%rsp),%xmm15
movapd %xmm15,%xmm0
mulsd  %xmm6,%xmm15
unpcklpd %xmm9,%xmm6
mulpd  %xmm14,%xmm6
addpd  %xmm12,%xmm6
unpckhpd %xmm7,%xmm7
mulpd  %xmm7,%xmm8
punpckhqdq %xmm10,%xmm10
mulpd  %xmm10,%xmm2
xorpd  %xmm7,%xmm7
addpd  %xmm7,%xmm8
addpd  %xmm8,%xmm2
unpckhpd %xmm14,%xmm14
mulpd  %xmm14,%xmm3
addpd  %xmm2,%xmm3
punpcklqdq %xmm1,%xmm1
mulpd  0x10(%rsp),%xmm1
punpcklqdq %xmm4,%xmm4
mulpd  0x60(%rsp),%xmm4
addpd  %xmm7,%xmm1
addpd  %xmm1,%xmm4
unpcklpd %xmm0,%xmm0
mulpd  %xmm9,%xmm0
addpd  %xmm4,%xmm0
addsd  0xbdd(%rip),%xmm5
addsd  %xmm5,%xmm11
addsd  %xmm11,%xmm15
movupd %xmm13,(%rbx)
movupd %xmm6,0x10(%rbx)
movupd %xmm3,0x20(%rbx)
movupd %xmm0,0x30(%rbx)
movsd  %xmm15,0x40(%rbx)
cmp    %r15,%r14
je     1474 <rotmat+0x354>
movsd  0x38(%rsp,%r15,8),%xmm0
add    $0x1,%r15
jmp    1210 <rotmat+0xf0>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @rotmat(i32 %0, double %1, double %2, double %3, double* %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [3 x double]
%18 = alloca double
%19 = alloca double
%20 = alloca double*
%21 = alloca double
%22 = alloca [9 x double]
%23 = alloca double*
%24 = alloca [9 x double]
%25 = alloca [3 x i32]
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double* %4, double** %10
%26 = load double*, double** %10
store double* %26, double** %20
store i32 0, i32* %11
br label %27
27: ; preds = %49, %5
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %52
30: ; preds = %27
store i32 0, i32* %12
br label %31
31: ; preds = %45, %30
%32 = load i32, i32* %12
%33 = icmp slt i32 %32, 3
br i1 %33, label %34, label %48
34: ; preds = %31
%35 = load i32, i32* %11
%36 = load i32, i32* %12
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load double*, double** %20
%40 = getelementptr inbounds double, double* %39, i32 1
store double* %40, double** %20
store double 1.000000e+00, double* %39
br label %44
41: ; preds = %34
%42 = load double*, double** %20
%43 = getelementptr inbounds double, double* %42, i32 1
store double* %43, double** %20
store double 0.000000e+00, double* %42
br label %44
44: ; preds = %41, %38
br label %45
45: ; preds = %44
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 1
store i32 %47, i32* %12
br label %31
48: ; preds = %31
br label %49
49: ; preds = %48
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 1
store i32 %51, i32* %11
br label %27
52: ; preds = %27
store i32 0, i32* %14
%53 = load i32, i32* %6
store i32 %53, i32* %15
%54 = load i32, i32* %15
%55 = sdiv i32 %54, 100
%56 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 0
store i32 %55, i32* %56
%57 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 0
%58 = load i32, i32* %57
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %68
60: ; preds = %52
%61 = load i32, i32* %14
%62 = add nsw i32 %61, 1
store i32 %62, i32* %14
%63 = load i32, i32* %15
%64 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 0
%65 = load i32, i32* %64
%66 = mul nsw i32 100, %65
%67 = sub nsw i32 %63, %66
store i32 %67, i32* %15
br label %68
68: ; preds = %60, %52
%69 = load i32, i32* %15
%70 = sdiv i32 %69, 10
%71 = load i32, i32* %14
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %72
store i32 %70, i32* %73
%74 = load i32, i32* %14
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %89
79: ; preds = %68
%80 = load i32, i32* %15
%81 = load i32, i32* %14
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = mul nsw i32 10, %84
%86 = sub nsw i32 %80, %85
store i32 %86, i32* %15
%87 = load i32, i32* %14
%88 = add nsw i32 %87, 1
store i32 %88, i32* %14
br label %89
89: ; preds = %79, %68
%90 = load i32, i32* %15
%91 = load i32, i32* %14
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %92
store i32 %90, i32* %93
%94 = load i32, i32* %14
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = icmp sgt i32 %97, 0
br i1 %98, label %99, label %102
99: ; preds = %89
%100 = load i32, i32* %14
%101 = add nsw i32 %100, 1
store i32 %101, i32* %14
br label %102
102: ; preds = %99, %89
%103 = load double, double* %7
%104 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
store double %103, double* %104
%105 = load double, double* %8
%106 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 1
store double %105, double* %106
%107 = load double, double* %9
%108 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 2
store double %107, double* %108
store i32 0, i32* %16
br label %109
109: ; preds = %257, %102
%110 = load i32, i32* %16
%111 = load i32, i32* %14
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %260
113: ; preds = %109
%114 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 0
store double* %114, double** %20
store i32 0, i32* %11
br label %115
115: ; preds = %137, %113
%116 = load i32, i32* %11
%117 = icmp slt i32 %116, 3
br i1 %117, label %118, label %140
118: ; preds = %115
store i32 0, i32* %12
br label %119
119: ; preds = %133, %118
%120 = load i32, i32* %12
%121 = icmp slt i32 %120, 3
br i1 %121, label %122, label %136
122: ; preds = %119
%123 = load i32, i32* %11
%124 = load i32, i32* %12
%125 = icmp eq i32 %123, %124
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = load double*, double** %20
%128 = getelementptr inbounds double, double* %127, i32 1
store double* %128, double** %20
store double 1.000000e+00, double* %127
br label %132
129: ; preds = %122
%130 = load double*, double** %20
%131 = getelementptr inbounds double, double* %130, i32 1
store double* %131, double** %20
store double 0.000000e+00, double* %130
br label %132
132: ; preds = %129, %126
br label %133
133: ; preds = %132
%134 = load i32, i32* %12
%135 = add nsw i32 %134, 1
store i32 %135, i32* %12
br label %119
136: ; preds = %119
br label %137
137: ; preds = %136
%138 = load i32, i32* %11
%139 = add nsw i32 %138, 1
store i32 %139, i32* %11
br label %115
140: ; preds = %115
%141 = load i32, i32* %16
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 %142
%144 = load double, double* %143
%145 = call double @sin(double %144)
store double %145, double* %18
%146 = load i32, i32* %16
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 %147
%149 = load double, double* %148
%150 = call double @cos(double %149)
store double %150, double* %19
%151 = load i32, i32* %16
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %152
%154 = load i32, i32* %153
%155 = icmp eq i32 %154, 1
br i1 %155, label %156, label %166
156: ; preds = %140
%157 = load double, double* %19
%158 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 4
store double %157, double* %158
%159 = load double, double* %18
%160 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 5
store double %159, double* %160
%161 = load double, double* %18
%162 = fneg double %161
%163 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 7
store double %162, double* %163
%164 = load double, double* %19
%165 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 8
store double %164, double* %165
br label %193
166: ; preds = %140
%167 = load i32, i32* %16
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %168
%170 = load i32, i32* %169
%171 = icmp eq i32 %170, 2
br i1 %171, label %172, label %182
172: ; preds = %166
%173 = load double, double* %19
%174 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 0
store double %173, double* %174
%175 = load double, double* %18
%176 = fneg double %175
%177 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 2
store double %176, double* %177
%178 = load double, double* %18
%179 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 6
store double %178, double* %179
%180 = load double, double* %19
%181 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 8
store double %180, double* %181
br label %192
182: ; preds = %166
%183 = load double, double* %19
%184 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 0
store double %183, double* %184
%185 = load double, double* %18
%186 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 1
store double %185, double* %186
%187 = load double, double* %18
%188 = fneg double %187
%189 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 3
store double %188, double* %189
%190 = load double, double* %19
%191 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 4
store double %190, double* %191
br label %192
192: ; preds = %182, %172
br label %193
193: ; preds = %192, %156
store i32 0, i32* %11
br label %194
194: ; preds = %238, %193
%195 = load i32, i32* %11
%196 = icmp slt i32 %195, 3
br i1 %196, label %197, label %241
197: ; preds = %194
store i32 0, i32* %12
br label %198
198: ; preds = %234, %197
%199 = load i32, i32* %12
%200 = icmp slt i32 %199, 3
br i1 %200, label %201, label %237
201: ; preds = %198
store double 0.000000e+00, double* %21
store i32 0, i32* %13
br label %202
202: ; preds = %223, %201
%203 = load i32, i32* %13
%204 = icmp slt i32 %203, 3
br i1 %204, label %205, label %226
205: ; preds = %202
%206 = load i32, i32* %11
%207 = mul nsw i32 3, %206
%208 = load i32, i32* %13
%209 = add nsw i32 %207, %208
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds [9 x double], [9 x double]* %24, i64 0, i64 %210
%212 = load double, double* %211
%213 = load double*, double** %10
%214 = load i32, i32* %13
%215 = mul nsw i32 3, %214
%216 = load i32, i32* %12
%217 = add nsw i32 %215, %216
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds double, double* %213, i64 %218
%220 = load double, double* %219
%221 = load double, double* %21
%222 = call double @llvm.fmuladd.f64(double %212, double %220, double %221)
store double %222, double* %21
br label %223
223: ; preds = %205
%224 = load i32, i32* %13
%225 = add nsw i32 %224, 1
store i32 %225, i32* %13
br label %202
226: ; preds = %202
%227 = load double, double* %21
%228 = load i32, i32* %11
%229 = mul nsw i32 3, %228
%230 = load i32, i32* %12
%231 = add nsw i32 %229, %230
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [9 x double], [9 x double]* %22, i64 0, i64 %232
store double %227, double* %233
br label %234
234: ; preds = %226
%235 = load i32, i32* %12
%236 = add nsw i32 %235, 1
store i32 %236, i32* %12
br label %198
237: ; preds = %198
br label %238
238: ; preds = %237
%239 = load i32, i32* %11
%240 = add nsw i32 %239, 1
store i32 %240, i32* %11
br label %194
241: ; preds = %194
%242 = load double*, double** %10
store double* %242, double** %20
%243 = getelementptr inbounds [9 x double], [9 x double]* %22, i64 0, i64 0
store double* %243, double** %23
store i32 0, i32* %11
br label %244
244: ; preds = %253, %241
%245 = load i32, i32* %11
%246 = icmp slt i32 %245, 9
br i1 %246, label %247, label %256
247: ; preds = %244
%248 = load double*, double** %23
%249 = getelementptr inbounds double, double* %248, i32 1
store double* %249, double** %23
%250 = load double, double* %248
%251 = load double*, double** %20
%252 = getelementptr inbounds double, double* %251, i32 1
store double* %252, double** %20
store double %250, double* %251
br label %253
253: ; preds = %247
%254 = load i32, i32* %11
%255 = add nsw i32 %254, 1
store i32 %255, i32* %11
br label %244
256: ; preds = %244
br label %257
257: ; preds = %256
%258 = load i32, i32* %16
%259 = add nsw i32 %258, 1
store i32 %259, i32* %16
br label %109
260: ; preds = %109
ret void
}

LLVM IR (-O2):
define void @rotmat(i32 %0, double %1, double %2, double %3, double* nocapture %4) {
%6 = alloca [3 x double]
%7 = alloca [3 x i32]
%8 = bitcast [3 x double]* %6 to i8*
%9 = bitcast [3 x i32]* %7 to i8*
%10 = getelementptr inbounds double, double* %4, i64 1
store double 1.000000e+00, double* %4
%11 = getelementptr inbounds double, double* %4, i64 4
%12 = getelementptr inbounds double, double* %4, i64 5
%13 = bitcast double* %10 to i8*
store double 1.000000e+00, double* %11
%14 = getelementptr inbounds double, double* %4, i64 8
%15 = bitcast double* %12 to i8*
store double 1.000000e+00, double* %14
%16 = sdiv i32 %0, 100
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %16, i32* %17
%18 = icmp sgt i32 %0, 99
%19 = mul nsw i32 %16, -100
%20 = zext i1 %18 to i32
%21 = select i1 %18, i32 %19, i32 0
%22 = add i32 %21, %0
%23 = sdiv i32 %22, 10
%24 = zext i1 %18 to i64
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 %24
store i32 %23, i32* %25
%26 = icmp sgt i32 %22, 9
%27 = mul nsw i32 %23, -10
%28 = select i1 %18, i32 2, i32 1
%29 = select i1 %26, i32 %28, i32 %20
%30 = select i1 %26, i32 %27, i32 0
%31 = add i32 %30, %22
%32 = zext i32 %29 to i64
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 %32
store i32 %31, i32* %33
%34 = icmp sgt i32 %31, 0
%35 = zext i1 %34 to i32
%36 = add nuw nsw i32 %29, %35
%37 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double %1, double* %37
%38 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
store double %2, double* %38
%39 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %3, double* %39
%40 = icmp eq i32 %36, 0
br i1 %40, label %137, label %41
41: ; preds = %5
%42 = zext i32 %36 to i64
%43 = getelementptr inbounds double, double* %4, i64 3
%44 = getelementptr inbounds double, double* %4, i64 6
%45 = getelementptr inbounds double, double* %4, i64 4
%46 = getelementptr inbounds double, double* %4, i64 2
%47 = getelementptr inbounds double, double* %4, i64 5
%48 = getelementptr inbounds double, double* %4, i64 8
%49 = bitcast double* %4 to <2 x double>*
%50 = bitcast double* %43 to <2 x double>*
%51 = bitcast double* %44 to <2 x double>*
%52 = bitcast double* %4 to <2 x double>*
%53 = bitcast double* %46 to <2 x double>*
%54 = bitcast double* %45 to <2 x double>*
%55 = bitcast double* %44 to <2 x double>*
br label %56
56: ; preds = %134, %41
%57 = phi double [ %1, %41 ], [ %136, %134 ]
%58 = phi i64 [ 0, %41 ], [ %132, %134 ]
%59 = tail call double @sin(double %57)
%60 = tail call double @cos(double %57)
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 %58
%62 = load i32, i32* %61
switch i32 %62, label %71 [
i32 1, label %63
i32 2, label %67
]
63: ; preds = %56
%64 = fneg double %59
%65 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %59, i64 1
%66 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %60, i64 1
br label %77
67: ; preds = %56
%68 = fneg double %59
%69 = insertelement <2 x double> <double poison, double 0.000000e+00>, double %68, i64 0
%70 = insertelement <2 x double> <double poison, double 0.000000e+00>, double %60, i64 0
br label %77
71: ; preds = %56
%72 = fneg double %59
%73 = insertelement <2 x double> poison, double %59, i64 0
%74 = insertelement <2 x double> %73, double %60, i64 1
%75 = insertelement <2 x double> poison, double %60, i64 0
%76 = insertelement <2 x double> %75, double %72, i64 1
br label %77
77: ; preds = %67, %71, %63
%78 = phi double [ 1.000000e+00, %71 ], [ %60, %67 ], [ %60, %63 ]
%79 = phi double [ 0.000000e+00, %71 ], [ 0.000000e+00, %67 ], [ %64, %63 ]
%80 = phi double [ 0.000000e+00, %71 ], [ %59, %67 ], [ 0.000000e+00, %63 ]
%81 = phi <2 x double> [ zeroinitializer, %71 ], [ %69, %67 ], [ %65, %63 ]
%82 = phi <2 x double> [ %74, %71 ], [ <double 0.000000e+00, double 1.000000e+00>, %67 ], [ %66, %63 ]
%83 = phi <2 x double> [ %76, %71 ], [ %70, %67 ], [ <double 1.000000e+00, double 0.000000e+00>, %63 ]
%84 = load <2 x double>, <2 x double>* %49
%85 = shufflevector <2 x double> %83, <2 x double> undef, <2 x i32> zeroinitializer
%86 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %84, <2 x double> zeroinitializer)
%87 = load <2 x double>, <2 x double>* %50
%88 = shufflevector <2 x double> %82, <2 x double> undef, <2 x i32> zeroinitializer
%89 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %88, <2 x double> %87, <2 x double> %86)
%90 = load <2 x double>, <2 x double>* %51
%91 = shufflevector <2 x double> %81, <2 x double> undef, <2 x i32> zeroinitializer
%92 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %91, <2 x double> %90, <2 x double> %89)
%93 = load double, double* %46
%94 = load double, double* %47
%95 = load double, double* %48
%96 = insertelement <2 x double> poison, double %93, i64 0
%97 = shufflevector <2 x double> %96, <2 x double> %84, <2 x i32> <i32 0, i32 2>
%98 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %83, <2 x double> %97, <2 x double> zeroinitializer)
%99 = insertelement <2 x double> poison, double %94, i64 0
%100 = shufflevector <2 x double> %99, <2 x double> %87, <2 x i32> <i32 0, i32 2>
%101 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %82, <2 x double> %100, <2 x double> %98)
%102 = insertelement <2 x double> poison, double %95, i64 0
%103 = shufflevector <2 x double> %102, <2 x double> %90, <2 x i32> <i32 0, i32 2>
%104 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> %103, <2 x double> %101)
%105 = extractelement <2 x double> %84, i64 1
%106 = extractelement <2 x double> %87, i64 1
%107 = extractelement <2 x double> %90, i64 1
%108 = shufflevector <2 x double> %83, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%109 = insertelement <2 x double> poison, double %105, i64 0
%110 = insertelement <2 x double> %109, double %93, i64 1
%111 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %108, <2 x double> %110, <2 x double> zeroinitializer)
%112 = shufflevector <2 x double> %82, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%113 = insertelement <2 x double> poison, double %106, i64 0
%114 = insertelement <2 x double> %113, double %94, i64 1
%115 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %112, <2 x double> %114, <2 x double> %111)
%116 = shufflevector <2 x double> %81, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%117 = insertelement <2 x double> poison, double %107, i64 0
%118 = insertelement <2 x double> %117, double %95, i64 1
%119 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %116, <2 x double> %118, <2 x double> %115)
%120 = insertelement <2 x double> poison, double %80, i64 0
%121 = shufflevector <2 x double> %120, <2 x double> poison, <2 x i32> zeroinitializer
%122 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %121, <2 x double> %84, <2 x double> zeroinitializer)
%123 = insertelement <2 x double> poison, double %79, i64 0
%124 = shufflevector <2 x double> %123, <2 x double> poison, <2 x i32> zeroinitializer
%125 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %124, <2 x double> %87, <2 x double> %122)
%126 = insertelement <2 x double> poison, double %78, i64 0
%127 = shufflevector <2 x double> %126, <2 x double> poison, <2 x i32> zeroinitializer
%128 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %127, <2 x double> %90, <2 x double> %125)
%129 = tail call double @llvm.fmuladd.f64(double %80, double %93, double 0.000000e+00)
%130 = tail call double @llvm.fmuladd.f64(double %79, double %94, double %129)
%131 = tail call double @llvm.fmuladd.f64(double %78, double %95, double %130)
store <2 x double> %92, <2 x double>* %52
store <2 x double> %104, <2 x double>* %53
store <2 x double> %119, <2 x double>* %54
store <2 x double> %128, <2 x double>* %55
store double %131, double* %48
%132 = add nuw nsw i64 %58, 1
%133 = icmp eq i64 %132, %42
br i1 %133, label %137, label %134
134: ; preds = %77
%135 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %132
%136 = load double, double* %135
br label %56
137: ; preds = %77, %5
ret void
}