#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 */
struct freq {
  int dummy;
};

/* Variables and functions */
double seqBgScore(int *, int, int, int, struct freq *);
void getSeqBgScore(double *segscore, int *seqi, int st, int end, int w, int mkv,
                   struct freq *bglog) {
  int i;
  for (i = st; i <= end; i++)
    segscore[i] = seqBgScore(&(seqi[i]), i, w, mkv, bglog);
}


x86 assembly (clang, -O0):
<getSeqBgScore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1180 <getSeqBgScore+0x70>
mov    -0x10(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x24(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    0x10(%rbp),%r8
call   1030 <seqBgScore@plt>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1138 <getSeqBgScore+0x28>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSeqBgScore>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %ecx,%edx
jg     116b <getSeqBgScore+0x5b>
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r13d
mov    %edx,%ebp
movslq %edx,%rax
add    $0x1,%r13d
lea    (%rsi,%rax,4),%rbx
lea    (%rdi,%rax,8),%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    0x40(%rsp),%r8
call   1030 <seqBgScore@plt>
movsd  %xmm0,(%r12)
add    $0x1,%ebp
add    $0x4,%rbx
add    $0x8,%r12
cmp    %ebp,%r13d
jne    1140 <getSeqBgScore+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.freq = type { i32 }
define void @getSeqBgScore(double* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5, %struct.freq* %6) {
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.freq*
%15 = alloca i32
store double* %0, double** %8
store i32* %1, i32** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store %struct.freq* %6, %struct.freq** %14
%16 = load i32, i32* %10
store i32 %16, i32* %15
br label %17
17: ; preds = %35, %7
%18 = load i32, i32* %15
%19 = load i32, i32* %11
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %38
21: ; preds = %17
%22 = load i32*, i32** %9
%23 = load i32, i32* %15
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %15
%27 = load i32, i32* %12
%28 = load i32, i32* %13
%29 = load %struct.freq*, %struct.freq** %14
%30 = call double @seqBgScore(i32* %25, i32 %26, i32 %27, i32 %28, %struct.freq* %29)
%31 = load double*, double** %8
%32 = load i32, i32* %15
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
store double %30, double* %34
br label %35
35: ; preds = %21
%36 = load i32, i32* %15
%37 = add nsw i32 %36, 1
store i32 %37, i32* %15
br label %17
38: ; preds = %17
ret void
}

LLVM IR (-O2):
%struct.freq = type { i32 }
define void @getSeqBgScore(double* nocapture writeonly %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5, %struct.freq* %6) {
%8 = icmp sgt i32 %2, %3
br i1 %8, label %21, label %9
9: ; preds = %7
%10 = sext i32 %2 to i64
%11 = add i32 %3, 1
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ %10, %9 ], [ %18, %12 ]
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = trunc i64 %13 to i32
%16 = tail call double @seqBgScore(i32* %14, i32 %15, i32 %4, i32 %5, %struct.freq* %6)
%17 = getelementptr inbounds double, double* %0, i64 %13
store double %16, double* %17
%18 = add nsw i64 %13, 1
%19 = trunc i64 %18 to i32
%20 = icmp eq i32 %11, %19
br i1 %20, label %21, label %12
21: ; preds = %12, %7
ret void
}