; LLVM IR from robotic-vision-lab/Cloud-Object-Recognition-Engine :: 3rdparty/libsvm (svm)

; 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.svm_model = type { %struct.svm_parameter, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.svm_parameter = type { i32, i32, i32, double, double, double, double, double, i32, ptr, ptr, double, double, i32, i32 }

; 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: mustprogress nounwind uwtable
define dso_local void @svm_free_model_content(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.svm_model, ptr %4, i32 0, i32 11
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %24

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.svm_model, ptr %9, i32 0, i32 2
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %13, label %24

13:                                               ; preds = %8
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.svm_model, ptr %14, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %24

18:                                               ; preds = %13
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.svm_model, ptr %19, i32 0, i32 3
  %21 = load ptr, ptr %20, align 8, !tbaa !15
  %22 = getelementptr inbounds ptr, ptr %21, i64 0
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  call void @free(ptr noundef %23) #3
  br label %24

24:                                               ; preds = %18, %13, %8, %1
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.svm_model, ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %50

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %30

30:                                               ; preds = %46, %29
  %31 = load i32, ptr %3, align 4, !tbaa !17
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.svm_model, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = sub nsw i32 %34, 1
  %36 = icmp slt i32 %31, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %49

38:                                               ; preds = %30
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.svm_model, ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = load i32, ptr %3, align 4, !tbaa !17
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %41, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  call void @free(ptr noundef %45) #3
  br label %46

46:                                               ; preds = %38
  %47 = load i32, ptr %3, align 4, !tbaa !17
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !17
  br label %30, !llvm.loop !19

49:                                               ; preds = %37
  br label %50

50:                                               ; preds = %49, %24
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.svm_model, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  call void @free(ptr noundef %53) #3
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.svm_model, ptr %54, i32 0, i32 3
  store ptr null, ptr %55, align 8, !tbaa !15
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.svm_model, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  call void @free(ptr noundef %58) #3
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.svm_model, ptr %59, i32 0, i32 4
  store ptr null, ptr %60, align 8, !tbaa !16
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.svm_model, ptr %61, i32 0, i32 5
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  call void @free(ptr noundef %63) #3
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.svm_model, ptr %64, i32 0, i32 5
  store ptr null, ptr %65, align 8, !tbaa !21
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.svm_model, ptr %66, i32 0, i32 9
  %68 = load ptr, ptr %67, align 8, !tbaa !22
  call void @free(ptr noundef %68) #3
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.svm_model, ptr %69, i32 0, i32 9
  store ptr null, ptr %70, align 8, !tbaa !22
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.svm_model, ptr %71, i32 0, i32 6
  %73 = load ptr, ptr %72, align 8, !tbaa !23
  call void @free(ptr noundef %73) #3
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.svm_model, ptr %74, i32 0, i32 6
  store ptr null, ptr %75, align 8, !tbaa !23
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.svm_model, ptr %76, i32 0, i32 7
  %78 = load ptr, ptr %77, align 8, !tbaa !24
  call void @free(ptr noundef %78) #3
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.svm_model, ptr %79, i32 0, i32 7
  store ptr null, ptr %80, align 8, !tbaa !24
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.svm_model, ptr %81, i32 0, i32 8
  %83 = load ptr, ptr %82, align 8, !tbaa !25
  call void @free(ptr noundef %83) #3
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.svm_model, ptr %84, i32 0, i32 8
  store ptr null, ptr %85, align 8, !tbaa !25
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.svm_model, ptr %86, i32 0, i32 10
  %88 = load ptr, ptr %87, align 8, !tbaa !26
  call void @free(ptr noundef %88) #3
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.svm_model, ptr %89, i32 0, i32 10
  store ptr null, ptr %90, align 8, !tbaa !26
  ret void
}

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 = { mustprogress 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++ TBAA"}
!9 = !{!10, !12, i64 176}
!10 = !{!"_ZTS9svm_model", !11, i64 0, !12, i64 104, !12, i64 108, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !12, i64 176}
!11 = !{!"_ZTS13svm_parameter", !12, i64 0, !12, i64 4, !12, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !13, i64 80, !13, i64 88, !12, i64 96, !12, i64 100}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!10, !12, i64 108}
!15 = !{!10, !6, i64 112}
!16 = !{!10, !6, i64 120}
!17 = !{!12, !12, i64 0}
!18 = !{!10, !12, i64 104}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !6, i64 128}
!22 = !{!10, !6, i64 160}
!23 = !{!10, !6, i64 136}
!24 = !{!10, !6, i64 144}
!25 = !{!10, !6, i64 152}
!26 = !{!10, !6, i64 168}


; 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: mustprogress nounwind uwtable
define dso_local void @svm_free_model_content(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 176
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %13, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 108
  %6 = load i32, ptr %5, align 4, !tbaa !13
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %8, label %13

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 112
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %.not26 = icmp eq ptr %10, null
  br i1 %.not26, label %13, label %11

11:                                               ; preds = %8
  %12 = load ptr, ptr %10, align 8, !tbaa !15
  tail call void @free(ptr noundef %12) #2
  br label %13

13:                                               ; preds = %11, %8, %4, %1
  %14 = getelementptr inbounds i8, ptr %0, i64 120
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %.not27 = icmp eq ptr %15, null
  br i1 %.not27, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 104
  %17 = load i32, ptr %16, align 8, !tbaa !17
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %19 = load ptr, ptr %14, align 8, !tbaa !16
  %20 = getelementptr inbounds ptr, ptr %19, i64 %indvars.iv
  %21 = load ptr, ptr %20, align 8, !tbaa !15
  tail call void @free(ptr noundef %21) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr %16, align 8, !tbaa !17
  %23 = add nsw i32 %22, -1
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %13
  %26 = getelementptr inbounds i8, ptr %0, i64 112
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  tail call void @free(ptr noundef %27) #2
  store ptr null, ptr %26, align 8, !tbaa !14
  %28 = load ptr, ptr %14, align 8, !tbaa !16
  tail call void @free(ptr noundef %28) #2
  store ptr null, ptr %14, align 8, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %0, i64 128
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  tail call void @free(ptr noundef %30) #2
  store ptr null, ptr %29, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 160
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  tail call void @free(ptr noundef %32) #2
  store ptr null, ptr %31, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %0, i64 136
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  tail call void @free(ptr noundef %34) #2
  store ptr null, ptr %33, align 8, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %0, i64 144
  %36 = load ptr, ptr %35, align 8, !tbaa !23
  tail call void @free(ptr noundef %36) #2
  store ptr null, ptr %35, align 8, !tbaa !23
  %37 = getelementptr inbounds i8, ptr %0, i64 152
  %38 = load ptr, ptr %37, align 8, !tbaa !24
  tail call void @free(ptr noundef %38) #2
  store ptr null, ptr %37, align 8, !tbaa !24
  %39 = getelementptr inbounds i8, ptr %0, i64 168
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  tail call void @free(ptr noundef %40) #2
  store ptr null, ptr %39, align 8, !tbaa !25
  ret void
}

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 = { mustprogress 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, !8, i64 176}
!6 = !{!"_ZTS9svm_model", !7, i64 0, !8, i64 104, !8, i64 108, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !8, i64 176}
!7 = !{!"_ZTS13svm_parameter", !8, i64 0, !8, i64 4, !8, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !8, i64 56, !12, i64 64, !12, i64 72, !11, i64 80, !11, i64 88, !8, i64 96, !8, i64 100}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!6, !8, i64 108}
!14 = !{!6, !12, i64 112}
!15 = !{!12, !12, i64 0}
!16 = !{!6, !12, i64 120}
!17 = !{!6, !8, i64 104}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !12, i64 128}
!21 = !{!6, !12, i64 160}
!22 = !{!6, !12, i64 136}
!23 = !{!6, !12, i64 144}
!24 = !{!6, !12, i64 152}
!25 = !{!6, !12, i64 168}


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