; LLVM IR from sympiler/nasoq :: src/QP (qp_utils)

; 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.nasoq::sympiler_CSC" = type { i64, i64, i64, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32 }

@__const._ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_.alp = external hidden unnamed_addr constant [2 x double], align 16

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

declare void @_ZN5nasoq20spmv_csc_sym_one_intEiPiS0_PdiS1_S1_iS1_S1_(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #6

declare noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

declare noundef double @_ZN5nasoq10norm_denseEiiPdi(i32 noundef, i32 noundef, ptr noundef, i32 noundef) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #7 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca [2 x double], align 16
  %21 = alloca [2 x double], align 16
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  store ptr %8, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  store double 0.000000e+00, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 @__const._ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_.alp, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #8
  call void @llvm.memset.p0.i64(ptr align 16 %21, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %30, i32 0, i32 1
  %32 = load i64, ptr %31, align 8, !tbaa !11
  %33 = mul i64 4, %32
  %34 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %33, i64 8)
  %35 = extractvalue { i64, i1 } %34, 1
  %36 = extractvalue { i64, i1 } %34, 0
  %37 = select i1 %35, i64 -1, i64 %36
  %38 = call noalias noundef nonnull ptr @_Znam(i64 noundef %37) #9
  call void @llvm.memset.p0.i64(ptr align 8 %38, i8 0, i64 %37, i1 false)
  store ptr %38, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %39 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %39, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %40 = load ptr, ptr %22, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds double, ptr %40, i64 %43
  store ptr %44, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %45 = load ptr, ptr %22, align 8, !tbaa !5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = mul i64 2, %48
  %50 = getelementptr inbounds double, ptr %45, i64 %49
  store ptr %50, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %51 = load ptr, ptr %22, align 8, !tbaa !5
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %52, i32 0, i32 1
  %54 = load i64, ptr %53, align 8, !tbaa !11
  %55 = mul i64 3, %54
  %56 = getelementptr inbounds double, ptr %51, i64 %55
  store ptr %56, ptr %26, align 8, !tbaa !5
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %57, i32 0, i32 1
  %59 = load i64, ptr %58, align 8, !tbaa !11
  %60 = trunc i64 %59 to i32
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %61, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !15
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %64, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %67, i32 0, i32 6
  %69 = load ptr, ptr %68, align 8, !tbaa !17
  %70 = getelementptr inbounds [2 x double], ptr %20, i64 0, i64 0
  %71 = getelementptr inbounds [2 x double], ptr %21, i64 0, i64 0
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = load ptr, ptr %23, align 8, !tbaa !5
  call void @_ZN5nasoq20spmv_csc_sym_one_intEiPiS0_PdiS1_S1_iS1_S1_(i32 noundef %60, ptr noundef %63, ptr noundef %66, ptr noundef %69, i32 noundef -1, ptr noundef %70, ptr noundef %71, i32 noundef 1, ptr noundef %72, ptr noundef %73)
  %74 = load ptr, ptr %13, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %74, i32 0, i32 0
  %76 = load i64, ptr %75, align 8, !tbaa !18
  %77 = icmp ugt i64 %76, 0
  br i1 %77, label %78, label %99

78:                                               ; preds = %9
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %79, i32 0, i32 0
  %81 = load i64, ptr %80, align 8, !tbaa !18
  %82 = trunc i64 %81 to i32
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %83, i32 0, i32 1
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = trunc i64 %85 to i32
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %87, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !15
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %90, i32 0, i32 4
  %92 = load ptr, ptr %91, align 8, !tbaa !16
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %93, i32 0, i32 6
  %95 = load ptr, ptr %94, align 8, !tbaa !17
  %96 = load ptr, ptr %18, align 8, !tbaa !5
  %97 = load ptr, ptr %24, align 8, !tbaa !5
  %98 = call noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef %82, i32 noundef %86, ptr noundef %89, ptr noundef %92, ptr noundef %95, ptr noundef %96, ptr noundef %97)
  br label %117

99:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  store i32 0, ptr %27, align 4, !tbaa !19
  br label %100

100:                                              ; preds = %113, %99
  %101 = load i32, ptr %27, align 4, !tbaa !19
  %102 = sext i32 %101 to i64
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %103, i32 0, i32 1
  %105 = load i64, ptr %104, align 8, !tbaa !11
  %106 = icmp ult i64 %102, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %116

108:                                              ; preds = %100
  %109 = load ptr, ptr %24, align 8, !tbaa !5
  %110 = load i32, ptr %27, align 4, !tbaa !19
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds double, ptr %109, i64 %111
  store double 0.000000e+00, ptr %112, align 8, !tbaa !9
  br label %113

113:                                              ; preds = %108
  %114 = load i32, ptr %27, align 4, !tbaa !19
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %27, align 4, !tbaa !19
  br label %100, !llvm.loop !20

116:                                              ; preds = %107
  br label %117

117:                                              ; preds = %116, %78
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %118, i32 0, i32 0
  %120 = load i64, ptr %119, align 8, !tbaa !18
  %121 = icmp ugt i64 %120, 0
  br i1 %121, label %122, label %143

122:                                              ; preds = %117
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %123, i32 0, i32 0
  %125 = load i64, ptr %124, align 8, !tbaa !18
  %126 = trunc i64 %125 to i32
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %127, i32 0, i32 1
  %129 = load i64, ptr %128, align 8, !tbaa !11
  %130 = trunc i64 %129 to i32
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %131, i32 0, i32 3
  %133 = load ptr, ptr %132, align 8, !tbaa !15
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %134, i32 0, i32 4
  %136 = load ptr, ptr %135, align 8, !tbaa !16
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  %138 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %137, i32 0, i32 6
  %139 = load ptr, ptr %138, align 8, !tbaa !17
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = load ptr, ptr %25, align 8, !tbaa !5
  %142 = call noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef %126, i32 noundef %130, ptr noundef %133, ptr noundef %136, ptr noundef %139, ptr noundef %140, ptr noundef %141)
  br label %161

143:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  store i32 0, ptr %28, align 4, !tbaa !19
  br label %144

144:                                              ; preds = %157, %143
  %145 = load i32, ptr %28, align 4, !tbaa !19
  %146 = sext i32 %145 to i64
  %147 = load ptr, ptr %10, align 8, !tbaa !5
  %148 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %147, i32 0, i32 1
  %149 = load i64, ptr %148, align 8, !tbaa !11
  %150 = icmp ult i64 %146, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %160

152:                                              ; preds = %144
  %153 = load ptr, ptr %25, align 8, !tbaa !5
  %154 = load i32, ptr %28, align 4, !tbaa !19
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds double, ptr %153, i64 %155
  store double 0.000000e+00, ptr %156, align 8, !tbaa !9
  br label %157

157:                                              ; preds = %152
  %158 = load i32, ptr %28, align 4, !tbaa !19
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %28, align 4, !tbaa !19
  br label %144, !llvm.loop !22

160:                                              ; preds = %151
  br label %161

161:                                              ; preds = %160, %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  store i32 0, ptr %29, align 4, !tbaa !19
  br label %162

162:                                              ; preds = %198, %161
  %163 = load i32, ptr %29, align 4, !tbaa !19
  %164 = sext i32 %163 to i64
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %165, i32 0, i32 1
  %167 = load i64, ptr %166, align 8, !tbaa !11
  %168 = icmp ult i64 %164, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %162
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  br label %201

170:                                              ; preds = %162
  %171 = load ptr, ptr %23, align 8, !tbaa !5
  %172 = load i32, ptr %29, align 4, !tbaa !19
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds double, ptr %171, i64 %173
  %175 = load double, ptr %174, align 8, !tbaa !9
  %176 = load ptr, ptr %15, align 8, !tbaa !5
  %177 = load i32, ptr %29, align 4, !tbaa !19
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds double, ptr %176, i64 %178
  %180 = load double, ptr %179, align 8, !tbaa !9
  %181 = fadd double %175, %180
  %182 = load ptr, ptr %25, align 8, !tbaa !5
  %183 = load i32, ptr %29, align 4, !tbaa !19
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds double, ptr %182, i64 %184
  %186 = load double, ptr %185, align 8, !tbaa !9
  %187 = fadd double %181, %186
  %188 = load ptr, ptr %24, align 8, !tbaa !5
  %189 = load i32, ptr %29, align 4, !tbaa !19
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds double, ptr %188, i64 %190
  %192 = load double, ptr %191, align 8, !tbaa !9
  %193 = fadd double %187, %192
  %194 = load ptr, ptr %26, align 8, !tbaa !5
  %195 = load i32, ptr %29, align 4, !tbaa !19
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds double, ptr %194, i64 %196
  store double %193, ptr %197, align 8, !tbaa !9
  br label %198

198:                                              ; preds = %170
  %199 = load i32, ptr %29, align 4, !tbaa !19
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %29, align 4, !tbaa !19
  br label %162, !llvm.loop !23

201:                                              ; preds = %169
  %202 = load ptr, ptr %10, align 8, !tbaa !5
  %203 = getelementptr inbounds %"struct.nasoq::sympiler_CSC", ptr %202, i32 0, i32 1
  %204 = load i64, ptr %203, align 8, !tbaa !11
  %205 = trunc i64 %204 to i32
  %206 = load ptr, ptr %26, align 8, !tbaa !5
  %207 = call noundef double @_ZN5nasoq10norm_denseEiiPdi(i32 noundef %205, i32 noundef 1, ptr noundef %206, i32 noundef 0)
  store double %207, ptr %19, align 8, !tbaa !9
  %208 = load ptr, ptr %22, align 8, !tbaa !5
  %209 = icmp eq ptr %208, null
  br i1 %209, label %211, label %210

210:                                              ; preds = %201
  call void @_ZdaPv(ptr noundef %208) #10
  br label %211

211:                                              ; preds = %210, %201
  %212 = load double, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  ret double %212
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN5nasoq12sympiler_CSCE", !13, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !14, i64 64, !14, i64 68, !14, i64 72, !14, i64 76, !14, i64 80, !14, i64 84}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !6, i64 24}
!16 = !{!12, !6, i64 32}
!17 = !{!12, !6, i64 48}
!18 = !{!12, !13, i64 0}
!19 = !{!14, !14, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


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

@__const._ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_.alp = external hidden unnamed_addr constant [2 x double], align 16

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

declare void @_ZN5nasoq20spmv_csc_sym_one_intEiPiS0_PdiS1_S1_iS1_S1_(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare noundef double @_ZN5nasoq10norm_denseEiiPdi(i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) local_unnamed_addr #6 {
  %10 = alloca [2 x double], align 16
  %11 = alloca [2 x double], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull align 16 dereferenceable(16) @__const._ZN5nasoq24lagrangian_residual_normEPNS_12sympiler_CSCES1_S1_S1_S1_PdS2_S2_S2_.alp, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %11, i8 0, i64 16, i1 false)
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %14 = and i64 %13, 4035225266123964416
  %.not = icmp eq i64 %14, 0
  %15 = shl i64 %13, 5
  %16 = select i1 %.not, i64 %15, i64 -1
  %17 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %16) #8
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %17, i8 0, i64 %16, i1 false)
  %18 = getelementptr double, ptr %17, i64 %13
  %.idx = shl i64 %13, 4
  %19 = getelementptr i8, ptr %17, i64 %.idx
  %.idx62 = mul i64 %13, 24
  %20 = getelementptr inbounds i8, ptr %17, i64 %.idx62
  %21 = trunc i64 %13 to i32
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %0, i64 48
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  call void @_ZN5nasoq20spmv_csc_sym_one_intEiPiS0_PdiS1_S1_iS1_S1_(i32 noundef %21, ptr noundef %23, ptr noundef %25, ptr noundef %27, i32 noundef -1, ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 1, ptr noundef %6, ptr noundef nonnull %17)
  %28 = load i64, ptr %3, align 8, !tbaa !15
  %.not63 = icmp eq i64 %28, 0
  br i1 %.not63, label %.preheader65, label %31

.preheader65:                                     ; preds = %9
  %29 = load i64, ptr %12, align 8, !tbaa !5
  %.not72 = icmp eq i64 %29, 0
  br i1 %.not72, label %.loopexit66, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader65
  %30 = shl nuw i64 %29, 3
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 %30, i1 false), !tbaa !16
  br label %.loopexit66

31:                                               ; preds = %9
  %32 = load i64, ptr %4, align 8, !tbaa !15
  %33 = trunc i64 %32 to i32
  %34 = getelementptr inbounds i8, ptr %4, i64 8
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = trunc i64 %35 to i32
  %37 = getelementptr inbounds i8, ptr %4, i64 24
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  %39 = getelementptr inbounds i8, ptr %4, i64 32
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = getelementptr inbounds i8, ptr %4, i64 48
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = call noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef %33, i32 noundef %36, ptr noundef %38, ptr noundef %40, ptr noundef %42, ptr noundef %8, ptr noundef nonnull %18)
  br label %.loopexit66

.loopexit66:                                      ; preds = %.lr.ph.preheader, %.preheader65, %31
  %44 = load i64, ptr %1, align 8, !tbaa !15
  %.not64 = icmp eq i64 %44, 0
  br i1 %.not64, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.loopexit66
  %45 = load i64, ptr %12, align 8, !tbaa !5
  %.not73 = icmp eq i64 %45, 0
  br i1 %.not73, label %._crit_edge, label %.loopexit.thread79

.loopexit.thread79:                               ; preds = %.preheader
  %46 = shl nuw i64 %45, 3
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 %46, i1 false), !tbaa !16
  br label %.lr.ph71.preheader

.loopexit:                                        ; preds = %.loopexit66
  %47 = load i64, ptr %2, align 8, !tbaa !15
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds i8, ptr %2, i64 8
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = trunc i64 %50 to i32
  %52 = getelementptr inbounds i8, ptr %2, i64 24
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  %54 = getelementptr inbounds i8, ptr %2, i64 32
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = getelementptr inbounds i8, ptr %2, i64 48
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = call noundef i32 @_ZN5nasoq14spmv_csc_smallEiiPiS0_PdS1_S1_(i32 noundef %48, i32 noundef %51, ptr noundef %53, ptr noundef %55, ptr noundef %57, ptr noundef %7, ptr noundef nonnull %19)
  %.pre = load i64, ptr %12, align 8, !tbaa !5
  %.not74 = icmp eq i64 %.pre, 0
  br i1 %.not74, label %._crit_edge, label %.lr.ph71.preheader

.lr.ph71.preheader:                               ; preds = %.loopexit.thread79, %.loopexit
  %59 = phi i64 [ %45, %.loopexit.thread79 ], [ %.pre, %.loopexit ]
  %min.iters.check = icmp ult i64 %59, 6
  br i1 %min.iters.check, label %.lr.ph71.preheader91, label %vector.memcheck

.lr.ph71.preheader91:                             ; preds = %middle.block, %vector.memcheck, %.lr.ph71.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph71.preheader ], [ %n.vec, %middle.block ]
  %.neg = or disjoint i64 %indvars.iv.ph, 1
  %xtraiter = and i64 %59, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph71.prol.loopexit, label %.lr.ph71.prol

.lr.ph71.prol:                                    ; preds = %.lr.ph71.preheader91
  %60 = getelementptr inbounds double, ptr %17, i64 %indvars.iv.ph
  %61 = load double, ptr %60, align 8, !tbaa !16
  %62 = getelementptr inbounds double, ptr %5, i64 %indvars.iv.ph
  %63 = load double, ptr %62, align 8, !tbaa !16
  %64 = fadd double %61, %63
  %65 = getelementptr inbounds double, ptr %19, i64 %indvars.iv.ph
  %66 = load double, ptr %65, align 8, !tbaa !16
  %67 = fadd double %64, %66
  %68 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.ph
  %69 = load double, ptr %68, align 8, !tbaa !16
  %70 = fadd double %67, %69
  %71 = getelementptr inbounds double, ptr %20, i64 %indvars.iv.ph
  store double %70, ptr %71, align 8, !tbaa !16
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph71.prol.loopexit

.lr.ph71.prol.loopexit:                           ; preds = %.lr.ph71.prol, %.lr.ph71.preheader91
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph71.preheader91 ], [ %indvars.iv.next.prol, %.lr.ph71.prol ]
  %72 = icmp eq i64 %59, %.neg
  br i1 %72, label %._crit_edge.loopexit, label %.lr.ph71

vector.memcheck:                                  ; preds = %.lr.ph71.preheader
  %diff.check = icmp ult i64 %.idx62, 32
  %73 = and i64 %13, 2305843009213693948
  %diff.check81 = icmp eq i64 %73, 0
  %conflict.rdx = or i1 %diff.check, %diff.check81
  %diff.check82 = icmp ult i64 %.idx, 32
  %conflict.rdx83 = or i1 %conflict.rdx, %diff.check82
  br i1 %conflict.rdx83, label %.lr.ph71.preheader91, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %59, -4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %74 = getelementptr inbounds double, ptr %17, i64 %index
  %75 = getelementptr inbounds i8, ptr %74, i64 16
  %wide.load = load <2 x double>, ptr %74, align 8, !tbaa !16
  %wide.load84 = load <2 x double>, ptr %75, align 8, !tbaa !16
  %76 = getelementptr inbounds double, ptr %5, i64 %index
  %77 = getelementptr inbounds i8, ptr %76, i64 16
  %wide.load85 = load <2 x double>, ptr %76, align 8, !tbaa !16
  %wide.load86 = load <2 x double>, ptr %77, align 8, !tbaa !16
  %78 = fadd <2 x double> %wide.load, %wide.load85
  %79 = fadd <2 x double> %wide.load84, %wide.load86
  %80 = getelementptr inbounds double, ptr %19, i64 %index
  %81 = getelementptr inbounds i8, ptr %80, i64 16
  %wide.load87 = load <2 x double>, ptr %80, align 8, !tbaa !16
  %wide.load88 = load <2 x double>, ptr %81, align 8, !tbaa !16
  %82 = fadd <2 x double> %78, %wide.load87
  %83 = fadd <2 x double> %79, %wide.load88
  %84 = getelementptr inbounds double, ptr %18, i64 %index
  %85 = getelementptr inbounds i8, ptr %84, i64 16
  %wide.load89 = load <2 x double>, ptr %84, align 8, !tbaa !16
  %wide.load90 = load <2 x double>, ptr %85, align 8, !tbaa !16
  %86 = fadd <2 x double> %82, %wide.load89
  %87 = fadd <2 x double> %83, %wide.load90
  %88 = getelementptr inbounds double, ptr %20, i64 %index
  %89 = getelementptr inbounds i8, ptr %88, i64 16
  store <2 x double> %86, ptr %88, align 8, !tbaa !16
  store <2 x double> %87, ptr %89, align 8, !tbaa !16
  %index.next = add nuw i64 %index, 4
  %90 = icmp eq i64 %index.next, %n.vec
  br i1 %90, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %59, %n.vec
  br i1 %cmp.n, label %._crit_edge.loopexit, label %.lr.ph71.preheader91

._crit_edge.loopexit:                             ; preds = %.lr.ph71.prol.loopexit, %.lr.ph71, %middle.block
  %91 = trunc i64 %59 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader, %.loopexit
  %92 = phi i32 [ 0, %.loopexit ], [ 0, %.preheader ], [ %91, %._crit_edge.loopexit ]
  %93 = call noundef double @_ZN5nasoq10norm_denseEiiPdi(i32 noundef %92, i32 noundef 1, ptr noundef nonnull %20, i32 noundef 0)
  call void @_ZdaPv(ptr noundef nonnull %17) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  ret double %93

.lr.ph71:                                         ; preds = %.lr.ph71.prol.loopexit, %.lr.ph71
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph71 ], [ %indvars.iv.unr, %.lr.ph71.prol.loopexit ]
  %94 = getelementptr inbounds double, ptr %17, i64 %indvars.iv
  %95 = load double, ptr %94, align 8, !tbaa !16
  %96 = getelementptr inbounds double, ptr %5, i64 %indvars.iv
  %97 = load double, ptr %96, align 8, !tbaa !16
  %98 = fadd double %95, %97
  %99 = getelementptr inbounds double, ptr %19, i64 %indvars.iv
  %100 = load double, ptr %99, align 8, !tbaa !16
  %101 = fadd double %98, %100
  %102 = getelementptr inbounds double, ptr %18, i64 %indvars.iv
  %103 = load double, ptr %102, align 8, !tbaa !16
  %104 = fadd double %101, %103
  %105 = getelementptr inbounds double, ptr %20, i64 %indvars.iv
  store double %104, ptr %105, align 8, !tbaa !16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %106 = getelementptr inbounds double, ptr %17, i64 %indvars.iv.next
  %107 = load double, ptr %106, align 8, !tbaa !16
  %108 = getelementptr inbounds double, ptr %5, i64 %indvars.iv.next
  %109 = load double, ptr %108, align 8, !tbaa !16
  %110 = fadd double %107, %109
  %111 = getelementptr inbounds double, ptr %19, i64 %indvars.iv.next
  %112 = load double, ptr %111, align 8, !tbaa !16
  %113 = fadd double %110, %112
  %114 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.next
  %115 = load double, ptr %114, align 8, !tbaa !16
  %116 = fadd double %113, %115
  %117 = getelementptr inbounds double, ptr %20, i64 %indvars.iv.next
  store double %116, ptr %117, align 8, !tbaa !16
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %59
  br i1 %exitcond.not.1, label %._crit_edge.loopexit, label %.lr.ph71, !llvm.loop !22
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { 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, !7, i64 8}
!6 = !{!"_ZTSN5nasoq12sympiler_CSCE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !10, i64 32}
!14 = !{!6, !10, i64 48}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !19, !20, !21}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !19, !20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass