; LLVM IR from cfd-rg-solver/FVM-RG-Solver :: src/AbstractSolver.ll (ZN14AbstractSolver19getSystemOfEquationE20SystemOfEquationType)

; 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"

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #0

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14AbstractSolver19getSystemOfEquationE20SystemOfEquationType(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8
  %13 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %13, label %46 [
    i32 0, label %14
    i32 1, label %22
    i32 2, label %30
    i32 3, label %38
  ]

14:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %15 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 296) #5
  invoke void @_ZN8Couette2C2Ev(ptr noundef nonnull align 8 dereferenceable(296) %15)
          to label %16 unwind label %18

16:                                               ; preds = %14
  store ptr %15, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %17, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %47

18:                                               ; preds = %14
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %7, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %15, i64 noundef 296) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %49

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %23 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 320) #5
  invoke void @_ZN11Couette2AltC2Ev(ptr noundef nonnull align 8 dereferenceable(320) %23)
          to label %24 unwind label %26

24:                                               ; preds = %22
  store ptr %23, ptr %9, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %25, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %47

26:                                               ; preds = %22
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %7, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %23, i64 noundef 320) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %49

30:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %31 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 344) #5
  invoke void @_ZN17Couette2AltBinaryC2Ev(ptr noundef nonnull align 8 dereferenceable(344) %31)
          to label %32 unwind label %34

32:                                               ; preds = %30
  store ptr %31, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %33, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %47

34:                                               ; preds = %30
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %7, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %31, i64 noundef 344) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %49

38:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %39 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 304) #5
  invoke void @_ZN4SodaC2Ev(ptr noundef nonnull align 8 dereferenceable(304) %39)
          to label %40 unwind label %42

40:                                               ; preds = %38
  store ptr %39, ptr %11, align 8, !tbaa !5
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %41, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %47

42:                                               ; preds = %38
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %7, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %39, i64 noundef 304) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %49

46:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  br label %47

47:                                               ; preds = %46, %40, %32, %24, %16
  %48 = load ptr, ptr %3, align 8
  ret ptr %48

49:                                               ; preds = %42, %34, %26, %18
  %50 = load ptr, ptr %7, align 8
  %51 = load i32, ptr %8, align 4
  %52 = insertvalue { ptr, i32 } poison, ptr %50, 0
  %53 = insertvalue { ptr, i32 } %52, i32 %51, 1
  resume { ptr, i32 } %53
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Couette2C2Ev(ptr noundef nonnull align 8 dereferenceable(296)) unnamed_addr #2 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11Couette2AltC2Ev(ptr noundef nonnull align 8 dereferenceable(320)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17Couette2AltBinaryC2Ev(ptr noundef nonnull align 8 dereferenceable(344)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4SodaC2Ev(ptr noundef nonnull align 8 dereferenceable(304)) unnamed_addr #2 align 2

attributes #0 = { nobuiltin allocsize(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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { nobuiltin 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 #4 = { nounwind }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { builtin 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, !10, i64 0}
!10 = !{!"_ZTS20SystemOfEquationType", !7, i64 0}


; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14AbstractSolver19getSystemOfEquationE20SystemOfEquationType(ptr nocapture noundef nonnull readnone align 8 dereferenceable(233) %0, i32 noundef %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  switch i32 %1, label %19 [
    i32 0, label %3
    i32 1, label %7
    i32 2, label %11
    i32 3, label %15
  ]

3:                                                ; preds = %2
  %4 = tail call noalias noundef nonnull dereferenceable(296) ptr @_Znwm(i64 noundef 296) #3
  invoke void @_ZN8Couette2C2Ev(ptr noundef nonnull align 8 dereferenceable(296) %4)
          to label %19 unwind label %5

5:                                                ; preds = %3
  %6 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %4, i64 noundef 296) #4
  br label %20

7:                                                ; preds = %2
  %8 = tail call noalias noundef nonnull dereferenceable(320) ptr @_Znwm(i64 noundef 320) #3
  invoke void @_ZN11Couette2AltC2Ev(ptr noundef nonnull align 8 dereferenceable(320) %8)
          to label %19 unwind label %9

9:                                                ; preds = %7
  %10 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 320) #4
  br label %20

11:                                               ; preds = %2
  %12 = tail call noalias noundef nonnull dereferenceable(344) ptr @_Znwm(i64 noundef 344) #3
  invoke void @_ZN17Couette2AltBinaryC2Ev(ptr noundef nonnull align 8 dereferenceable(344) %12)
          to label %19 unwind label %13

13:                                               ; preds = %11
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %12, i64 noundef 344) #4
  br label %20

15:                                               ; preds = %2
  %16 = tail call noalias noundef nonnull dereferenceable(304) ptr @_Znwm(i64 noundef 304) #3
  invoke void @_ZN4SodaC2Ev(ptr noundef nonnull align 8 dereferenceable(304) %16)
          to label %19 unwind label %17

17:                                               ; preds = %15
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %16, i64 noundef 304) #4
  br label %20

19:                                               ; preds = %2, %15, %11, %7, %3
  %.0 = phi ptr [ %4, %3 ], [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ null, %2 ]
  ret ptr %.0

20:                                               ; preds = %17, %13, %9, %5
  %.pn = phi { ptr, i32 } [ %18, %17 ], [ %14, %13 ], [ %10, %9 ], [ %6, %5 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Couette2C2Ev(ptr noundef nonnull align 8 dereferenceable(296)) unnamed_addr #1 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11Couette2AltC2Ev(ptr noundef nonnull align 8 dereferenceable(320)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17Couette2AltBinaryC2Ev(ptr noundef nonnull align 8 dereferenceable(344)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4SodaC2Ev(ptr noundef nonnull align 8 dereferenceable(304)) unnamed_addr #1 align 2

attributes #0 = { nobuiltin allocsize(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 #1 = { mustprogress 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 = { nobuiltin 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 #3 = { builtin allocsize(0) }
attributes #4 = { builtin 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)"}


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