; LLVM IR from darnstrom/daqp :: src (auxiliary)

; 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.DAQPWorkspace = type { ptr, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, ptr, ptr, ptr, ptr, i32, ptr, i32, i32, i32, double, ptr, ptr, i32, ptr }
%struct.DAQPSettings = type { double, double, double, double, double, i32, i32, double, double, double, double, double, double }

; Function Attrs: nounwind uwtable
define dso_local void @remove_constraint(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.DAQPWorkspace, ptr %6, i32 0, i32 9
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.DAQPWorkspace, ptr %9, i32 0, i32 23
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i32, ptr %11, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr %8, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = and i32 %18, -2
  store i32 %19, ptr %17, align 4, !tbaa !9
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !9
  call void @update_LDL_remove(ptr noundef %20, i32 noundef %21)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.DAQPWorkspace, ptr %22, i32 0, i32 24
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %23, align 8, !tbaa !15
  %26 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %26, ptr %5, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %62, %2
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.DAQPWorkspace, ptr %29, i32 0, i32 24
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = icmp slt i32 %28, %31
  br i1 %32, label %33, label %65

33:                                               ; preds = %27
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.DAQPWorkspace, ptr %34, i32 0, i32 23
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %36, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.DAQPWorkspace, ptr %42, i32 0, i32 23
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  store i32 %41, ptr %47, align 4, !tbaa !9
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.DAQPWorkspace, ptr %48, i32 0, i32 14
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds double, ptr %50, i64 %53
  %55 = load double, ptr %54, align 8, !tbaa !17
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.DAQPWorkspace, ptr %56, i32 0, i32 14
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  %59 = load i32, ptr %5, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds double, ptr %58, i64 %60
  store double %55, ptr %61, align 8, !tbaa !17
  br label %62

62:                                               ; preds = %33
  %63 = load i32, ptr %5, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %5, align 4, !tbaa !9
  br label %27, !llvm.loop !18

65:                                               ; preds = %27
  %66 = load i32, ptr %4, align 4, !tbaa !9
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.DAQPWorkspace, ptr %67, i32 0, i32 22
  %69 = load i32, ptr %68, align 8, !tbaa !20
  %70 = icmp slt i32 %66, %69
  br i1 %70, label %71, label %75

71:                                               ; preds = %65
  %72 = load i32, ptr %4, align 4, !tbaa !9
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.DAQPWorkspace, ptr %73, i32 0, i32 22
  store i32 %72, ptr %74, align 8, !tbaa !20
  br label %75

75:                                               ; preds = %71, %65
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.DAQPWorkspace, ptr %76, i32 0, i32 24
  %78 = load i32, ptr %77, align 8, !tbaa !15
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %80, label %113

80:                                               ; preds = %75
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.DAQPWorkspace, ptr %81, i32 0, i32 19
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.DAQPWorkspace, ptr %84, i32 0, i32 24
  %86 = load i32, ptr %85, align 8, !tbaa !15
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds double, ptr %83, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !17
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.DAQPWorkspace, ptr %91, i32 0, i32 28
  %93 = load ptr, ptr %92, align 8, !tbaa !22
  %94 = getelementptr inbounds %struct.DAQPSettings, ptr %93, i32 0, i32 2
  %95 = load double, ptr %94, align 8, !tbaa !23
  %96 = fcmp olt double %90, %95
  br i1 %96, label %97, label %113

97:                                               ; preds = %80
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.DAQPWorkspace, ptr %98, i32 0, i32 24
  %100 = load i32, ptr %99, align 8, !tbaa !15
  %101 = sub nsw i32 %100, 1
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.DAQPWorkspace, ptr %102, i32 0, i32 26
  store i32 %101, ptr %103, align 8, !tbaa !25
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.DAQPWorkspace, ptr %104, i32 0, i32 19
  %106 = load ptr, ptr %105, align 8, !tbaa !21
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.DAQPWorkspace, ptr %107, i32 0, i32 24
  %109 = load i32, ptr %108, align 8, !tbaa !15
  %110 = sub nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds double, ptr %106, i64 %111
  store double 0.000000e+00, ptr %112, align 8, !tbaa !17
  br label %115

113:                                              ; preds = %80, %75
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  call void @pivot_last(ptr noundef %114)
  br label %115

115:                                              ; preds = %113, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

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

declare void @update_LDL_remove(ptr noundef, i32 noundef) #2

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

; 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 = !{!"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 64}
!12 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !10, 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, !13, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !10, i64 168, !6, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !13, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !6, i64 232}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 176}
!15 = !{!12, !10, i64 184}
!16 = !{!12, !6, i64 104}
!17 = !{!13, !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!12, !10, i64 168}
!21 = !{!12, !6, i64 144}
!22 = !{!12, !6, i64 208}
!23 = !{!24, !13, i64 16}
!24 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !10, i64 40, !10, i64 44, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88}
!25 = !{!12, !10, i64 192}


; 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
define dso_local void @remove_constraint(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 64
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 176
  %6 = load ptr, ptr %5, align 8, !tbaa !12
  %7 = sext i32 %1 to i64
  %8 = getelementptr inbounds i32, ptr %6, i64 %7
  %9 = load i32, ptr %8, align 4, !tbaa !13
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds i32, ptr %4, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = and i32 %12, -2
  store i32 %13, ptr %11, align 4, !tbaa !13
  tail call void @update_LDL_remove(ptr noundef %0, i32 noundef %1) #2
  %14 = getelementptr inbounds i8, ptr %0, i64 184
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr %14, align 8, !tbaa !14
  %17 = icmp sgt i32 %16, %1
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %18 = load ptr, ptr %5, align 8, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %0, i64 104
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  br label %21

21:                                               ; preds = %.lr.ph, %21
  %indvars.iv = phi i64 [ %7, %.lr.ph ], [ %indvars.iv.next, %21 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %22 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv.next
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv
  store i32 %23, ptr %24, align 4, !tbaa !13
  %25 = getelementptr inbounds double, ptr %20, i64 %indvars.iv.next
  %26 = load double, ptr %25, align 8, !tbaa !16
  %27 = getelementptr inbounds double, ptr %20, i64 %indvars.iv
  store double %26, ptr %27, align 8, !tbaa !16
  %.pr = load i32, ptr %14, align 8, !tbaa !14
  %28 = sext i32 %.pr to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %21, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %21, %2
  %.lcssa = phi i32 [ %16, %2 ], [ %.pr, %21 ]
  %30 = getelementptr inbounds i8, ptr %0, i64 168
  %31 = load i32, ptr %30, align 8, !tbaa !19
  %32 = icmp sgt i32 %31, %1
  br i1 %32, label %33, label %34

33:                                               ; preds = %._crit_edge
  store i32 %1, ptr %30, align 8, !tbaa !19
  br label %34

34:                                               ; preds = %33, %._crit_edge
  %35 = icmp sgt i32 %.lcssa, 0
  br i1 %35, label %36, label %53

36:                                               ; preds = %34
  %37 = getelementptr inbounds i8, ptr %0, i64 144
  %38 = load ptr, ptr %37, align 8, !tbaa !20
  %39 = add nsw i32 %.lcssa, -1
  %40 = zext nneg i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %38, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !16
  %43 = getelementptr inbounds i8, ptr %0, i64 208
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load double, ptr %45, align 8, !tbaa !22
  %47 = fcmp olt double %42, %46
  br i1 %47, label %48, label %53

48:                                               ; preds = %36
  %49 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 %39, ptr %49, align 8, !tbaa !24
  %50 = zext nneg i32 %.lcssa to i64
  %51 = getelementptr double, ptr %38, i64 %50
  %52 = getelementptr i8, ptr %51, i64 -8
  store double 0.000000e+00, ptr %52, align 8, !tbaa !16
  br label %54

53:                                               ; preds = %36, %34
  tail call void @pivot_last(ptr noundef nonnull %0)
  br label %54

54:                                               ; preds = %53, %48
  ret void
}

declare void @update_LDL_remove(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @pivot_last(ptr noundef) local_unnamed_addr #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" }
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 = { 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 64}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !10, 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, !11, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !10, i64 168, !7, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !11, i64 200, !7, i64 208, !7, i64 216, !10, i64 224, !7, i64 232}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 176}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 184}
!15 = !{!6, !7, i64 104}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !10, i64 168}
!20 = !{!6, !7, i64 144}
!21 = !{!6, !7, i64 208}
!22 = !{!23, !11, i64 16}
!23 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !10, i64 40, !10, i64 44, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88}
!24 = !{!6, !10, i64 192}


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