; LLVM IR from tsotchke/quantum_geometric_tensor :: src/quantum_geometric/core (quantum_scheduler)

; 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.anon = type { i8, %struct.scheduler_config_t, ptr, i64, i64, ptr, i64, ptr, i32, i8, double }
%struct.scheduler_config_t = type { i64, i64, i8, i8, double, i32 }
%struct.quantum_task_t = type { ptr, i32, ptr, i64, ptr, i64, i32, ptr, double, double }
%struct.resource_requirement_t = type { i32, i64, double, i8 }
%struct.resource_pool_t = type { i32, i64, i64, double, ptr }

@scheduler = external hidden global %struct.anon, align 8

; 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: nounwind uwtable
define dso_local zeroext i1 @allocate_resources(ptr noundef %0) #1 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %16 = load i8, ptr @scheduler, align 8, !tbaa !9, !range !16, !noundef !17
  %17 = trunc i8 %16 to i1
  br i1 %17, label %18, label %21

18:                                               ; preds = %1
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %18, %1
  store i32 1, ptr getelementptr inbounds (%struct.anon, ptr @scheduler, i32 0, i32 8), align 8, !tbaa !18
  store i1 false, ptr %2, align 1
  br label %224

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i64 0, ptr %4, align 8, !tbaa !19
  br label %23

23:                                               ; preds = %218, %22
  %24 = load i64, ptr %4, align 8, !tbaa !19
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.quantum_task_t, ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !20
  %28 = icmp ult i64 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 2, ptr %5, align 4
  br label %221

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.quantum_task_t, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !22
  %34 = load i64, ptr %4, align 8, !tbaa !19
  %35 = getelementptr inbounds %struct.resource_requirement_t, ptr %33, i64 %34
  store ptr %35, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  store i8 0, ptr %7, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !19
  br label %36

36:                                               ; preds = %204, %30
  %37 = load i64, ptr %8, align 8, !tbaa !19
  %38 = load i64, ptr getelementptr inbounds (%struct.anon, ptr @scheduler, i32 0, i32 6), align 8, !tbaa !24
  %39 = icmp ult i64 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 5, ptr %5, align 4
  br label %207

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %42 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr @scheduler, i32 0, i32 5), align 8, !tbaa !25
  %43 = load i64, ptr %8, align 8, !tbaa !19
  %44 = getelementptr inbounds ptr, ptr %42, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  store ptr %45, ptr %9, align 8, !tbaa !5
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.resource_pool_t, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !26
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.resource_requirement_t, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !28
  %52 = icmp eq i32 %48, %51
  br i1 %52, label %53, label %200

53:                                               ; preds = %41
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.resource_pool_t, ptr %54, i32 0, i32 2
  %56 = load i64, ptr %55, align 8, !tbaa !30
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.resource_requirement_t, ptr %57, i32 0, i32 1
  %59 = load i64, ptr %58, align 8, !tbaa !31
  %60 = icmp uge i64 %56, %59
  br i1 %60, label %61, label %200

61:                                               ; preds = %53
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.resource_requirement_t, ptr %62, i32 0, i32 3
  %64 = load i8, ptr %63, align 8, !tbaa !32, !range !16, !noundef !17
  %65 = trunc i8 %64 to i1
  br i1 %65, label %66, label %129

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  store i64 0, ptr %10, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  store i64 0, ptr %11, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  store i64 0, ptr %12, align 8, !tbaa !19
  br label %67

67:                                               ; preds = %124, %66
  %68 = load i64, ptr %12, align 8, !tbaa !19
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.resource_pool_t, ptr %69, i32 0, i32 1
  %71 = load i64, ptr %70, align 8, !tbaa !33
  %72 = icmp ult i64 %68, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %67
  store i32 8, ptr %5, align 4
  br label %127

74:                                               ; preds = %67
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.resource_pool_t, ptr %75, i32 0, i32 4
  %77 = load ptr, ptr %76, align 8, !tbaa !34
  %78 = load i64, ptr %12, align 8, !tbaa !19
  %79 = getelementptr inbounds i8, ptr %77, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !23, !range !16, !noundef !17
  %81 = trunc i8 %80 to i1
  br i1 %81, label %122, label %82

82:                                               ; preds = %74
  %83 = load i64, ptr %11, align 8, !tbaa !19
  %84 = icmp eq i64 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = load i64, ptr %12, align 8, !tbaa !19
  store i64 %86, ptr %10, align 8, !tbaa !19
  br label %87

87:                                               ; preds = %85, %82
  %88 = load i64, ptr %11, align 8, !tbaa !19
  %89 = add i64 %88, 1
  store i64 %89, ptr %11, align 8, !tbaa !19
  %90 = load i64, ptr %11, align 8, !tbaa !19
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.resource_requirement_t, ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !31
  %94 = icmp eq i64 %90, %93
  br i1 %94, label %95, label %121

95:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %96 = load i64, ptr %10, align 8, !tbaa !19
  store i64 %96, ptr %13, align 8, !tbaa !19
  br label %97

97:                                               ; preds = %110, %95
  %98 = load i64, ptr %13, align 8, !tbaa !19
  %99 = load i64, ptr %10, align 8, !tbaa !19
  %100 = load i64, ptr %11, align 8, !tbaa !19
  %101 = add i64 %99, %100
  %102 = icmp ult i64 %98, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %97
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  br label %113

104:                                              ; preds = %97
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.resource_pool_t, ptr %105, i32 0, i32 4
  %107 = load ptr, ptr %106, align 8, !tbaa !34
  %108 = load i64, ptr %13, align 8, !tbaa !19
  %109 = getelementptr inbounds i8, ptr %107, i64 %108
  store i8 1, ptr %109, align 1, !tbaa !23
  br label %110

110:                                              ; preds = %104
  %111 = load i64, ptr %13, align 8, !tbaa !19
  %112 = add i64 %111, 1
  store i64 %112, ptr %13, align 8, !tbaa !19
  br label %97, !llvm.loop !35

113:                                              ; preds = %103
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.resource_requirement_t, ptr %114, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !31
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.resource_pool_t, ptr %117, i32 0, i32 2
  %119 = load i64, ptr %118, align 8, !tbaa !30
  %120 = sub i64 %119, %116
  store i64 %120, ptr %118, align 8, !tbaa !30
  store i8 1, ptr %7, align 1, !tbaa !23
  store i32 8, ptr %5, align 4
  br label %127

121:                                              ; preds = %87
  br label %123

122:                                              ; preds = %74
  store i64 0, ptr %11, align 8, !tbaa !19
  br label %123

123:                                              ; preds = %122, %121
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %12, align 8, !tbaa !19
  %126 = add i64 %125, 1
  store i64 %126, ptr %12, align 8, !tbaa !19
  br label %67, !llvm.loop !37

127:                                              ; preds = %113, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  br label %128

128:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  br label %180

129:                                              ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  store i64 0, ptr %14, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  store i64 0, ptr %15, align 8, !tbaa !19
  br label %130

130:                                              ; preds = %162, %129
  %131 = load i64, ptr %15, align 8, !tbaa !19
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.resource_pool_t, ptr %132, i32 0, i32 1
  %134 = load i64, ptr %133, align 8, !tbaa !33
  %135 = icmp ult i64 %131, %134
  br i1 %135, label %136, label %142

136:                                              ; preds = %130
  %137 = load i64, ptr %14, align 8, !tbaa !19
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.resource_requirement_t, ptr %138, i32 0, i32 1
  %140 = load i64, ptr %139, align 8, !tbaa !31
  %141 = icmp ult i64 %137, %140
  br label %142

142:                                              ; preds = %136, %130
  %143 = phi i1 [ false, %130 ], [ %141, %136 ]
  br i1 %143, label %145, label %144

144:                                              ; preds = %142
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  br label %165

145:                                              ; preds = %142
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.resource_pool_t, ptr %146, i32 0, i32 4
  %148 = load ptr, ptr %147, align 8, !tbaa !34
  %149 = load i64, ptr %15, align 8, !tbaa !19
  %150 = getelementptr inbounds i8, ptr %148, i64 %149
  %151 = load i8, ptr %150, align 1, !tbaa !23, !range !16, !noundef !17
  %152 = trunc i8 %151 to i1
  br i1 %152, label %161, label %153

153:                                              ; preds = %145
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.resource_pool_t, ptr %154, i32 0, i32 4
  %156 = load ptr, ptr %155, align 8, !tbaa !34
  %157 = load i64, ptr %15, align 8, !tbaa !19
  %158 = getelementptr inbounds i8, ptr %156, i64 %157
  store i8 1, ptr %158, align 1, !tbaa !23
  %159 = load i64, ptr %14, align 8, !tbaa !19
  %160 = add i64 %159, 1
  store i64 %160, ptr %14, align 8, !tbaa !19
  br label %161

161:                                              ; preds = %153, %145
  br label %162

162:                                              ; preds = %161
  %163 = load i64, ptr %15, align 8, !tbaa !19
  %164 = add i64 %163, 1
  store i64 %164, ptr %15, align 8, !tbaa !19
  br label %130, !llvm.loop !38

165:                                              ; preds = %144
  %166 = load i64, ptr %14, align 8, !tbaa !19
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.resource_requirement_t, ptr %167, i32 0, i32 1
  %169 = load i64, ptr %168, align 8, !tbaa !31
  %170 = icmp eq i64 %166, %169
  br i1 %170, label %171, label %179

171:                                              ; preds = %165
  %172 = load ptr, ptr %6, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.resource_requirement_t, ptr %172, i32 0, i32 1
  %174 = load i64, ptr %173, align 8, !tbaa !31
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.resource_pool_t, ptr %175, i32 0, i32 2
  %177 = load i64, ptr %176, align 8, !tbaa !30
  %178 = sub i64 %177, %174
  store i64 %178, ptr %176, align 8, !tbaa !30
  store i8 1, ptr %7, align 1, !tbaa !23
  br label %179

179:                                              ; preds = %171, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  br label %180

180:                                              ; preds = %179, %128
  %181 = load i8, ptr %7, align 1, !tbaa !23, !range !16, !noundef !17
  %182 = trunc i8 %181 to i1
  br i1 %182, label %183, label %199

183:                                              ; preds = %180
  %184 = load ptr, ptr %9, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.resource_pool_t, ptr %184, i32 0, i32 1
  %186 = load i64, ptr %185, align 8, !tbaa !33
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.resource_pool_t, ptr %187, i32 0, i32 2
  %189 = load i64, ptr %188, align 8, !tbaa !30
  %190 = sub i64 %186, %189
  %191 = uitofp i64 %190 to double
  %192 = load ptr, ptr %9, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.resource_pool_t, ptr %192, i32 0, i32 1
  %194 = load i64, ptr %193, align 8, !tbaa !33
  %195 = uitofp i64 %194 to double
  %196 = fdiv double %191, %195
  %197 = load ptr, ptr %9, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.resource_pool_t, ptr %197, i32 0, i32 3
  store double %196, ptr %198, align 8, !tbaa !39
  store i32 5, ptr %5, align 4
  br label %201

199:                                              ; preds = %180
  br label %200

200:                                              ; preds = %199, %53, %41
  store i32 0, ptr %5, align 4
  br label %201

201:                                              ; preds = %200, %183
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  %202 = load i32, ptr %5, align 4
  switch i32 %202, label %207 [
    i32 0, label %203
  ]

203:                                              ; preds = %201
  br label %204

204:                                              ; preds = %203
  %205 = load i64, ptr %8, align 8, !tbaa !19
  %206 = add i64 %205, 1
  store i64 %206, ptr %8, align 8, !tbaa !19
  br label %36, !llvm.loop !40

207:                                              ; preds = %201, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %208

208:                                              ; preds = %207
  %209 = load i8, ptr %7, align 1, !tbaa !23, !range !16, !noundef !17
  %210 = trunc i8 %209 to i1
  br i1 %210, label %214, label %211

211:                                              ; preds = %208
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = call zeroext i1 @release_resources(ptr noundef %212)
  store i32 2, ptr getelementptr inbounds (%struct.anon, ptr @scheduler, i32 0, i32 8), align 8, !tbaa !18
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %215

214:                                              ; preds = %208
  store i32 0, ptr %5, align 4
  br label %215

215:                                              ; preds = %214, %211
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %216 = load i32, ptr %5, align 4
  switch i32 %216, label %221 [
    i32 0, label %217
  ]

217:                                              ; preds = %215
  br label %218

218:                                              ; preds = %217
  %219 = load i64, ptr %4, align 8, !tbaa !19
  %220 = add i64 %219, 1
  store i64 %220, ptr %4, align 8, !tbaa !19
  br label %23, !llvm.loop !41

221:                                              ; preds = %215, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %222 = load i32, ptr %5, align 4
  switch i32 %222, label %226 [
    i32 2, label %223
    i32 1, label %224
  ]

223:                                              ; preds = %221
  store i1 true, ptr %2, align 1
  br label %224

224:                                              ; preds = %223, %221, %21
  %225 = load i1, ptr %2, align 1
  ret i1 %225

226:                                              ; preds = %221
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @release_resources(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 8, !6, i64 48, !13, i64 56, !13, i64 64, !6, i64 72, !13, i64 80, !6, i64 88, !15, i64 96, !11, i64 100, !14, i64 104}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8, !11, i64 16, !11, i64 17, !14, i64 24, !15, i64 32}
!13 = !{!"long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!10, !15, i64 96}
!19 = !{!13, !13, i64 0}
!20 = !{!21, !13, i64 24}
!21 = !{!"quantum_task_t", !6, i64 0, !15, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !15, i64 48, !6, i64 56, !14, i64 64, !14, i64 72}
!22 = !{!21, !6, i64 16}
!23 = !{!11, !11, i64 0}
!24 = !{!10, !13, i64 80}
!25 = !{!10, !6, i64 72}
!26 = !{!27, !15, i64 0}
!27 = !{!"", !15, i64 0, !13, i64 8, !13, i64 16, !14, i64 24, !6, i64 32}
!28 = !{!29, !15, i64 0}
!29 = !{!"", !15, i64 0, !13, i64 8, !14, i64 16, !11, i64 24}
!30 = !{!27, !13, i64 16}
!31 = !{!29, !13, i64 8}
!32 = !{!29, !11, i64 24}
!33 = !{!27, !13, i64 8}
!34 = !{!27, !6, i64 32}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = distinct !{!37, !36}
!38 = distinct !{!38, !36}
!39 = !{!27, !14, i64 24}
!40 = distinct !{!40, !36}
!41 = distinct !{!41, !36}


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

%struct.anon = type { i8, %struct.scheduler_config_t, ptr, i64, i64, ptr, i64, ptr, i32, i8, double }
%struct.scheduler_config_t = type { i64, i64, i8, i8, double, i32 }
%struct.resource_requirement_t = type { i32, i64, double, i8 }

@scheduler = external hidden local_unnamed_addr global %struct.anon, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @allocate_resources(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i8, ptr @scheduler, align 8, !tbaa !5, !range !15, !noundef !16
  %3 = trunc nuw i8 %2 to i1
  %4 = icmp ne ptr %0, null
  %or.cond = and i1 %4, %3
  br i1 %or.cond, label %.preheader97, label %.loopexit98.sink.split

.preheader97:                                     ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load i64, ptr %5, align 8, !tbaa !17
  %7 = icmp eq i64 %6, 0
  br i1 %7, label %.loopexit98, label %.lr.ph127

.lr.ph127:                                        ; preds = %.preheader97
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !19
  %10 = load i64, ptr getelementptr inbounds (i8, ptr @scheduler, i64 80), align 8, !tbaa !20
  %.not129 = icmp eq i64 %10, 0
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @scheduler, i64 72), align 8
  br i1 %.not129, label %.critedge94, label %.lr.ph122

.lr.ph122:                                        ; preds = %.lr.ph127, %.thread
  %.074126 = phi i64 [ %66, %.thread ], [ 0, %.lr.ph127 ]
  %12 = getelementptr inbounds %struct.resource_requirement_t, ptr %9, i64 %.074126
  %13 = load i32, ptr %12, align 8, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  %15 = getelementptr inbounds i8, ptr %12, i64 24
  br label %16

16:                                               ; preds = %.lr.ph122, %.loopexit
  %.069121 = phi i64 [ 0, %.lr.ph122 ], [ %67, %.loopexit ]
  %17 = getelementptr inbounds ptr, ptr %11, i64 %.069121
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  %19 = load i32, ptr %18, align 8, !tbaa !24
  %20 = icmp eq i32 %19, %13
  br i1 %20, label %21, label %.loopexit

21:                                               ; preds = %16
  %22 = getelementptr inbounds i8, ptr %18, i64 16
  %23 = load i64, ptr %22, align 8, !tbaa !26
  %24 = load i64, ptr %14, align 8, !tbaa !27
  %.not = icmp ult i64 %23, %24
  br i1 %.not, label %.loopexit, label %25

25:                                               ; preds = %21
  %26 = load i8, ptr %15, align 8, !tbaa !28, !range !15, !noundef !16
  %27 = trunc nuw i8 %26 to i1
  %28 = getelementptr inbounds i8, ptr %18, i64 8
  %29 = load i64, ptr %28, align 8, !tbaa !29
  br i1 %27, label %.preheader, label %.preheader96

.preheader96:                                     ; preds = %25
  %30 = icmp ne i64 %29, 0
  %31 = icmp ne i64 %24, 0
  %or.cond92112 = and i1 %30, %31
  br i1 %or.cond92112, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader96
  %32 = getelementptr inbounds i8, ptr %18, i64 32
  %33 = load ptr, ptr %32, align 8, !tbaa !30
  br label %49

.preheader:                                       ; preds = %25
  %.not130 = icmp eq i64 %29, 0
  br i1 %.not130, label %.loopexit, label %.lr.ph118

.lr.ph118:                                        ; preds = %.preheader
  %34 = getelementptr inbounds i8, ptr %18, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !30
  br label %36

36:                                               ; preds = %.lr.ph118, %46
  %.061117 = phi i64 [ 0, %.lr.ph118 ], [ %47, %46 ]
  %.062116 = phi i64 [ 0, %.lr.ph118 ], [ %.163, %46 ]
  %.064115 = phi i64 [ 0, %.lr.ph118 ], [ %.2, %46 ]
  %37 = getelementptr inbounds i8, ptr %35, i64 %.061117
  %38 = load i8, ptr %37, align 1, !tbaa !31, !range !15, !noundef !16
  %39 = trunc nuw i8 %38 to i1
  br i1 %39, label %46, label %40

40:                                               ; preds = %36
  %41 = icmp eq i64 %.062116, 0
  %spec.select = select i1 %41, i64 %.061117, i64 %.064115
  %42 = add i64 %.062116, 1
  %43 = icmp eq i64 %42, %24
  br i1 %43, label %.loopexit95, label %46

.loopexit95:                                      ; preds = %40
  %44 = add i64 %spec.select, %24
  %45 = icmp ult i64 %spec.select, %44
  br i1 %45, label %.lr.ph125.preheader, label %.thread

.lr.ph125.preheader:                              ; preds = %.loopexit95
  %scevgep = getelementptr i8, ptr %35, i64 %spec.select
  tail call void @llvm.memset.p0.i64(ptr align 1 %scevgep, i8 1, i64 %24, i1 false), !tbaa !31
  br label %.thread

46:                                               ; preds = %36, %40
  %.2 = phi i64 [ %spec.select, %40 ], [ %.064115, %36 ]
  %.163 = phi i64 [ %42, %40 ], [ 0, %36 ]
  %47 = add nuw i64 %.061117, 1
  %exitcond.not = icmp eq i64 %47, %29
  br i1 %exitcond.not, label %.loopexit, label %36, !llvm.loop !32

.critedge:                                        ; preds = %55, %.preheader96
  %.059.lcssa = phi i64 [ 0, %.preheader96 ], [ %.1, %55 ]
  %48 = icmp eq i64 %.059.lcssa, %24
  br i1 %48, label %.thread, label %.loopexit

49:                                               ; preds = %.lr.ph, %55
  %.0114 = phi i64 [ 0, %.lr.ph ], [ %56, %55 ]
  %.059113 = phi i64 [ 0, %.lr.ph ], [ %.1, %55 ]
  %50 = getelementptr inbounds i8, ptr %33, i64 %.0114
  %51 = load i8, ptr %50, align 1, !tbaa !31, !range !15, !noundef !16
  %52 = trunc nuw i8 %51 to i1
  br i1 %52, label %55, label %53

53:                                               ; preds = %49
  store i8 1, ptr %50, align 1, !tbaa !31
  %54 = add nuw i64 %.059113, 1
  br label %55

55:                                               ; preds = %49, %53
  %.1 = phi i64 [ %.059113, %49 ], [ %54, %53 ]
  %56 = add nuw i64 %.0114, 1
  %57 = icmp ult i64 %56, %29
  %58 = icmp ult i64 %.1, %24
  %or.cond92 = select i1 %57, i1 %58, i1 false
  br i1 %or.cond92, label %49, label %.critedge, !llvm.loop !34

.thread:                                          ; preds = %.critedge, %.loopexit95, %.lr.ph125.preheader
  %59 = getelementptr inbounds i8, ptr %18, i64 16
  %60 = sub i64 %23, %24
  store i64 %60, ptr %59, align 8, !tbaa !26
  %61 = sub i64 %29, %60
  %62 = uitofp i64 %61 to double
  %63 = uitofp i64 %29 to double
  %64 = fdiv double %62, %63
  %65 = getelementptr inbounds i8, ptr %18, i64 24
  store double %64, ptr %65, align 8, !tbaa !35
  %66 = add nuw i64 %.074126, 1
  %exitcond141 = icmp eq i64 %66, %6
  br i1 %exitcond141, label %.loopexit98, label %.lr.ph122, !llvm.loop !36

.loopexit:                                        ; preds = %46, %.preheader, %.critedge, %21, %16
  %67 = add nuw i64 %.069121, 1
  %exitcond140.not = icmp eq i64 %67, %10
  br i1 %exitcond140.not, label %.critedge94, label %16, !llvm.loop !37

.critedge94:                                      ; preds = %.loopexit, %.lr.ph127
  %68 = tail call zeroext i1 @release_resources(ptr noundef nonnull %0)
  br label %.loopexit98.sink.split

.loopexit98.sink.split:                           ; preds = %1, %.critedge94
  %.sink = phi i32 [ 2, %.critedge94 ], [ 1, %1 ]
  store i32 %.sink, ptr getelementptr inbounds (i8, ptr @scheduler, i64 96), align 8, !tbaa !38
  br label %.loopexit98

.loopexit98:                                      ; preds = %.thread, %.loopexit98.sink.split, %.preheader97
  %.3 = phi i1 [ true, %.preheader97 ], [ false, %.loopexit98.sink.split ], [ true, %.thread ]
  ret i1 %.3
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @release_resources(ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }

!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 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !14, i64 48, !11, i64 56, !11, i64 64, !14, i64 72, !11, i64 80, !14, i64 88, !13, i64 96, !7, i64 100, !12, i64 104}
!7 = !{!"_Bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 8, !7, i64 16, !7, i64 17, !12, i64 24, !13, i64 32}
!11 = !{!"long", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !11, i64 24}
!18 = !{!"quantum_task_t", !14, i64 0, !13, i64 8, !14, i64 16, !11, i64 24, !14, i64 32, !11, i64 40, !13, i64 48, !14, i64 56, !12, i64 64, !12, i64 72}
!19 = !{!18, !14, i64 16}
!20 = !{!6, !11, i64 80}
!21 = !{!22, !13, i64 0}
!22 = !{!"", !13, i64 0, !11, i64 8, !12, i64 16, !7, i64 24}
!23 = !{!14, !14, i64 0}
!24 = !{!25, !13, i64 0}
!25 = !{!"", !13, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !14, i64 32}
!26 = !{!25, !11, i64 16}
!27 = !{!22, !11, i64 8}
!28 = !{!22, !7, i64 24}
!29 = !{!25, !11, i64 8}
!30 = !{!25, !14, i64 32}
!31 = !{!7, !7, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}
!35 = !{!25, !12, i64 24}
!36 = distinct !{!36, !33}
!37 = distinct !{!37, !33}
!38 = !{!6, !13, i64 96}


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