; LLVM IR from stan-dev/math :: lib/sundials_6.1.1/src/sunnonlinsol/newton (sunnonlinsol_newton)

; 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._generic_N_Vector = type { ptr, ptr, ptr }
%struct._generic_N_Vector_Ops = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._generic_SUNNonlinearSolver = type { ptr, ptr, ptr }
%struct._generic_SUNNonlinearSolver_Ops = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._SUNNonlinearSolverContent_Newton = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i64, i64, ptr, i32, ptr }

@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @SUNNonlinSol_Newton(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._generic_N_Vector, ptr %13, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct._generic_N_Vector_Ops, ptr %15, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = icmp eq ptr %17, null
  br i1 %18, label %40, label %19

19:                                               ; preds = %12
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._generic_N_Vector, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct._generic_N_Vector_Ops, ptr %22, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = icmp eq ptr %24, null
  br i1 %25, label %40, label %26

26:                                               ; preds = %19
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._generic_N_Vector, ptr %27, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct._generic_N_Vector_Ops, ptr %29, i32 0, i32 14
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = icmp eq ptr %31, null
  br i1 %32, label %40, label %33

33:                                               ; preds = %26
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._generic_N_Vector, ptr %34, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct._generic_N_Vector_Ops, ptr %36, i32 0, i32 10
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %33, %26, %19, %12
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

41:                                               ; preds = %33
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call ptr @SUNNonlinSolNewEmpty(ptr noundef %42)
  store ptr %43, ptr %6, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

47:                                               ; preds = %41
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %50, i32 0, i32 0
  store ptr @SUNNonlinSolGetType_Newton, ptr %51, align 8, !tbaa !18
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %54, i32 0, i32 1
  store ptr @SUNNonlinSolInitialize_Newton, ptr %55, align 8, !tbaa !20
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  %59 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %58, i32 0, i32 3
  store ptr @SUNNonlinSolSolve_Newton, ptr %59, align 8, !tbaa !21
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !16
  %63 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %62, i32 0, i32 4
  store ptr @SUNNonlinSolFree_Newton, ptr %63, align 8, !tbaa !22
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  %67 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %66, i32 0, i32 5
  store ptr @SUNNonlinSolSetSysFn_Newton, ptr %67, align 8, !tbaa !23
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !16
  %71 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %70, i32 0, i32 6
  store ptr @SUNNonlinSolSetLSetupFn_Newton, ptr %71, align 8, !tbaa !24
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !16
  %75 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %74, i32 0, i32 7
  store ptr @SUNNonlinSolSetLSolveFn_Newton, ptr %75, align 8, !tbaa !25
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !16
  %79 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %78, i32 0, i32 8
  store ptr @SUNNonlinSolSetConvTestFn_Newton, ptr %79, align 8, !tbaa !26
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %82, i32 0, i32 9
  store ptr @SUNNonlinSolSetMaxIters_Newton, ptr %83, align 8, !tbaa !27
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !16
  %87 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %86, i32 0, i32 10
  store ptr @SUNNonlinSolGetNumIters_Newton, ptr %87, align 8, !tbaa !28
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %90, i32 0, i32 11
  store ptr @SUNNonlinSolGetCurIter_Newton, ptr %91, align 8, !tbaa !29
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %92, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8, !tbaa !16
  %95 = getelementptr inbounds %struct._generic_SUNNonlinearSolver_Ops, ptr %94, i32 0, i32 12
  store ptr @SUNNonlinSolGetNumConvFails_Newton, ptr %95, align 8, !tbaa !30
  store ptr null, ptr %7, align 8, !tbaa !5
  %96 = call noalias ptr @malloc(i64 noundef 96) #6
  store ptr %96, ptr %7, align 8, !tbaa !5
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %102

99:                                               ; preds = %47
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = call i32 @SUNNonlinSolFree(ptr noundef %100)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

102:                                              ; preds = %47
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %103, i8 0, i64 96, i1 false)
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._generic_SUNNonlinearSolver, ptr %105, i32 0, i32 0
  store ptr %104, ptr %106, align 8, !tbaa !31
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %107, i32 0, i32 0
  store ptr null, ptr %108, align 8, !tbaa !32
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %109, i32 0, i32 1
  store ptr null, ptr %110, align 8, !tbaa !36
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %111, i32 0, i32 2
  store ptr null, ptr %112, align 8, !tbaa !37
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %113, i32 0, i32 3
  store ptr null, ptr %114, align 8, !tbaa !38
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %115, i32 0, i32 5
  store i32 0, ptr %116, align 8, !tbaa !39
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %117, i32 0, i32 6
  store i32 0, ptr %118, align 4, !tbaa !40
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %119, i32 0, i32 7
  store i32 3, ptr %120, align 8, !tbaa !41
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %121, i32 0, i32 8
  store i64 0, ptr %122, align 8, !tbaa !42
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %123, i32 0, i32 9
  store i64 0, ptr %124, align 8, !tbaa !43
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %125, i32 0, i32 10
  store ptr null, ptr %126, align 8, !tbaa !44
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %127, i32 0, i32 11
  store i32 0, ptr %128, align 8, !tbaa !45
  %129 = load ptr, ptr @stdout, align 8, !tbaa !5
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %130, i32 0, i32 12
  store ptr %129, ptr %131, align 8, !tbaa !46
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = call ptr @N_VClone(ptr noundef %132)
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %134, i32 0, i32 4
  store ptr %133, ptr %135, align 8, !tbaa !47
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._SUNNonlinearSolverContent_Newton, ptr %136, i32 0, i32 4
  %138 = load ptr, ptr %137, align 8, !tbaa !47
  %139 = icmp eq ptr %138, null
  br i1 %139, label %140, label %143

140:                                              ; preds = %102
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = call i32 @SUNNonlinSolFree(ptr noundef %141)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

143:                                              ; preds = %102
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %144, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %145

145:                                              ; preds = %143, %140, %99, %46, %40, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %146 = load ptr, ptr %3, align 8
  ret ptr %146
}

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

declare ptr @SUNNonlinSolNewEmpty(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetType_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolInitialize_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSolve_Newton(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolFree_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetSysFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetLSetupFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetLSolveFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetConvTestFn_Newton(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetMaxIters_Newton(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetNumIters_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetCurIter_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetNumConvFails_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare i32 @SUNNonlinSolFree(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare ptr @N_VClone(ptr noundef) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 8}
!10 = !{!"_generic_N_Vector", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!12, !6, i64 8}
!12 = !{!"_generic_N_Vector_Ops", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432}
!13 = !{!12, !6, i64 24}
!14 = !{!12, !6, i64 112}
!15 = !{!12, !6, i64 80}
!16 = !{!17, !6, i64 8}
!17 = !{!"_generic_SUNNonlinearSolver", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!19, !6, i64 0}
!19 = !{!"_generic_SUNNonlinearSolver_Ops", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!20 = !{!19, !6, i64 8}
!21 = !{!19, !6, i64 24}
!22 = !{!19, !6, i64 32}
!23 = !{!19, !6, i64 40}
!24 = !{!19, !6, i64 48}
!25 = !{!19, !6, i64 56}
!26 = !{!19, !6, i64 64}
!27 = !{!19, !6, i64 72}
!28 = !{!19, !6, i64 80}
!29 = !{!19, !6, i64 88}
!30 = !{!19, !6, i64 96}
!31 = !{!17, !6, i64 0}
!32 = !{!33, !6, i64 0}
!33 = !{!"_SUNNonlinearSolverContent_Newton", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !34, i64 40, !34, i64 44, !34, i64 48, !35, i64 56, !35, i64 64, !6, i64 72, !34, i64 80, !6, i64 88}
!34 = !{!"int", !7, i64 0}
!35 = !{!"long", !7, i64 0}
!36 = !{!33, !6, i64 8}
!37 = !{!33, !6, i64 16}
!38 = !{!33, !6, i64 24}
!39 = !{!33, !34, i64 40}
!40 = !{!33, !34, i64 44}
!41 = !{!33, !34, i64 48}
!42 = !{!33, !35, i64 56}
!43 = !{!33, !35, i64 64}
!44 = !{!33, !6, i64 72}
!45 = !{!33, !34, i64 80}
!46 = !{!33, !6, i64 88}
!47 = !{!33, !6, i64 32}


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

@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @SUNNonlinSol_Newton(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  br i1 %3, label %48, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !10
  %9 = icmp eq ptr %8, null
  br i1 %9, label %48, label %10

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %6, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = icmp eq ptr %12, null
  br i1 %13, label %48, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %6, i64 112
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = icmp eq ptr %16, null
  br i1 %17, label %48, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %6, i64 80
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = icmp eq ptr %20, null
  br i1 %21, label %48, label %22

22:                                               ; preds = %18
  %23 = tail call ptr @SUNNonlinSolNewEmpty(ptr noundef %1) #3
  %24 = icmp eq ptr %23, null
  br i1 %24, label %48, label %25

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %23, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  store ptr @SUNNonlinSolGetType_Newton, ptr %27, align 8, !tbaa !17
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr @SUNNonlinSolInitialize_Newton, ptr %28, align 8, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %27, i64 24
  store ptr @SUNNonlinSolSolve_Newton, ptr %29, align 8, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %27, i64 32
  store ptr @SUNNonlinSolFree_Newton, ptr %30, align 8, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %27, i64 40
  store ptr @SUNNonlinSolSetSysFn_Newton, ptr %31, align 8, !tbaa !22
  %32 = getelementptr inbounds i8, ptr %27, i64 48
  store ptr @SUNNonlinSolSetLSetupFn_Newton, ptr %32, align 8, !tbaa !23
  %33 = getelementptr inbounds i8, ptr %27, i64 56
  store ptr @SUNNonlinSolSetLSolveFn_Newton, ptr %33, align 8, !tbaa !24
  %34 = getelementptr inbounds i8, ptr %27, i64 64
  store ptr @SUNNonlinSolSetConvTestFn_Newton, ptr %34, align 8, !tbaa !25
  %35 = getelementptr inbounds i8, ptr %27, i64 72
  store ptr @SUNNonlinSolSetMaxIters_Newton, ptr %35, align 8, !tbaa !26
  %36 = getelementptr inbounds i8, ptr %27, i64 80
  store ptr @SUNNonlinSolGetNumIters_Newton, ptr %36, align 8, !tbaa !27
  %37 = getelementptr inbounds i8, ptr %27, i64 88
  store ptr @SUNNonlinSolGetCurIter_Newton, ptr %37, align 8, !tbaa !28
  %38 = getelementptr inbounds i8, ptr %27, i64 96
  store ptr @SUNNonlinSolGetNumConvFails_Newton, ptr %38, align 8, !tbaa !29
  %calloc = tail call dereferenceable_or_null(96) ptr @calloc(i64 1, i64 96)
  %39 = icmp eq ptr %calloc, null
  br i1 %39, label %.sink.split, label %40

40:                                               ; preds = %25
  store ptr %calloc, ptr %23, align 8, !tbaa !30
  %41 = getelementptr inbounds i8, ptr %calloc, i64 48
  store i32 3, ptr %41, align 8, !tbaa !31
  %42 = load ptr, ptr @stdout, align 8, !tbaa !35
  %43 = getelementptr inbounds i8, ptr %calloc, i64 88
  store ptr %42, ptr %43, align 8, !tbaa !36
  %44 = tail call ptr @N_VClone(ptr noundef nonnull %0) #3
  %45 = getelementptr inbounds i8, ptr %calloc, i64 32
  store ptr %44, ptr %45, align 8, !tbaa !37
  %46 = icmp eq ptr %44, null
  br i1 %46, label %.sink.split, label %48

.sink.split:                                      ; preds = %40, %25
  %47 = tail call i32 @SUNNonlinSolFree(ptr noundef nonnull %23) #3
  br label %48

48:                                               ; preds = %.sink.split, %40, %22, %4, %10, %14, %18, %2
  %.0 = phi ptr [ null, %2 ], [ null, %18 ], [ null, %14 ], [ null, %10 ], [ null, %4 ], [ null, %22 ], [ %23, %40 ], [ null, %.sink.split ]
  ret ptr %.0
}

declare ptr @SUNNonlinSolNewEmpty(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetType_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolInitialize_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSolve_Newton(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolFree_Newton(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetSysFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetLSetupFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetLSolveFn_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetConvTestFn_Newton(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolSetMaxIters_Newton(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetNumIters_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetCurIter_Newton(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNNonlinSolGetNumConvFails_Newton(ptr noundef, ptr noundef) #0

declare i32 @SUNNonlinSolFree(ptr noundef) local_unnamed_addr #1

declare ptr @N_VClone(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { "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 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
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, !7, i64 8}
!6 = !{!"_generic_N_Vector", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 8}
!11 = !{!"_generic_N_Vector_Ops", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432}
!12 = !{!11, !7, i64 24}
!13 = !{!11, !7, i64 112}
!14 = !{!11, !7, i64 80}
!15 = !{!16, !7, i64 8}
!16 = !{!"_generic_SUNNonlinearSolver", !7, i64 0, !7, i64 8, !7, i64 16}
!17 = !{!18, !7, i64 0}
!18 = !{!"_generic_SUNNonlinearSolver_Ops", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96}
!19 = !{!18, !7, i64 8}
!20 = !{!18, !7, i64 24}
!21 = !{!18, !7, i64 32}
!22 = !{!18, !7, i64 40}
!23 = !{!18, !7, i64 48}
!24 = !{!18, !7, i64 56}
!25 = !{!18, !7, i64 64}
!26 = !{!18, !7, i64 72}
!27 = !{!18, !7, i64 80}
!28 = !{!18, !7, i64 88}
!29 = !{!18, !7, i64 96}
!30 = !{!16, !7, i64 0}
!31 = !{!32, !33, i64 48}
!32 = !{!"_SUNNonlinearSolverContent_Newton", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !33, i64 40, !33, i64 44, !33, i64 48, !34, i64 56, !34, i64 64, !7, i64 72, !33, i64 80, !7, i64 88}
!33 = !{!"int", !8, i64 0}
!34 = !{!"long", !8, i64 0}
!35 = !{!7, !7, i64 0}
!36 = !{!32, !7, i64 88}
!37 = !{!32, !7, i64 32}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass