; LLVM IR from kkumatani/distant_speech_recognition :: btk20_src/sad (neural_spnsp_det)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.MLP = type { i32, ptr, ptr, ptr, ptr, ptr, i32, ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @Free_Mlp_Param_Mem(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %20, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.MLP, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = icmp slt i32 %7, %10
  br i1 %11, label %12, label %23

12:                                               ; preds = %6
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.MLP, ptr %13, i32 0, i32 7
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds ptr, ptr %15, i64 %17
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %19) #3
  br label %20

20:                                               ; preds = %12
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !14

23:                                               ; preds = %6
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.MLP, ptr %24, i32 0, i32 7
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  call void @free(ptr noundef %26) #3
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.MLP, ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  call void @free(ptr noundef %29) #3
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.MLP, ptr %30, i32 0, i32 4
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  call void @free(ptr noundef %32) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %80, %23
  %34 = load i32, ptr %3, align 4, !tbaa !9
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.MLP, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = icmp slt i32 %34, %37
  br i1 %38, label %39, label %83

39:                                               ; preds = %33
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %62, %39
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MLP, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !18
  %45 = load i32, ptr %3, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = icmp slt i32 %41, %48
  br i1 %49, label %50, label %65

50:                                               ; preds = %40
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MLP, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %53, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  call void @free(ptr noundef %61) #3
  br label %62

62:                                               ; preds = %50
  %63 = load i32, ptr %4, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %4, align 4, !tbaa !9
  br label %40, !llvm.loop !20

65:                                               ; preds = %40
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.MLP, ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = load i32, ptr %3, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %68, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  call void @free(ptr noundef %72) #3
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.MLP, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %74, align 8, !tbaa !21
  %76 = load i32, ptr %3, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  call void @free(ptr noundef %79) #3
  br label %80

80:                                               ; preds = %65
  %81 = load i32, ptr %3, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %3, align 4, !tbaa !9
  br label %33, !llvm.loop !22

83:                                               ; preds = %33
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.MLP, ptr %84, i32 0, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !19
  call void @free(ptr noundef %86) #3
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MLP, ptr %87, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  call void @free(ptr noundef %89) #3
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.MLP, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !18
  call void @free(ptr noundef %92) #3
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %93) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !6, i64 56}
!13 = !{!12, !6, i64 56}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !6, i64 40}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 8}
!19 = !{!12, !6, i64 16}
!20 = distinct !{!20, !15}
!21 = !{!12, !6, i64 24}
!22 = distinct !{!22, !15}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @Free_Mlp_Param_Mem(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 56
  br label %5

5:                                                ; preds = %.lr.ph, %5
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %5 ]
  %6 = load ptr, ptr %4, align 8, !tbaa !11
  %7 = getelementptr inbounds ptr, ptr %6, i64 %indvars.iv
  %8 = load ptr, ptr %7, align 8, !tbaa !12
  tail call void @free(ptr noundef %8) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = load i32, ptr %0, align 8, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = icmp slt i64 %indvars.iv.next, %10
  br i1 %11, label %5, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %5, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  tail call void @free(ptr noundef %13) #2
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  tail call void @free(ptr noundef %15) #2
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  tail call void @free(ptr noundef %17) #2
  %18 = load i32, ptr %0, align 8, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.preheader.lr.ph, label %._crit_edge31

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge29
  %indvars.iv36 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next37, %._crit_edge29 ]
  %23 = load ptr, ptr %20, align 8, !tbaa !17
  %24 = getelementptr inbounds i32, ptr %23, i64 %indvars.iv36
  %25 = load i32, ptr %24, align 4, !tbaa !18
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph28, label %._crit_edge29

.lr.ph28:                                         ; preds = %.preheader, %.lr.ph28
  %indvars.iv33 = phi i64 [ %indvars.iv.next34, %.lr.ph28 ], [ 0, %.preheader ]
  %27 = load ptr, ptr %21, align 8, !tbaa !19
  %28 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv36
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds ptr, ptr %29, i64 %indvars.iv33
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  tail call void @free(ptr noundef %31) #2
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %32 = load ptr, ptr %20, align 8, !tbaa !17
  %33 = getelementptr inbounds i32, ptr %32, i64 %indvars.iv36
  %34 = load i32, ptr %33, align 4, !tbaa !18
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next34, %35
  br i1 %36, label %.lr.ph28, label %._crit_edge29, !llvm.loop !20

._crit_edge29:                                    ; preds = %.lr.ph28, %.preheader
  %37 = load ptr, ptr %21, align 8, !tbaa !19
  %38 = getelementptr inbounds ptr, ptr %37, i64 %indvars.iv36
  %39 = load ptr, ptr %38, align 8, !tbaa !12
  tail call void @free(ptr noundef %39) #2
  %40 = load ptr, ptr %22, align 8, !tbaa !21
  %41 = getelementptr inbounds ptr, ptr %40, i64 %indvars.iv36
  %42 = load ptr, ptr %41, align 8, !tbaa !12
  tail call void @free(ptr noundef %42) #2
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %43 = load i32, ptr %0, align 8, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next37, %44
  br i1 %45, label %.preheader, label %._crit_edge31, !llvm.loop !22

._crit_edge31:                                    ; preds = %._crit_edge29, %._crit_edge
  %46 = getelementptr inbounds i8, ptr %0, i64 16
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  tail call void @free(ptr noundef %47) #2
  %48 = getelementptr inbounds i8, ptr %0, i64 24
  %49 = load ptr, ptr %48, align 8, !tbaa !21
  tail call void @free(ptr noundef %49) #2
  %50 = getelementptr inbounds i8, ptr %0, i64 8
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  tail call void @free(ptr noundef %51) #2
  tail call void @free(ptr noundef nonnull %0) #2
  ret i32 0
}

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !7, i64 48, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 56}
!12 = !{!10, !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !10, i64 40}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !10, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!6, !10, i64 16}
!20 = distinct !{!20, !14}
!21 = !{!6, !10, i64 24}
!22 = distinct !{!22, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass