void translateRules(int nonRules[][3], int termRules[][2], int nonTerm) {
  int maxRuleCount = 2;
  double rules[nonTerm][maxRuleCount + 1][3];
  rules[0][0][0] = 1;
  rules[0][0][1] = -1;
  rules[0][0][2] = 0;
  rules[0][1][0] = -1;
  rules[1][0][0] = 1;
  rules[1][0][1] = -1;
  rules[1][0][2] = 1;
  rules[1][1][0] = -1;
  rules[2][0][0] = 1;
  rules[2][0][1] = 0;
  rules[2][0][2] = 3;
  rules[2][1][0] = -1;
  rules[3][0][0] = 0.9;
  rules[3][0][1] = 0;
  rules[3][0][2] = 4;
  rules[3][1][0] = 0.1;
  rules[3][1][1] = 1;
  rules[3][1][2] = 4;
  rules[3][2][0] = -1;
  rules[4][0][0] = 1;
  rules[4][0][1] = 0;
  rules[4][0][2] = 5;
  rules[4][1][0] = -1;
  rules[5][0][0] = 0.7;
  rules[5][0][1] = 0;
  rules[5][0][2] = 0;
  rules[5][1][0] = 0.3;
  rules[5][1][1] = 1;
  rules[5][1][2] = 0;
  rules[5][2][0] = -1;
  int termRuleOut = 0;
  int nonRule = 0;
  int nonTermNum = 0;
  int nonRuleOut = 0;
  while (nonTermNum < nonTerm) {
    if (rules[nonTermNum][nonRule][0] == -1) {
      nonTermNum++;
      nonRule = 0;
      if (nonTermNum >= nonTerm)
        break;
    }
    if (rules[nonTermNum][nonRule][1] == -1) {
      termRules[termRuleOut][0] = nonTermNum;
      termRules[termRuleOut][1] = rules[nonTermNum][nonRule][2];
      termRuleOut++;
      nonRule++;
    } else {
      nonRules[nonRuleOut][0] = nonTermNum;
      nonRules[nonRuleOut][1] = rules[nonTermNum][nonRule][1];
      nonRules[nonRuleOut][2] = rules[nonTermNum][nonRule][2];
      nonRuleOut++;
      nonRule++;
    }
  }
}


x86 assembly (clang, -O0):
<translateRules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%edx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
mov    %rdx,%rax
imul   %rcx,%rax
lea    (%rax,%rax,2),%rax
lea    0xf(,%rax,8),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rax
sub    %rsi,%rax
mov    %rax,-0x48(%rbp)
mov    %rax,%rsp
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
imul   $0x0,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,(%rdx)
imul   $0x0,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xe72(%rip),%xmm0
movsd  %xmm0,0x8(%rdx)
imul   $0x0,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rdx)
imul   $0x0,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xe41(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
mov    %rcx,%rdx
shl    $0x0,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xe2b(%rip),%xmm0
movsd  %xmm0,(%rdx)
mov    %rcx,%rdx
shl    $0x0,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,0x8(%rdx)
mov    %rcx,%rdx
shl    $0x0,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xdf0(%rip),%xmm0
movsd  %xmm0,0x10(%rdx)
mov    %rcx,%rdx
shl    $0x0,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xdca(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
mov    %rcx,%rdx
shl    $0x1,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xdb4(%rip),%xmm0
movsd  %xmm0,(%rdx)
mov    %rcx,%rdx
shl    $0x1,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rdx)
mov    %rcx,%rdx
shl    $0x1,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xdb6(%rip),%xmm0
movsd  %xmm0,0x10(%rdx)
mov    %rcx,%rdx
shl    $0x1,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xd58(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xd75(%rip),%xmm0
movsd  %xmm0,(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xd35(%rip),%xmm0
movsd  %xmm0,0x10(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xd22(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xcdf(%rip),%xmm0
movsd  %xmm0,0x20(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xce4(%rip),%xmm0
movsd  %xmm0,0x28(%rdx)
imul   $0x3,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xca1(%rip),%xmm0
movsd  %xmm0,0x30(%rdx)
mov    %rcx,%rdx
shl    $0x2,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xc8b(%rip),%xmm0
movsd  %xmm0,(%rdx)
mov    %rcx,%rdx
shl    $0x2,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rdx)
mov    %rcx,%rdx
shl    $0x2,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xc6d(%rip),%xmm0
movsd  %xmm0,0x10(%rdx)
mov    %rcx,%rdx
shl    $0x2,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xc2f(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xc2c(%rip),%xmm0
movsd  %xmm0,(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xbde(%rip),%xmm0
movsd  %xmm0,0x18(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
movsd  0xbbb(%rip),%xmm0
movsd  %xmm0,0x20(%rdx)
imul   $0x5,%rcx,%rdx
imul   $0x18,%rdx,%rsi
mov    %rax,%rdx
add    %rsi,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rdx)
imul   $0x5,%rcx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0xb85(%rip),%xmm0
movsd  %xmm0,0x30(%rax)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    163b <translateRules+0x53b>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movsd  0xb2a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    150c <translateRules+0x40c>
jp     150c <translateRules+0x40c>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1507 <translateRules+0x407>
jmp    163b <translateRules+0x53b>
jmp    150c <translateRules+0x40c>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
movsd  0xac5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    15a3 <translateRules+0x4a3>
jp     15a3 <translateRules+0x4a3>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rcx
movslq -0x34(%rbp),%rsi
mov    %edi,(%rcx,%rsi,8)
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
cvttsd2si 0x10(%rax),%edx
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,0x4(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1636 <translateRules+0x536>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
mov    -0x3c(%rbp),%esi
mov    -0x8(%rbp),%rcx
movslq -0x40(%rbp),%rdi
imul   $0xc,%rdi,%rdi
add    %rdi,%rcx
mov    %esi,(%rcx)
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
imul   $0x18,%rcx,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
movslq -0x38(%rbp),%rsi
imul   $0x18,%rsi,%rsi
add    %rsi,%rcx
cvttsd2si 0x8(%rcx),%esi
mov    -0x8(%rbp),%rcx
movslq -0x40(%rbp),%rdi
imul   $0xc,%rdi,%rdi
add    %rdi,%rcx
mov    %esi,0x4(%rcx)
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
cvttsd2si 0x10(%rax),%ecx
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rdx
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    149c <translateRules+0x39c>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translateRules>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%eax
lea    (%rax,%rax,8),%rax
lea    0xf(,%rax,8),%rax
movabs $0xfffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%rax
mov    %rax,%r9
sub    %rcx,%r9
neg    %rcx
mov    %r9,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rax,%rcx,1)
xorpd  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movhps 0xf13(%rip),%xmm2
movaps %xmm2,0x10(%r9)
movups %xmm0,0x48(%r9)
movups %xmm0,0x58(%r9)
movsd  0xf04(%rip),%xmm0
movaps %xmm0,0x90(%r9)
movaps 0xe9d(%rip),%xmm3
movaps %xmm3,0xa0(%r9)
movsd  0xeed(%rip),%xmm3
movups %xmm3,0xd8(%r9)
movaps 0xe8e(%rip),%xmm3
movups %xmm3,0xe8(%r9)
movaps 0xe8f(%rip),%xmm3
movups %xmm3,0xf8(%r9)
movabs $0xbff0000000000000,%rax
mov    %rax,0x108(%r9)
movaps %xmm0,0x120(%r9)
movaps 0xe77(%rip),%xmm0
movaps %xmm0,0x130(%r9)
movabs $0x3fe6666666666666,%rax
66 e6 3f
mov    %rax,0x168(%r9)
movapd %xmm1,0x170(%r9)
movapd 0xe5d(%rip),%xmm0
movapd %xmm0,0x180(%r9)
movaps %xmm2,0x190(%r9)
test   %edx,%edx
jle    12d8 <translateRules+0x1d8>
xor    %r8d,%r8d
movsd  0xe49(%rip),%xmm0
xor    %r15d,%r15d
xor    %eax,%eax
xor    %r10d,%r10d
jmp    1259 <translateRules+0x159>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %r8d,%r8
lea    (%r8,%r8,2),%rcx
mov    %r15d,(%rdi,%rcx,4)
cvttsd2si %xmm1,%ebx
mov    %ebx,0x4(%rdi,%rcx,4)
cvttsd2si 0x10(%r11),%ebx
mov    %ebx,0x8(%rdi,%rcx,4)
add    $0x1,%r8d
add    $0x1,%eax
cmp    %edx,%r15d
jge    12d8 <translateRules+0x1d8>
movslq %r15d,%r11
lea    (%r11,%r11,8),%rbx
lea    (%r9,%rbx,8),%r14
movslq %eax,%rbx
lea    (%rbx,%rbx,2),%rbx
movsd  (%r14,%rbx,8),%xmm1
ucomisd %xmm0,%xmm1
jne    1290 <translateRules+0x190>
jp     1290 <translateRules+0x190>
add    $0x1,%r15d
cmp    %edx,%r15d
jge    12d8 <translateRules+0x1d8>
movslq %r15d,%rax
lea    (%rax,%rax,2),%r11
xor    %eax,%eax
jmp    1294 <translateRules+0x194>
nopl   (%rax)
lea    (%r11,%r11,2),%r11
lea    (%r11,%r11,2),%rbx
lea    (%r9,%rbx,8),%rbx
movslq %eax,%rcx
lea    (%rcx,%rcx,2),%rcx
lea    (%rbx,%rcx,8),%r11
movsd  0x8(%rbx,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jne    1230 <translateRules+0x130>
jp     1230 <translateRules+0x130>
movslq %r10d,%r10
mov    %r15d,(%rsi,%r10,8)
cvttsd2si 0x10(%r11),%ecx
mov    %ecx,0x4(%rsi,%r10,8)
add    $0x1,%r10d
jmp    1251 <translateRules+0x151>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @translateRules([3 x i32]* nocapture writeonly %0, [2 x i32]* nocapture writeonly %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = mul nuw nsw i64 %4, 3
%6 = alloca [3 x double], i64 %5
%7 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> <double 1.000000e+00, double -1.000000e+00>, <2 x double>* %7
%8 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double>* %9
%10 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 3, i64 0
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 1.000000e+00, double -1.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 3, i64 2
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 1.000000e+00, double -1.000000e+00>, <2 x double>* %13
%14 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 6, i64 0
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double>* %15
%16 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 6, i64 2
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> <double 3.000000e+00, double -1.000000e+00>, <2 x double>* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 9, i64 0
%19 = bitcast double* %18 to <2 x double>*
store <2 x double> <double 9.000000e-01, double 0.000000e+00>, <2 x double>* %19
%20 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 9, i64 2
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 1.000000e-01>, <2 x double>* %21
%22 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 10, i64 1
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 4.000000e+00>, <2 x double>* %23
%24 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 11, i64 0
store double -1.000000e+00, double* %24
%25 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 12, i64 0
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double>* %26
%27 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 12, i64 2
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 5.000000e+00, double -1.000000e+00>, <2 x double>* %28
%29 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 15, i64 0
store double 0x3FE6666666666666, double* %29
%30 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 15, i64 1
%31 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 16, i64 0
%32 = bitcast double* %30 to i8*
%33 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 3.000000e-01, double 1.000000e+00>, <2 x double>* %33
%34 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 16, i64 2
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double>* %35
%36 = icmp sgt i32 %2, 0
br i1 %36, label %37, label %89
37: ; preds = %3, %84
%38 = phi i32 [ %86, %84 ], [ 0, %3 ]
%39 = phi i32 [ %59, %84 ], [ 0, %3 ]
%40 = phi i32 [ %87, %84 ], [ 0, %3 ]
%41 = phi i32 [ %85, %84 ], [ 0, %3 ]
%42 = sext i32 %39 to i64
%43 = mul nsw i64 %42, 3
%44 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 %43
%45 = sext i32 %40 to i64
%46 = getelementptr inbounds [3 x double], [3 x double]* %44, i64 %45
%47 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 0, i64 0
%48 = load double, double* %47
%49 = fcmp oeq double %48, -1.000000e+00
br i1 %49, label %50, label %56
50: ; preds = %37
%51 = add nsw i32 %39, 1
%52 = icmp slt i32 %51, %2
br i1 %52, label %53, label %89
53: ; preds = %50
%54 = sext i32 %51 to i64
%55 = mul nsw i64 %54, 3
br label %56
56: ; preds = %53, %37
%57 = phi i64 [ %55, %53 ], [ %43, %37 ]
%58 = phi i32 [ 0, %53 ], [ %40, %37 ]
%59 = phi i32 [ %51, %53 ], [ %39, %37 ]
%60 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 %57
%61 = sext i32 %58 to i64
%62 = getelementptr inbounds [3 x double], [3 x double]* %60, i64 %61
%63 = getelementptr inbounds [3 x double], [3 x double]* %62, i64 0, i64 1
%64 = load double, double* %63
%65 = fcmp oeq double %64, -1.000000e+00
br i1 %65, label %66, label %74
66: ; preds = %56
%67 = sext i32 %41 to i64
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %67, i64 0
store i32 %59, i32* %68
%69 = getelementptr inbounds [3 x double], [3 x double]* %62, i64 0, i64 2
%70 = load double, double* %69
%71 = fptosi double %70 to i32
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %67, i64 1
store i32 %71, i32* %72
%73 = add nsw i32 %41, 1
br label %84
74: ; preds = %56
%75 = sext i32 %38 to i64
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 %75, i64 0
store i32 %59, i32* %76
%77 = fptosi double %64 to i32
%78 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 %75, i64 1
store i32 %77, i32* %78
%79 = getelementptr inbounds [3 x double], [3 x double]* %62, i64 0, i64 2
%80 = load double, double* %79
%81 = fptosi double %80 to i32
%82 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 %75, i64 2
store i32 %81, i32* %82
%83 = add nsw i32 %38, 1
br label %84
84: ; preds = %74, %66
%85 = phi i32 [ %73, %66 ], [ %41, %74 ]
%86 = phi i32 [ %38, %66 ], [ %83, %74 ]
%87 = add nsw i32 %58, 1
%88 = icmp slt i32 %59, %2
br i1 %88, label %37, label %89
89: ; preds = %84, %50, %3
ret void
}