; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/old/test_concurrent_queue_v2.ll (Z12TestIteratorv)

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

%"class.tbb::concurrent_queue" = type { %"class.tbb::internal::concurrent_queue_base" }
%"class.tbb::internal::concurrent_queue_base" = type { ptr, ptr, i64, i64, i64 }
%"class.tbb::internal::concurrent_queue_iterator" = type { %"class.tbb::internal::concurrent_queue_iterator_base" }
%"class.tbb::internal::concurrent_queue_iterator_base" = type { ptr, ptr }
%class.Foo = type { i32, i32, i32 }

; 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: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3FooC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12TestIteratorv() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.tbb::concurrent_queue", align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %8 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %9 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %10 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %11 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %12 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %13 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %14 = alloca %class.Foo, align 4
  %15 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %16 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %17 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr %1) #4
  call void @_ZN3tbb16concurrent_queueI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store ptr %1, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %48, %0
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 500
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %101

22:                                               ; preds = %18
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %23 unwind label %51

23:                                               ; preds = %22
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %24 unwind label %55

24:                                               ; preds = %23
  %25 = load i32, ptr %3, align 4, !tbaa !9
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef %4, ptr noundef %7, i32 noundef %25)
          to label %26 unwind label %59

26:                                               ; preds = %24
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(40) %27)
          to label %28 unwind label %51

28:                                               ; preds = %26
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %9, ptr noundef nonnull align 8 dereferenceable(40) %29)
          to label %30 unwind label %64

30:                                               ; preds = %28
  %31 = load i32, ptr %3, align 4, !tbaa !9
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef %8, ptr noundef %9, i32 noundef %31)
          to label %32 unwind label %68

32:                                               ; preds = %30
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(40) %33)
          to label %34 unwind label %51

34:                                               ; preds = %32
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %35 unwind label %73

35:                                               ; preds = %34
  %36 = load i32, ptr %3, align 4, !tbaa !9
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef %10, ptr noundef %11, i32 noundef %36)
          to label %37 unwind label %77

37:                                               ; preds = %35
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %38 unwind label %51

38:                                               ; preds = %37
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %13, ptr noundef nonnull align 8 dereferenceable(40) %39)
          to label %40 unwind label %82

40:                                               ; preds = %38
  %41 = load i32, ptr %3, align 4, !tbaa !9
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef %12, ptr noundef %13, i32 noundef %41)
          to label %42 unwind label %86

42:                                               ; preds = %40
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #4
  invoke void @_ZN3FooC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %43 unwind label %91

43:                                               ; preds = %42
  %44 = load i32, ptr %3, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  %46 = getelementptr inbounds %class.Foo, ptr %14, i32 0, i32 2
  store i32 %45, ptr %46, align 4, !tbaa !11
  invoke void @_ZN3tbb16concurrent_queueI3FooE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %47 unwind label %95

47:                                               ; preds = %43
  call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #4
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !9
  br label %18, !llvm.loop !14

51:                                               ; preds = %37, %32, %26, %22
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %5, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %6, align 4
  br label %100

55:                                               ; preds = %23
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %5, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %6, align 4
  br label %63

59:                                               ; preds = %24
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %5, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  br label %63

63:                                               ; preds = %59, %55
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  br label %100

64:                                               ; preds = %28
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %5, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %6, align 4
  br label %72

68:                                               ; preds = %30
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %5, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %72

72:                                               ; preds = %68, %64
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  br label %100

73:                                               ; preds = %34
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  br label %81

77:                                               ; preds = %35
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %5, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  br label %81

81:                                               ; preds = %77, %73
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  br label %100

82:                                               ; preds = %38
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %5, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %6, align 4
  br label %90

86:                                               ; preds = %40
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %5, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  br label %90

90:                                               ; preds = %86, %82
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  br label %100

91:                                               ; preds = %42
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %5, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %6, align 4
  br label %99

95:                                               ; preds = %43
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %5, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %6, align 4
  call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #4
  br label %99

99:                                               ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #4
  br label %100

100:                                              ; preds = %99, %90, %81, %72, %63, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %125

101:                                              ; preds = %21
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %15, ptr noundef nonnull align 8 dereferenceable(40) %102)
          to label %103 unwind label %109

103:                                              ; preds = %101
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef %15)
          to label %104 unwind label %113

104:                                              ; preds = %103
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %16, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %105 unwind label %109

105:                                              ; preds = %104
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef %16)
          to label %106 unwind label %117

106:                                              ; preds = %105
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %17, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %107 unwind label %109

107:                                              ; preds = %106
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT0_(ptr noundef %17)
          to label %108 unwind label %121

108:                                              ; preds = %107
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %1) #4
  ret void

109:                                              ; preds = %106, %104, %101
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %5, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %6, align 4
  br label %125

113:                                              ; preds = %103
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %5, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #4
  br label %125

117:                                              ; preds = %105
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %5, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  br label %125

121:                                              ; preds = %107
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %5, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %6, align 4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  br label %125

125:                                              ; preds = %121, %117, %113, %109, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %1) #4
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %5, align 8
  %128 = load i32, ptr %6, align 4
  %129 = insertvalue { ptr, i32 } poison, ptr %127, 0
  %130 = insertvalue { ptr, i32 } %129, i32 %128, 1
  resume { ptr, i32 } %130
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind noalias writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT0_(ptr noundef) #1

; Function Attrs: nounwind
declare void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 #3 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS3Foo", !13, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!"_ZTS7state_t", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

%"class.tbb::concurrent_queue" = type { %"class.tbb::internal::concurrent_queue_base" }
%"class.tbb::internal::concurrent_queue_base" = type { ptr, ptr, i64, i64, i64 }
%"class.tbb::internal::concurrent_queue_iterator" = type { %"class.tbb::internal::concurrent_queue_iterator_base" }
%"class.tbb::internal::concurrent_queue_iterator_base" = type { ptr, ptr }
%class.Foo = type { i32, i32, i32 }

; 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: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3FooC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12TestIteratorv() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.tbb::concurrent_queue", align 8
  %2 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %3 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %4 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %5 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %6 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %7 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %8 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %9 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %10 = alloca %class.Foo, align 4
  %11 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %12 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  %13 = alloca %"class.tbb::internal::concurrent_queue_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %1) #4
  call void @_ZN3tbb16concurrent_queueI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %14 = getelementptr inbounds i8, ptr %10, i64 8
  br label %16

15:                                               ; preds = %31
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %59 unwind label %65

16:                                               ; preds = %0, %31
  %.02032 = phi i32 [ 0, %0 ], [ %30, %31 ]
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %2, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %17 unwind label %32

17:                                               ; preds = %16
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %18 unwind label %34

18:                                               ; preds = %17
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %.02032)
          to label %19 unwind label %36

19:                                               ; preds = %18
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %20 unwind label %32

20:                                               ; preds = %19
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %21 unwind label %39

21:                                               ; preds = %20
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef %.02032)
          to label %22 unwind label %41

22:                                               ; preds = %21
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %23 unwind label %32

23:                                               ; preds = %22
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %24 unwind label %44

24:                                               ; preds = %23
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef %.02032)
          to label %25 unwind label %46

25:                                               ; preds = %24
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %26 unwind label %32

26:                                               ; preds = %25
  invoke void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %9, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %27 unwind label %49

27:                                               ; preds = %26
  invoke void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef %.02032)
          to label %28 unwind label %51

28:                                               ; preds = %27
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #4
  invoke void @_ZN3FooC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %10)
          to label %29 unwind label %54

29:                                               ; preds = %28
  %30 = add nuw nsw i32 %.02032, 1
  store i32 %30, ptr %14, align 4, !tbaa !5
  invoke void @_ZN3tbb16concurrent_queueI3FooE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 4 dereferenceable(12) %10)
          to label %31 unwind label %56

31:                                               ; preds = %29
  call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  %exitcond.not = icmp eq i32 %30, 500
  br i1 %exitcond.not, label %15, label %16, !llvm.loop !11

32:                                               ; preds = %25, %22, %19, %16
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %73

34:                                               ; preds = %17
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %38

36:                                               ; preds = %18
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  br label %38

38:                                               ; preds = %36, %34
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %35, %34 ]
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #4
  br label %73

39:                                               ; preds = %20
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %43

41:                                               ; preds = %21
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #4
  br label %43

43:                                               ; preds = %41, %39
  %.pn22 = phi { ptr, i32 } [ %42, %41 ], [ %40, %39 ]
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  br label %73

44:                                               ; preds = %23
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %48

46:                                               ; preds = %24
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  br label %48

48:                                               ; preds = %46, %44
  %.pn24 = phi { ptr, i32 } [ %47, %46 ], [ %45, %44 ]
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  br label %73

49:                                               ; preds = %26
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %53

51:                                               ; preds = %27
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %53

53:                                               ; preds = %51, %49
  %.pn26 = phi { ptr, i32 } [ %52, %51 ], [ %50, %49 ]
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  br label %73

54:                                               ; preds = %28
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %58

56:                                               ; preds = %29
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #4
  br label %58

58:                                               ; preds = %56, %54
  %.pn28 = phi { ptr, i32 } [ %57, %56 ], [ %55, %54 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  br label %73

59:                                               ; preds = %15
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef nonnull %11)
          to label %60 unwind label %67

60:                                               ; preds = %59
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %61 unwind label %65

61:                                               ; preds = %60
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef nonnull %12)
          to label %62 unwind label %69

62:                                               ; preds = %61
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  invoke void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8 %13, ptr noundef nonnull align 8 dereferenceable(40) %1)
          to label %63 unwind label %65

63:                                               ; preds = %62
  invoke void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT0_(ptr noundef nonnull %13)
          to label %64 unwind label %71

64:                                               ; preds = %63
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  call void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #4
  ret void

65:                                               ; preds = %62, %60, %15
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %73

67:                                               ; preds = %59
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  br label %73

69:                                               ; preds = %61
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  br label %73

71:                                               ; preds = %63
  %72 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  br label %73

73:                                               ; preds = %32, %38, %43, %48, %53, %58, %71, %69, %67, %65
  %.pn28.pn.pn = phi { ptr, i32 } [ %72, %71 ], [ %66, %65 ], [ %70, %69 ], [ %68, %67 ], [ %.pn28, %58 ], [ %.pn26, %53 ], [ %33, %32 ], [ %.pn24, %48 ], [ %.pn22, %43 ], [ %.pn, %38 ]
  call void @_ZN3tbb16concurrent_queueI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #4
  resume { ptr, i32 } %.pn28.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z15TestIteratorAuxIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT_T0_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb16concurrent_queueI3FooE3endEv(ptr dead_on_unwind noalias writable sret(%"class.tbb::internal::concurrent_queue_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEEKS4_EENS2_IS5_S4_EEEvT0_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22TestIteratorAssignmentIN3tbb8internal25concurrent_queue_iteratorINS0_16concurrent_queueI3FooEES4_EES6_EvT0_(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 #3 = { 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 = { 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, !10, i64 8}
!6 = !{!"_ZTS3Foo", !7, i64 0, !10, i64 4, !10, i64 8}
!7 = !{!"_ZTS7state_t", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass