; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/VNL/src/vxl/v3p/netlib/sparse (spBuild)

; 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.spTemplate = type { ptr, ptr, ptr, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @spGetOnes(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = load i32, ptr %9, align 4, !tbaa !9
  %14 = load i32, ptr %10, align 4, !tbaa !9
  %15 = call ptr @spGetElement(ptr noundef %12, i32 noundef %13, i32 noundef %14)
  %16 = load ptr, ptr %11, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.spTemplate, ptr %16, i32 0, i32 3
  store ptr %15, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = call ptr @spGetElement(ptr noundef %18, i32 noundef %19, i32 noundef %20)
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.spTemplate, ptr %22, i32 0, i32 2
  store ptr %21, ptr %23, align 8, !tbaa !13
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = call ptr @spGetElement(ptr noundef %24, i32 noundef %25, i32 noundef %26)
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.spTemplate, ptr %28, i32 0, i32 1
  store ptr %27, ptr %29, align 8, !tbaa !14
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = call ptr @spGetElement(ptr noundef %30, i32 noundef %31, i32 noundef %32)
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.spTemplate, ptr %34, i32 0, i32 0
  store ptr %33, ptr %35, align 8, !tbaa !15
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.spTemplate, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = icmp eq ptr %38, null
  br i1 %39, label %55, label %40

40:                                               ; preds = %5
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.spTemplate, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = icmp eq ptr %43, null
  br i1 %44, label %55, label %45

45:                                               ; preds = %40
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.spTemplate, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = icmp eq ptr %48, null
  br i1 %49, label %55, label %50

50:                                               ; preds = %45
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.spTemplate, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %56

55:                                               ; preds = %50, %45, %40, %5
  store i32 5, ptr %6, align 4
  br label %77

56:                                               ; preds = %50
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.spTemplate, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  %60 = load double, ptr %59, align 8, !tbaa !16
  %61 = fadd double %60, 1.000000e+00
  store double %61, ptr %59, align 8, !tbaa !16
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.spTemplate, ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = load double, ptr %64, align 8, !tbaa !16
  %66 = fadd double %65, 1.000000e+00
  store double %66, ptr %64, align 8, !tbaa !16
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.spTemplate, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = load double, ptr %69, align 8, !tbaa !16
  %71 = fsub double %70, 1.000000e+00
  store double %71, ptr %69, align 8, !tbaa !16
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.spTemplate, ptr %72, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = load double, ptr %74, align 8, !tbaa !16
  %76 = fsub double %75, 1.000000e+00
  store double %76, ptr %74, align 8, !tbaa !16
  store i32 0, ptr %6, align 4
  br label %77

77:                                               ; preds = %56, %55
  %78 = load i32, ptr %6, align 4
  ret i32 %78
}

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

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"spTemplate", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!12, !6, i64 16}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !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: nounwind uwtable
declare dso_local ptr @spGetElement(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 6) i32 @spGetOnes(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr nocapture noundef %4) local_unnamed_addr #0 {
  %6 = tail call ptr @spGetElement(ptr noundef %0, i32 noundef %2, i32 noundef %3)
  %7 = getelementptr inbounds i8, ptr %4, i64 24
  store ptr %6, ptr %7, align 8, !tbaa !5
  %8 = tail call ptr @spGetElement(ptr noundef %0, i32 noundef %3, i32 noundef %2)
  %9 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %8, ptr %9, align 8, !tbaa !10
  %10 = tail call ptr @spGetElement(ptr noundef %0, i32 noundef %1, i32 noundef %3)
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %10, ptr %11, align 8, !tbaa !11
  %12 = tail call ptr @spGetElement(ptr noundef %0, i32 noundef %3, i32 noundef %1)
  store ptr %12, ptr %4, align 8, !tbaa !12
  %13 = icmp eq ptr %12, null
  br i1 %13, label %32, label %14

14:                                               ; preds = %5
  %15 = load ptr, ptr %11, align 8, !tbaa !11
  %16 = icmp eq ptr %15, null
  br i1 %16, label %32, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %9, align 8, !tbaa !10
  %19 = icmp eq ptr %18, null
  br i1 %19, label %32, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %32, label %23

23:                                               ; preds = %20
  %24 = load double, ptr %12, align 8, !tbaa !13
  %25 = fadd double %24, 1.000000e+00
  store double %25, ptr %12, align 8, !tbaa !13
  %26 = load double, ptr %15, align 8, !tbaa !13
  %27 = fadd double %26, 1.000000e+00
  store double %27, ptr %15, align 8, !tbaa !13
  %28 = load double, ptr %18, align 8, !tbaa !13
  %29 = fadd double %28, -1.000000e+00
  store double %29, ptr %18, align 8, !tbaa !13
  %30 = load double, ptr %21, align 8, !tbaa !13
  %31 = fadd double %30, -1.000000e+00
  store double %31, ptr %21, align 8, !tbaa !13
  br label %32

32:                                               ; preds = %5, %14, %17, %20, %23
  %.0 = phi i32 [ 0, %23 ], [ 5, %20 ], [ 5, %17 ], [ 5, %14 ], [ 5, %5 ]
  ret i32 %.0
}

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

!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 24}
!6 = !{!"spTemplate", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 16}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass