; LLVM IR from simbody/simbody :: SimTKmath/Integrators/src/CPodes/sundials/tests (cpsPend_dns)

; 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 }
%struct._N_VectorContent_Serial = type { i64, i32, ptr }

@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store double 3.000000e+01, ptr %6, align 8, !tbaa !5
  %9 = call ptr @N_VNew_Serial(i64 noundef 4)
  store ptr %9, ptr %3, align 8, !tbaa !9
  %10 = load double, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !9
  call void @RefSol(double noundef %10, ptr noundef %11)
  store double 1.000000e-05, ptr %5, align 8, !tbaa !5
  %12 = call ptr @CPodeCreate(i32 noundef 1, i32 noundef 2, i32 noundef 2)
  store ptr %12, ptr %2, align 8, !tbaa !9
  %13 = call ptr @N_VNew_Serial(i64 noundef 4)
  store ptr %13, ptr %4, align 8, !tbaa !9
  %14 = load ptr, ptr %4, align 8, !tbaa !9
  %15 = getelementptr inbounds %struct._generic_N_Vector, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct._N_VectorContent_Serial, ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = getelementptr inbounds double, ptr %18, i64 0
  store double 1.000000e+00, ptr %19, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct._generic_N_Vector, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = getelementptr inbounds %struct._N_VectorContent_Serial, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = getelementptr inbounds double, ptr %24, i64 1
  store double 0.000000e+00, ptr %25, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct._generic_N_Vector, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct._N_VectorContent_Serial, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = getelementptr inbounds double, ptr %30, i64 2
  store double 0.000000e+00, ptr %31, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct._generic_N_Vector, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct._N_VectorContent_Serial, ptr %34, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = getelementptr inbounds double, ptr %36, i64 3
  store double 0.000000e+00, ptr %37, align 8, !tbaa !5
  %38 = load ptr, ptr %2, align 8, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !9
  %40 = load double, ptr %5, align 8, !tbaa !5
  %41 = call i32 @CPodeInit(ptr noundef %38, ptr noundef @f, ptr noundef null, double noundef 0.000000e+00, ptr noundef %39, ptr noundef null, i32 noundef 1, double noundef %40, ptr noundef %5)
  store i32 %41, ptr %8, align 4, !tbaa !17
  %42 = load ptr, ptr %2, align 8, !tbaa !9
  %43 = call i32 @CPodeSetMaxNumSteps(ptr noundef %42, i64 noundef 50000)
  store i32 %43, ptr %8, align 4, !tbaa !17
  %44 = load ptr, ptr %2, align 8, !tbaa !9
  %45 = load double, ptr %6, align 8, !tbaa !5
  %46 = call i32 @CPodeSetStopTime(ptr noundef %44, double noundef %45)
  store i32 %46, ptr %8, align 4, !tbaa !17
  %47 = load ptr, ptr %2, align 8, !tbaa !9
  %48 = call i32 @CPodeProjDefine(ptr noundef %47, ptr noundef @proj, ptr noundef null)
  store i32 %48, ptr %8, align 4, !tbaa !17
  %49 = load ptr, ptr %2, align 8, !tbaa !9
  %50 = call i32 @CPDense(ptr noundef %49, i32 noundef 4)
  store i32 %50, ptr %8, align 4, !tbaa !17
  store i32 0, ptr %7, align 4, !tbaa !17
  br label %51

51:                                               ; preds = %69, %0
  %52 = load i32, ptr %7, align 4, !tbaa !17
  %53 = icmp slt i32 %52, 5
  br i1 %53, label %54, label %72

54:                                               ; preds = %51
  %55 = load double, ptr %5, align 8, !tbaa !5
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %55)
  %57 = load ptr, ptr %2, align 8, !tbaa !9
  %58 = load ptr, ptr %4, align 8, !tbaa !9
  %59 = load double, ptr %5, align 8, !tbaa !5
  %60 = load double, ptr %6, align 8, !tbaa !5
  %61 = load ptr, ptr %3, align 8, !tbaa !9
  call void @GetSol(ptr noundef %57, ptr noundef %58, double noundef %59, double noundef %60, i32 noundef 1, ptr noundef %61)
  %62 = load ptr, ptr %2, align 8, !tbaa !9
  %63 = load ptr, ptr %4, align 8, !tbaa !9
  %64 = load double, ptr %5, align 8, !tbaa !5
  %65 = load double, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %3, align 8, !tbaa !9
  call void @GetSol(ptr noundef %62, ptr noundef %63, double noundef %64, double noundef %65, i32 noundef 0, ptr noundef %66)
  %67 = load double, ptr %5, align 8, !tbaa !5
  %68 = fdiv double %67, 1.000000e+01
  store double %68, ptr %5, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %54
  %70 = load i32, ptr %7, align 4, !tbaa !17
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %7, align 4, !tbaa !17
  br label %51, !llvm.loop !18

72:                                               ; preds = %51
  %73 = load ptr, ptr %3, align 8, !tbaa !9
  call void @N_VDestroy_Serial(ptr noundef %73)
  call void @CPodeFree(ptr noundef %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  ret i32 0
}

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

declare ptr @N_VNew_Serial(i64 noundef) #2

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

declare ptr @CPodeCreate(i32 noundef, i32 noundef, i32 noundef) #2

declare i32 @CPodeInit(ptr noundef, ptr noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, i32 noundef, double noundef, ptr noundef) #2

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

declare i32 @CPodeSetMaxNumSteps(ptr noundef, i64 noundef) #2

declare i32 @CPodeSetStopTime(ptr noundef, double noundef) #2

declare i32 @CPodeProjDefine(ptr noundef, ptr noundef, ptr noundef) #2

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

declare i32 @CPDense(ptr noundef, i32 noundef) #2

declare i32 @printf(ptr noundef, ...) #2

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

declare void @N_VDestroy_Serial(ptr noundef) #2

declare void @CPodeFree(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 }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_generic_N_Vector", !10, i64 0, !10, i64 8}
!13 = !{!14, !10, i64 16}
!14 = !{!"_N_VectorContent_Serial", !15, i64 0, !16, i64 8, !10, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!16, !16, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %3 = tail call ptr @N_VNew_Serial(i64 noundef 4) #5
  tail call void @RefSol(double noundef 3.000000e+01, ptr noundef %3)
  store double 1.000000e-05, ptr %2, align 8, !tbaa !5
  %4 = tail call ptr @CPodeCreate(i32 noundef 1, i32 noundef 2, i32 noundef 2) #5
  store ptr %4, ptr %1, align 8, !tbaa !9
  %5 = tail call ptr @N_VNew_Serial(i64 noundef 4) #5
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  store double 1.000000e+00, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  %10 = call i32 @CPodeInit(ptr noundef %4, ptr noundef nonnull @f, ptr noundef null, double noundef 0.000000e+00, ptr noundef nonnull %5, ptr noundef null, i32 noundef 1, double noundef 1.000000e-05, ptr noundef nonnull %2) #5
  %11 = call i32 @CPodeSetMaxNumSteps(ptr noundef %4, i64 noundef 50000) #5
  %12 = call i32 @CPodeSetStopTime(ptr noundef %4, double noundef 3.000000e+01) #5
  %13 = call i32 @CPodeProjDefine(ptr noundef %4, ptr noundef nonnull @proj, ptr noundef null) #5
  %14 = call i32 @CPDense(ptr noundef %4, i32 noundef 4) #5
  %15 = load double, ptr %2, align 8, !tbaa !5
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %15)
  %17 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %17, double noundef 3.000000e+01, i32 noundef 1, ptr noundef %3)
  %18 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %18, double noundef 3.000000e+01, i32 noundef 0, ptr noundef %3)
  %19 = load double, ptr %2, align 8, !tbaa !5
  %20 = fdiv double %19, 1.000000e+01
  store double %20, ptr %2, align 8, !tbaa !5
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %20)
  %22 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %22, double noundef 3.000000e+01, i32 noundef 1, ptr noundef %3)
  %23 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %23, double noundef 3.000000e+01, i32 noundef 0, ptr noundef %3)
  %24 = load double, ptr %2, align 8, !tbaa !5
  %25 = fdiv double %24, 1.000000e+01
  store double %25, ptr %2, align 8, !tbaa !5
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %25)
  %27 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %27, double noundef 3.000000e+01, i32 noundef 1, ptr noundef %3)
  %28 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %28, double noundef 3.000000e+01, i32 noundef 0, ptr noundef %3)
  %29 = load double, ptr %2, align 8, !tbaa !5
  %30 = fdiv double %29, 1.000000e+01
  store double %30, ptr %2, align 8, !tbaa !5
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %30)
  %32 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %32, double noundef 3.000000e+01, i32 noundef 1, ptr noundef %3)
  %33 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %33, double noundef 3.000000e+01, i32 noundef 0, ptr noundef %3)
  %34 = load double, ptr %2, align 8, !tbaa !5
  %35 = fdiv double %34, 1.000000e+01
  store double %35, ptr %2, align 8, !tbaa !5
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %35)
  %37 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %37, double noundef 3.000000e+01, i32 noundef 1, ptr noundef %3)
  %38 = load double, ptr %2, align 8, !tbaa !5
  call void @GetSol(ptr noundef %4, ptr noundef nonnull %5, double noundef %38, double noundef 3.000000e+01, i32 noundef 0, ptr noundef %3)
  %39 = load double, ptr %2, align 8, !tbaa !5
  %40 = fdiv double %39, 1.000000e+01
  store double %40, ptr %2, align 8, !tbaa !5
  call void @N_VDestroy_Serial(ptr noundef %3) #5
  call void @CPodeFree(ptr noundef nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0
}

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

declare ptr @N_VNew_Serial(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @RefSol(double noundef, ptr noundef) local_unnamed_addr #0

declare ptr @CPodeCreate(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @CPodeInit(ptr noundef, ptr noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, i32 noundef, double noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @CPodeSetMaxNumSteps(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @CPodeSetStopTime(ptr noundef, double noundef) local_unnamed_addr #2

declare i32 @CPodeProjDefine(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @CPDense(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

declare void @N_VDestroy_Serial(ptr noundef) local_unnamed_addr #2

declare void @CPodeFree(ptr noundef) local_unnamed_addr #2

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

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

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 = { mustprogress 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 = { nofree 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_generic_N_Vector", !10, i64 0, !10, i64 8}
!13 = !{!14, !10, i64 16}
!14 = !{!"_N_VectorContent_Serial", !15, i64 0, !16, i64 8, !10, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass