#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 trace_s {
  int dummy;
};
struct shmm_s {
  int dummy;
};
struct hmm_struc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EmitSequence(struct hmm_struc *, char **, struct trace_s **);
int /*<<< orphan*/ FreeTrace(struct trace_s *);
int /*<<< orphan*/ TraceScore(struct shmm_s *, char *, struct trace_s *,
                              float *);
int /*<<< orphan*/ free(char *);
double HMMInfoContent(struct hmm_struc *hmm, struct shmm_s *shmm) {
  char *seq;
  struct trace_s *tr;
  float score;
  float info;
  int i;
  int maxi = 500;
  info = 0.0;
  for (i = 0; i < maxi; i++) {
    EmitSequence(hmm, &seq, &tr);
    TraceScore(shmm, seq, tr, &score);
    info += score;
    free(seq);
    FreeTrace(tr);
  }
  return info / (double)maxi;
}


x86 assembly (clang, -O0):
<HMMInfoContent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1f4,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    11c7 <HMMInfoContent+0x87>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <EmitSequence@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1060 <TraceScore@plt>
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1050 <FreeTrace@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1166 <HMMInfoContent+0x26>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2sdl -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HMMInfoContent>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
mov    $0x1f4,%ebp
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <EmitSequence@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %r13,%rcx
call   1060 <TraceScore@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1050 <FreeTrace@plt>
add    $0xffffffff,%ebp
jne    1170 <HMMInfoContent+0x30>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe33(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hmm_struc = type { i32 }
%struct.shmm_s = type { i32 }
%struct.trace_s = type { i32 }
define double @HMMInfoContent(%struct.hmm_struc* %0, %struct.shmm_s* %1) {
%3 = alloca %struct.hmm_struc*
%4 = alloca %struct.shmm_s*
%5 = alloca i8*
%6 = alloca %struct.trace_s*
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
store %struct.hmm_struc* %0, %struct.hmm_struc** %3
store %struct.shmm_s* %1, %struct.shmm_s** %4
store i32 500, i32* %10
store float 0.000000e+00, float* %8
store i32 0, i32* %9
br label %11
11: ; preds = %29, %2
%12 = load i32, i32* %9
%13 = load i32, i32* %10
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %32
15: ; preds = %11
%16 = load %struct.hmm_struc*, %struct.hmm_struc** %3
%17 = call i32 @EmitSequence(%struct.hmm_struc* %16, i8** %5, %struct.trace_s** %6)
%18 = load %struct.shmm_s*, %struct.shmm_s** %4
%19 = load i8*, i8** %5
%20 = load %struct.trace_s*, %struct.trace_s** %6
%21 = call i32 @TraceScore(%struct.shmm_s* %18, i8* %19, %struct.trace_s* %20, float* %7)
%22 = load float, float* %7
%23 = load float, float* %8
%24 = fadd float %23, %22
store float %24, float* %8
%25 = load i8*, i8** %5
%26 = call i32 @free(i8* %25)
%27 = load %struct.trace_s*, %struct.trace_s** %6
%28 = call i32 @FreeTrace(%struct.trace_s* %27)
br label %29
29: ; preds = %15
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %11
32: ; preds = %11
%33 = load float, float* %8
%34 = fpext float %33 to double
%35 = load i32, i32* %10
%36 = sitofp i32 %35 to double
%37 = fdiv double %34, %36
ret double %37
}

LLVM IR (-O2):
%struct.hmm_struc = type { i32 }
%struct.shmm_s = type { i32 }
%struct.trace_s = type { i32 }
define double @HMMInfoContent(%struct.hmm_struc* %0, %struct.shmm_s* %1) {
%3 = alloca i8*
%4 = alloca %struct.trace_s*
%5 = alloca float
%6 = bitcast i8** %3 to i8*
%7 = bitcast %struct.trace_s** %4 to i8*
%8 = bitcast float* %5 to i8*
br label %9
9: ; preds = %2, %9
%10 = phi float [ 0.000000e+00, %2 ], [ %17, %9 ]
%11 = phi i32 [ 0, %2 ], [ %22, %9 ]
%12 = call i32 @EmitSequence(%struct.hmm_struc* %0, i8** %3, %struct.trace_s** %4)
%13 = load i8*, i8** %3
%14 = load %struct.trace_s*, %struct.trace_s** %4
%15 = call i32 @TraceScore(%struct.shmm_s* %1, i8* %13, %struct.trace_s* %14, float* %5)
%16 = load float, float* %5
%17 = fadd float %10, %16
%18 = load i8*, i8** %3
%19 = call i32 @free(i8* %18)
%20 = load %struct.trace_s*, %struct.trace_s** %4
%21 = call i32 @FreeTrace(%struct.trace_s* %20)
%22 = add nuw nsw i32 %11, 1
%23 = icmp eq i32 %22, 500
br i1 %23, label %24, label %9
24: ; preds = %9
%25 = fpext float %17 to double
%26 = fdiv double %25, 5.000000e+02
ret double %26
}