#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 posterior_nodisk(int nstates, size_t nobs, const double *f_big,
                     const double *s_big, const double *b_big, double *d_big) {
  size_t pos;
  int i;
  const double *f_curr = f_big;
  const double *s_curr = s_big;
  const double *b_curr = b_big + nstates * (nobs - 1);
  double *d_curr = d_big;
  for (pos = 0; pos < nobs; pos++) {
    for (i = 0; i < nstates; i++) {
      d_curr[i] = f_curr[i] * s_curr[0] * b_curr[i];
    }
    d_curr += nstates;
    f_curr += nstates;
    s_curr++;
    b_curr -= nstates;
  }
  return 0;
}


x86 assembly (clang, -O0):
<posterior_nodisk>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1219 <posterior_nodisk+0x119>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b8 <posterior_nodisk+0xb8>
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    116f <posterior_nodisk+0x6f>
mov    -0x4(%rbp),%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    115a <posterior_nodisk+0x5a>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posterior_nodisk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,-0x28(%rsp)
mov    %r8,-0x30(%rsp)
mov    %rcx,-0x38(%rsp)
mov    %rdx,-0x40(%rsp)
test   %rsi,%rsi
je     135d <posterior_nodisk+0x25d>
movslq %edi,%rcx
lea    -0x1(%rsi),%rdx
imul   %rcx,%rdx
mov    -0x30(%rsp),%rax
lea    (%rax,%rdx,8),%rax
mov    %ecx,%ebx
add    %rbx,%rdx
mov    %rdx,-0x18(%rsp)
mov    %ebx,%edx
and    $0xfffffffc,%edx
mov    %rdx,-0x20(%rsp)
mov    %rbx,%rdx
neg    %rdx
mov    %rdx,-0x8(%rsp)
mov    %rcx,-0x10(%rsp)
lea    0x0(,%rcx,8),%r15
mov    %r15,%r12
neg    %r12
lea    0x0(,%rbx,8),%r11
and    $0xffffffffffffffe0,%r11
xor    %r14d,%r14d
mov    -0x28(%rsp),%r9
mov    -0x40(%rsp),%rdx
mov    -0x38(%rsp),%rcx
mov    %rsi,-0x48(%rsp)
mov    %edi,-0x5c(%rsp)
mov    %r15,-0x50(%rsp)
mov    %r12,-0x58(%rsp)
jmp    11ba <posterior_nodisk+0xba>
add    %r15,%r9
add    %r15,%rdx
add    $0x8,%rcx
add    %r12,%rax
add    $0x1,%r14
cmp    %rsi,%r14
je     135d <posterior_nodisk+0x25d>
test   %edi,%edi
jle    11a0 <posterior_nodisk+0xa0>
cmp    $0x4,%edi
jae    11d0 <posterior_nodisk+0xd0>
xor    %r10d,%r10d
jmp    12e0 <posterior_nodisk+0x1e0>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rbp
imul   -0x10(%rsp),%rbp
mov    -0x18(%rsp),%r8
sub    %rbp,%r8
add    %rbx,%rbp
mov    -0x28(%rsp),%rsi
lea    (%rsi,%rbp,8),%r13
mov    -0x40(%rsp),%rsi
lea    (%rsi,%rbp,8),%rbp
mov    -0x38(%rsp),%rsi
lea    (%rsi,%r14,8),%rsi
add    $0x8,%rsi
mov    -0x30(%rsp),%rdi
lea    (%rdi,%r8,8),%r8
cmp    %rbp,%r9
setb   %r12b
cmp    %r13,%rdx
setb   %dil
cmp    %rsi,%r9
setb   %r10b
cmp    %r13,%rcx
setb   %r15b
cmp    %r8,%r9
setb   %r8b
cmp    %r13,%rax
setb   %bpl
test   %dil,%r12b
jne    12bf <posterior_nodisk+0x1bf>
and    %r15b,%r10b
jne    12bf <posterior_nodisk+0x1bf>
mov    $0x0,%r10d
and    %bpl,%r8b
mov    -0x48(%rsp),%rsi
mov    -0x5c(%rsp),%edi
mov    -0x50(%rsp),%r15
mov    -0x58(%rsp),%r12
jne    12e0 <posterior_nodisk+0x1e0>
movsd  (%rcx),%xmm0
unpcklpd %xmm0,%xmm0
xor    %ebp,%ebp
movupd (%rdx,%rbp,1),%xmm1
movupd 0x10(%rdx,%rbp,1),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd (%rax,%rbp,1),%xmm3
mulpd  %xmm1,%xmm3
movupd 0x10(%rax,%rbp,1),%xmm1
mulpd  %xmm2,%xmm1
movupd %xmm3,(%r9,%rbp,1)
movupd %xmm1,0x10(%r9,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r11
jne    1270 <posterior_nodisk+0x170>
mov    -0x20(%rsp),%rbp
mov    %rbp,%r10
cmp    %rbx,%rbp
je     11a0 <posterior_nodisk+0xa0>
jmp    12e0 <posterior_nodisk+0x1e0>
xor    %r10d,%r10d
mov    -0x48(%rsp),%rsi
mov    -0x5c(%rsp),%edi
mov    -0x50(%rsp),%r15
mov    -0x58(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r10,%r8
test   $0x1,%bl
je     1305 <posterior_nodisk+0x205>
movsd  (%rdx,%r10,8),%xmm0
mulsd  (%rcx),%xmm0
mulsd  (%rax,%r10,8),%xmm0
movsd  %xmm0,(%r9,%r10,8)
mov    %r10,%r8
or     $0x1,%r8
not    %r10
cmp    -0x8(%rsp),%r10
je     11a0 <posterior_nodisk+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdx,%r8,8),%xmm0
mulsd  (%rcx),%xmm0
mulsd  (%rax,%r8,8),%xmm0
movsd  %xmm0,(%r9,%r8,8)
movsd  0x8(%rdx,%r8,8),%xmm0
mulsd  (%rcx),%xmm0
mulsd  0x8(%rax,%r8,8),%xmm0
movsd  %xmm0,0x8(%r9,%r8,8)
add    $0x2,%r8
cmp    %r8,%rbx
jne    1320 <posterior_nodisk+0x220>
jmp    11a0 <posterior_nodisk+0xa0>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @posterior_nodisk(i32 %0, i64 %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = sext i32 %0 to i64
%8 = icmp eq i64 %1, 0
br i1 %8, label %126, label %9
9: ; preds = %6
%10 = add i64 %1, -1
%11 = mul i64 %10, %7
%12 = getelementptr inbounds double, double* %4, i64 %11
%13 = icmp sgt i32 %0, 0
%14 = sub nsw i64 0, %7
%15 = zext i32 %0 to i64
%16 = add i64 %11, %15
%17 = icmp ult i32 %0, 4
%18 = and i64 %15, 4294967292
%19 = icmp eq i64 %18, %15
%20 = and i64 %15, 1
%21 = icmp eq i64 %20, 0
%22 = sub nsw i64 0, %15
br label %23
23: ; preds = %9, %119
%24 = phi double* [ %5, %9 ], [ %120, %119 ]
%25 = phi double* [ %12, %9 ], [ %123, %119 ]
%26 = phi double* [ %3, %9 ], [ %122, %119 ]
%27 = phi double* [ %2, %9 ], [ %121, %119 ]
%28 = phi i64 [ 0, %9 ], [ %124, %119 ]
%29 = mul i64 %28, %7
%30 = add i64 %29, %15
%31 = getelementptr double, double* %5, i64 %30
%32 = getelementptr double, double* %2, i64 %30
%33 = add i64 %28, 1
%34 = getelementptr double, double* %3, i64 %33
%35 = mul i64 %28, %7
%36 = sub i64 %16, %35
%37 = getelementptr double, double* %4, i64 %36
br i1 %13, label %38, label %119
38: ; preds = %23
br i1 %17, label %82, label %39
39: ; preds = %38
%40 = icmp ult double* %24, %32
%41 = icmp ult double* %27, %31
%42 = and i1 %40, %41
%43 = icmp ult double* %24, %34
%44 = icmp ult double* %26, %31
%45 = and i1 %43, %44
%46 = or i1 %42, %45
%47 = icmp ult double* %24, %37
%48 = icmp ult double* %25, %31
%49 = and i1 %47, %48
%50 = or i1 %46, %49
br i1 %50, label %82, label %51
51: ; preds = %39
%52 = load double, double* %26
%53 = insertelement <2 x double> poison, double %52, i64 0
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> zeroinitializer
%55 = insertelement <2 x double> poison, double %52, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
br label %57
57: ; preds = %57, %51
%58 = phi i64 [ 0, %51 ], [ %79, %57 ]
%59 = getelementptr inbounds double, double* %27, i64 %58
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = getelementptr inbounds double, double* %59, i64 2
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = fmul <2 x double> %61, %54
%66 = fmul <2 x double> %64, %56
%67 = getelementptr inbounds double, double* %25, i64 %58
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr inbounds double, double* %67, i64 2
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = fmul <2 x double> %65, %69
%74 = fmul <2 x double> %66, %72
%75 = getelementptr inbounds double, double* %24, i64 %58
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %73, <2 x double>* %76
%77 = getelementptr inbounds double, double* %75, i64 2
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> %74, <2 x double>* %78
%79 = add nuw i64 %58, 4
%80 = icmp eq i64 %79, %18
br i1 %80, label %81, label %57
81: ; preds = %57
br i1 %19, label %119, label %82
82: ; preds = %39, %38, %81
%83 = phi i64 [ 0, %39 ], [ 0, %38 ], [ %18, %81 ]
%84 = xor i64 %83, -1
br i1 %21, label %95, label %85
85: ; preds = %82
%86 = getelementptr inbounds double, double* %27, i64 %83
%87 = load double, double* %86
%88 = load double, double* %26
%89 = fmul double %87, %88
%90 = getelementptr inbounds double, double* %25, i64 %83
%91 = load double, double* %90
%92 = fmul double %89, %91
%93 = getelementptr inbounds double, double* %24, i64 %83
store double %92, double* %93
%94 = or i64 %83, 1
br label %95
95: ; preds = %85, %82
%96 = phi i64 [ %83, %82 ], [ %94, %85 ]
%97 = icmp eq i64 %84, %22
br i1 %97, label %119, label %98
98: ; preds = %95, %98
%99 = phi i64 [ %117, %98 ], [ %96, %95 ]
%100 = getelementptr inbounds double, double* %27, i64 %99
%101 = load double, double* %100
%102 = load double, double* %26
%103 = fmul double %101, %102
%104 = getelementptr inbounds double, double* %25, i64 %99
%105 = load double, double* %104
%106 = fmul double %103, %105
%107 = getelementptr inbounds double, double* %24, i64 %99
store double %106, double* %107
%108 = add nuw nsw i64 %99, 1
%109 = getelementptr inbounds double, double* %27, i64 %108
%110 = load double, double* %109
%111 = load double, double* %26
%112 = fmul double %110, %111
%113 = getelementptr inbounds double, double* %25, i64 %108
%114 = load double, double* %113
%115 = fmul double %112, %114
%116 = getelementptr inbounds double, double* %24, i64 %108
store double %115, double* %116
%117 = add nuw nsw i64 %99, 2
%118 = icmp eq i64 %117, %15
br i1 %118, label %119, label %98
119: ; preds = %95, %98, %81, %23
%120 = getelementptr inbounds double, double* %24, i64 %7
%121 = getelementptr inbounds double, double* %27, i64 %7
%122 = getelementptr inbounds double, double* %26, i64 1
%123 = getelementptr inbounds double, double* %25, i64 %14
%124 = add nuw i64 %28, 1
%125 = icmp eq i64 %124, %1
br i1 %125, label %126, label %23
126: ; preds = %119, %6
ret i32 0
}