; LLVM IR from simbody/simbody :: SimTKmath/Optimizers/src/c-cmaes (cmaes)

; 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.cmaes_readpara_t = type { ptr, i16, i32, i32, ptr, ptr, i32, ptr, ptr, double, double, double, %struct.anon, double, double, double, double, i32, i32, double, double, ptr, double, double, double, double, double, %struct.anon.0, double, ptr, [99 x i8], ptr, ptr, ptr, ptr, i32, i32, i32 }
%struct.anon = type { i32, double }
%struct.anon.0 = type { i32, double, double }

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

; Function Attrs: nounwind uwtable
define dso_local void @cmaes_readpara_exit(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %3, i32 0, i32 0
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %11

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %10) #2
  br label %11

11:                                               ; preds = %7, %1
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %12, i32 0, i32 4
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %20

16:                                               ; preds = %11
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  call void @free(ptr noundef %19) #2
  br label %20

20:                                               ; preds = %16, %11
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %21, i32 0, i32 5
  %23 = load ptr, ptr %22, align 8, !tbaa !17
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %29

25:                                               ; preds = %20
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  call void @free(ptr noundef %28) #2
  br label %29

29:                                               ; preds = %25, %20
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %30, i32 0, i32 7
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %38

34:                                               ; preds = %29
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  call void @free(ptr noundef %37) #2
  br label %38

38:                                               ; preds = %34, %29
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %39, i32 0, i32 8
  %41 = load ptr, ptr %40, align 8, !tbaa !19
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %47

43:                                               ; preds = %38
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !19
  call void @free(ptr noundef %46) #2
  br label %47

47:                                               ; preds = %43, %38
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %48, i32 0, i32 21
  %50 = load ptr, ptr %49, align 8, !tbaa !20
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %56

52:                                               ; preds = %47
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %53, i32 0, i32 21
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  call void @free(ptr noundef %55) #2
  br label %56

56:                                               ; preds = %52, %47
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %57, i32 0, i32 31
  %59 = load ptr, ptr %58, align 8, !tbaa !21
  call void @free(ptr noundef %59) #2
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %60, i32 0, i32 32
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  call void @free(ptr noundef %62) #2
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %63, i32 0, i32 33
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  call void @free(ptr noundef %65) #2
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %66, i32 0, i32 34
  %68 = load ptr, ptr %67, align 8, !tbaa !24
  call void @free(ptr noundef %68) #2
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.cmaes_readpara_t, ptr %69, i32 0, i32 29
  %71 = load ptr, ptr %70, align 8, !tbaa !25
  call void @free(ptr noundef %71) #2
  ret void
}

attributes #0 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !12, i64 12, !12, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !14, i64 88, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !12, i64 136, !12, i64 140, !13, i64 144, !13, i64 152, !6, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !15, i64 208, !13, i64 232, !6, i64 240, !7, i64 248, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !12, i64 384, !12, i64 388, !12, i64 392}
!11 = !{!"short", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"", !12, i64 0, !13, i64 8}
!15 = !{!"", !12, i64 0, !13, i64 8, !13, i64 16}
!16 = !{!10, !6, i64 24}
!17 = !{!10, !6, i64 32}
!18 = !{!10, !6, i64 48}
!19 = !{!10, !6, i64 56}
!20 = !{!10, !6, i64 160}
!21 = !{!10, !6, i64 352}
!22 = !{!10, !6, i64 360}
!23 = !{!10, !6, i64 368}
!24 = !{!10, !6, i64 376}
!25 = !{!10, !6, i64 240}


; 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 willreturn uwtable
define dso_local void @cmaes_readpara_exit(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %4, label %3

3:                                                ; preds = %1
  tail call void @free(ptr noundef nonnull %2) #2
  br label %4

4:                                                ; preds = %3, %1
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !15
  %.not22 = icmp eq ptr %6, null
  br i1 %.not22, label %8, label %7

7:                                                ; preds = %4
  tail call void @free(ptr noundef nonnull %6) #2
  br label %8

8:                                                ; preds = %7, %4
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %.not23 = icmp eq ptr %10, null
  br i1 %.not23, label %12, label %11

11:                                               ; preds = %8
  tail call void @free(ptr noundef nonnull %10) #2
  br label %12

12:                                               ; preds = %11, %8
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  %.not24 = icmp eq ptr %14, null
  br i1 %.not24, label %16, label %15

15:                                               ; preds = %12
  tail call void @free(ptr noundef nonnull %14) #2
  br label %16

16:                                               ; preds = %15, %12
  %17 = getelementptr inbounds i8, ptr %0, i64 56
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %.not25 = icmp eq ptr %18, null
  br i1 %.not25, label %20, label %19

19:                                               ; preds = %16
  tail call void @free(ptr noundef nonnull %18) #2
  br label %20

20:                                               ; preds = %19, %16
  %21 = getelementptr inbounds i8, ptr %0, i64 160
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %.not26 = icmp eq ptr %22, null
  br i1 %.not26, label %24, label %23

23:                                               ; preds = %20
  tail call void @free(ptr noundef nonnull %22) #2
  br label %24

24:                                               ; preds = %23, %20
  %25 = getelementptr inbounds i8, ptr %0, i64 352
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @free(ptr noundef %26) #2
  %27 = getelementptr inbounds i8, ptr %0, i64 360
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  tail call void @free(ptr noundef %28) #2
  %29 = getelementptr inbounds i8, ptr %0, i64 368
  %30 = load ptr, ptr %29, align 8, !tbaa !22
  tail call void @free(ptr noundef %30) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 376
  %32 = load ptr, ptr %31, align 8, !tbaa !23
  tail call void @free(ptr noundef %32) #2
  %33 = getelementptr inbounds i8, ptr %0, i64 240
  %34 = load ptr, ptr %33, align 8, !tbaa !24
  tail call void @free(ptr noundef %34) #2
  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 willreturn 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, !11, i64 12, !11, i64 16, !7, i64 24, !7, i64 32, !11, i64 40, !7, i64 48, !7, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !13, i64 88, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !11, i64 136, !11, i64 140, !12, i64 144, !12, i64 152, !7, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !14, i64 208, !12, i64 232, !7, i64 240, !8, i64 248, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !11, i64 384, !11, i64 388, !11, i64 392}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"", !11, i64 0, !12, i64 8}
!14 = !{!"", !11, i64 0, !12, i64 8, !12, i64 16}
!15 = !{!6, !7, i64 24}
!16 = !{!6, !7, i64 32}
!17 = !{!6, !7, i64 48}
!18 = !{!6, !7, i64 56}
!19 = !{!6, !7, i64 160}
!20 = !{!6, !7, i64 352}
!21 = !{!6, !7, i64 360}
!22 = !{!6, !7, i64 368}
!23 = !{!6, !7, i64 376}
!24 = !{!6, !7, i64 240}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass