#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 */
int assign_cell(int, int, int, int);
void frombeginl_transtable(int **aseqsT, float *weights, int nseq, int i, int j,
                           double trans[6][6]) {
  int fy, ty;
  int idx;
  for (fy = 0; fy < 6; fy++)
    for (ty = 0; ty < 6; ty++)
      trans[fy][ty] = 0.0;
  fy = 0;
  for (idx = 0; idx < nseq; idx++) {
    ty = assign_cell(i, j, aseqsT[i][idx], aseqsT[j][idx]);
    trans[fy][ty] += weights[idx];
  }
}


x86 assembly (clang, -O0):
<frombeginl_transtable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    118c <frombeginl_transtable+0x7c>
movl   $0x0,-0x30(%rbp)
cmpl   $0x6,-0x30(%rbp)
jge    1179 <frombeginl_transtable+0x69>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1146 <frombeginl_transtable+0x36>
jmp    117e <frombeginl_transtable+0x6e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1135 <frombeginl_transtable+0x25>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1216 <frombeginl_transtable+0x106>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1030 <assign_cell@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119a <frombeginl_transtable+0x8a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frombeginl_transtable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8d,%r14d
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rsi,(%rsp)
mov    %rdi,%r12
mov    $0x120,%edx
mov    %r9,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
test   %ebp,%ebp
jle    119f <frombeginl_transtable+0x7f>
movslq %ebx,%r13
movslq %r14d,%rbx
mov    %ebp,%ebp
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    (%r12,%r13,8),%rax
mov    (%rax,%r14,4),%edx
mov    (%r12,%rbx,8),%rax
mov    (%rax,%r14,4),%ecx
mov    %r13d,%edi
mov    %ebx,%esi
call   1040 <assign_cell@plt>
mov    (%rsp),%rcx
movss  (%rcx,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
cltq
addsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%r14
cmp    %r14,%rbp
jne    1160 <frombeginl_transtable+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @frombeginl_transtable(i32** %0, float* %1, i32 %2, i32 %3, i32 %4, [6 x double]* %5) {
%7 = alloca i32**
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [6 x double]*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32** %0, i32*** %7
store float* %1, float** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store [6 x double]* %5, [6 x double]** %12
store i32 0, i32* %13
br label %16
16: ; preds = %35, %6
%17 = load i32, i32* %13
%18 = icmp slt i32 %17, 6
br i1 %18, label %19, label %38
19: ; preds = %16
store i32 0, i32* %14
br label %20
20: ; preds = %31, %19
%21 = load i32, i32* %14
%22 = icmp slt i32 %21, 6
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load [6 x double]*, [6 x double]** %12
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [6 x double], [6 x double]* %24, i64 %26
%28 = load i32, i32* %14
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [6 x double], [6 x double]* %27, i64 0, i64 %29
store double 0.000000e+00, double* %30
br label %31
31: ; preds = %23
%32 = load i32, i32* %14
%33 = add nsw i32 %32, 1
store i32 %33, i32* %14
br label %20
34: ; preds = %20
br label %35
35: ; preds = %34
%36 = load i32, i32* %13
%37 = add nsw i32 %36, 1
store i32 %37, i32* %13
br label %16
38: ; preds = %16
store i32 0, i32* %13
store i32 0, i32* %15
br label %39
39: ; preds = %80, %38
%40 = load i32, i32* %15
%41 = load i32, i32* %9
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %83
43: ; preds = %39
%44 = load i32, i32* %10
%45 = load i32, i32* %11
%46 = load i32**, i32*** %7
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32*, i32** %46, i64 %48
%50 = load i32*, i32** %49
%51 = load i32, i32* %15
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = load i32**, i32*** %7
%56 = load i32, i32* %11
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32*, i32** %55, i64 %57
%59 = load i32*, i32** %58
%60 = load i32, i32* %15
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
%63 = load i32, i32* %62
%64 = call i32 @assign_cell(i32 %44, i32 %45, i32 %54, i32 %63)
store i32 %64, i32* %14
%65 = load float*, float** %8
%66 = load i32, i32* %15
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds float, float* %65, i64 %67
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = load [6 x double]*, [6 x double]** %12
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [6 x double], [6 x double]* %71, i64 %73
%75 = load i32, i32* %14
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [6 x double], [6 x double]* %74, i64 0, i64 %76
%78 = load double, double* %77
%79 = fadd double %78, %70
store double %79, double* %77
br label %80
80: ; preds = %43
%81 = load i32, i32* %15
%82 = add nsw i32 %81, 1
store i32 %82, i32* %15
br label %39
83: ; preds = %39
ret void
}

LLVM IR (-O2):
define void @frombeginl_transtable(i32** nocapture %0, float* nocapture %1, i32 %2, i32 %3, i32 %4, [6 x double]* nocapture %5) {
%7 = bitcast [6 x double]* %5 to i8*
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %33
9: ; preds = %6
%10 = sext i32 %3 to i64
%11 = getelementptr inbounds i32*, i32** %0, i64 %10
%12 = sext i32 %4 to i64
%13 = getelementptr inbounds i32*, i32** %0, i64 %12
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %9, %15
%16 = phi i64 [ 0, %9 ], [ %31, %15 ]
%17 = load i32*, i32** %11
%18 = getelementptr inbounds i32, i32* %17, i64 %16
%19 = load i32, i32* %18
%20 = load i32*, i32** %13
%21 = getelementptr inbounds i32, i32* %20, i64 %16
%22 = load i32, i32* %21
%23 = tail call i32 @assign_cell(i32 %3, i32 %4, i32 %19, i32 %22)
%24 = getelementptr inbounds float, float* %1, i64 %16
%25 = load float, float* %24
%26 = fpext float %25 to double
%27 = sext i32 %23 to i64
%28 = getelementptr inbounds [6 x double], [6 x double]* %5, i64 0, i64 %27
%29 = load double, double* %28
%30 = fadd double %29, %26
store double %30, double* %28
%31 = add nuw nsw i64 %16, 1
%32 = icmp eq i64 %31, %14
br i1 %32, label %33, label %15
33: ; preds = %15, %6
ret void
}