; LLVM IR from NVIDIA/DALI :: dali/operators/math/expressions (broadcasting)

; 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.dali::span" = type { ptr, i64 }
%"class.dali::span.7" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__._ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28)) #2 align 2

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

; 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) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4dali4expr13BroadcastNdimENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr, i64) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4dali15TensorListShapeILin1EE10sample_dimEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE17tensor_shape_spanEl(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr %0, i64 %1) #2 {
  %3 = alloca i1, align 1
  %4 = alloca %"class.dali::span", align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.dali::span", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.dali::span.7", align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = getelementptr inbounds { ptr, i64 }, ptr %4, i32 0, i32 0
  store ptr %0, ptr %17, align 8
  %18 = getelementptr inbounds { ptr, i64 }, ptr %4, i32 0, i32 1
  store i64 %1, ptr %18, align 8
  %19 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  %20 = icmp slt i64 %19, 2
  br i1 %20, label %21, label %22

21:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %140

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %4, i64 16, i1 false), !tbaa.struct !5
  %23 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8
  %25 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 1
  %26 = load i64, ptr %25, align 8
  %27 = call noundef i32 @_ZN4dali4expr13BroadcastNdimENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr %24, i64 %26)
  store i32 %27, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef 0)
  %29 = load ptr, ptr %28, align 8, !tbaa !6
  %30 = call noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28) %29)
  store i32 %30, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !12
  br label %31

31:                                               ; preds = %49, %22
  %32 = load i32, ptr %8, align 4, !tbaa !12
  %33 = sext i32 %32 to i64
  %34 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %52

37:                                               ; preds = %31
  %38 = load i32, ptr %7, align 4, !tbaa !12
  %39 = load i32, ptr %8, align 4, !tbaa !12
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %40)
  %42 = load ptr, ptr %41, align 8, !tbaa !6
  %43 = call noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28) %42)
  %44 = icmp eq i32 %38, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %37
  br label %48

46:                                               ; preds = %37
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.17, i32 noundef 201, ptr noundef @__PRETTY_FUNCTION__._ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE) #6
  unreachable

47:                                               ; No predecessors!
  br label %48

48:                                               ; preds = %47, %45
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %8, align 4, !tbaa !12
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %8, align 4, !tbaa !12
  br label %31, !llvm.loop !14

52:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !12
  br label %53

53:                                               ; preds = %133, %52
  %54 = load i32, ptr %9, align 4, !tbaa !12
  %55 = load i32, ptr %7, align 4, !tbaa !12
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 5, ptr %10, align 4
  br label %136

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !12
  br label %59

59:                                               ; preds = %127, %58
  %60 = load i32, ptr %11, align 4, !tbaa !12
  %61 = load i32, ptr %5, align 4, !tbaa !12
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 8, ptr %10, align 4
  br label %130

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -1, ptr %12, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %65

65:                                               ; preds = %118, %64
  %66 = load i32, ptr %13, align 4, !tbaa !12
  %67 = sext i32 %66 to i64
  %68 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  %69 = icmp slt i64 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %65
  store i32 11, ptr %10, align 4
  br label %121

71:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %72 = load i32, ptr %13, align 4, !tbaa !12
  %73 = sext i32 %72 to i64
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %73)
  %75 = load ptr, ptr %74, align 8, !tbaa !6
  %76 = load i32, ptr %9, align 4, !tbaa !12
  %77 = sext i32 %76 to i64
  %78 = call { ptr, i64 } @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE17tensor_shape_spanEl(ptr noundef nonnull align 8 dereferenceable(28) %75, i64 noundef %77)
  %79 = getelementptr inbounds { ptr, i64 }, ptr %14, i32 0, i32 0
  %80 = extractvalue { ptr, i64 } %78, 0
  store ptr %80, ptr %79, align 8
  %81 = getelementptr inbounds { ptr, i64 }, ptr %14, i32 0, i32 1
  %82 = extractvalue { ptr, i64 } %78, 1
  store i64 %82, ptr %81, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %83 = load i32, ptr %13, align 4, !tbaa !12
  %84 = sext i32 %83 to i64
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %84)
  %86 = load ptr, ptr %85, align 8, !tbaa !6
  %87 = call noundef i32 @_ZNK4dali15TensorListShapeILin1EE10sample_dimEv(ptr noundef nonnull align 8 dereferenceable(32) %86)
  store i32 %87, ptr %15, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %88 = load i32, ptr %11, align 4, !tbaa !12
  %89 = load i32, ptr %15, align 4, !tbaa !12
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %91, label %99

91:                                               ; preds = %71
  %92 = load i32, ptr %15, align 4, !tbaa !12
  %93 = sub nsw i32 %92, 1
  %94 = load i32, ptr %11, align 4, !tbaa !12
  %95 = sub nsw i32 %93, %94
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIKlLln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %14, i64 noundef %96)
  %98 = load i64, ptr %97, align 8, !tbaa !10
  br label %100

99:                                               ; preds = %71
  br label %100

100:                                              ; preds = %99, %91
  %101 = phi i64 [ %98, %91 ], [ 1, %99 ]
  store i64 %101, ptr %16, align 8, !tbaa !10
  %102 = load i32, ptr %12, align 4, !tbaa !12
  %103 = icmp eq i32 %102, -1
  br i1 %103, label %104, label %107

104:                                              ; preds = %100
  %105 = load i64, ptr %16, align 8, !tbaa !10
  %106 = trunc i64 %105 to i32
  store i32 %106, ptr %12, align 4, !tbaa !12
  br label %114

107:                                              ; preds = %100
  %108 = load i32, ptr %12, align 4, !tbaa !12
  %109 = sext i32 %108 to i64
  %110 = load i64, ptr %16, align 8, !tbaa !10
  %111 = icmp ne i64 %109, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %107
  store i1 true, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %115

113:                                              ; preds = %107
  br label %114

114:                                              ; preds = %113, %104
  store i32 0, ptr %10, align 4
  br label %115

115:                                              ; preds = %114, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  %116 = load i32, ptr %10, align 4
  switch i32 %116, label %121 [
    i32 0, label %117
  ]

117:                                              ; preds = %115
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %13, align 4, !tbaa !12
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %13, align 4, !tbaa !12
  br label %65, !llvm.loop !16

121:                                              ; preds = %115, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %122 = load i32, ptr %10, align 4
  switch i32 %122, label %124 [
    i32 11, label %123
  ]

123:                                              ; preds = %121
  store i32 0, ptr %10, align 4
  br label %124

124:                                              ; preds = %123, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %125 = load i32, ptr %10, align 4
  switch i32 %125, label %130 [
    i32 0, label %126
  ]

126:                                              ; preds = %124
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %11, align 4, !tbaa !12
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %11, align 4, !tbaa !12
  br label %59, !llvm.loop !17

130:                                              ; preds = %124, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %131 = load i32, ptr %10, align 4
  switch i32 %131, label %136 [
    i32 8, label %132
  ]

132:                                              ; preds = %130
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %9, align 4, !tbaa !12
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %9, align 4, !tbaa !12
  br label %53, !llvm.loop !18

136:                                              ; preds = %130, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %137 = load i32, ptr %10, align 4
  switch i32 %137, label %139 [
    i32 5, label %138
  ]

138:                                              ; preds = %136
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %139

139:                                              ; preds = %138, %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %140

140:                                              ; preds = %139, %21
  %141 = load i1, ptr %3, align 1
  ret i1 %141
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIKlLln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #0 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{i64 0, i64 8, !6, i64 8, i64 8, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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.dali::span" = type { ptr, i64 }
%"class.dali::span.7" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__._ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4dali4expr13BroadcastNdimENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4dali15TensorListShapeILin1EE10sample_dimEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE17tensor_shape_spanEl(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr %0, i64 %1) local_unnamed_addr #2 {
  %3 = alloca %"class.dali::span", align 8
  %4 = alloca %"class.dali::span.7", align 8
  store ptr %0, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 %1, ptr %5, align 8
  %6 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  %7 = icmp slt i64 %6, 2
  br i1 %7, label %.critedge52, label %8

8:                                                ; preds = %2
  %.sroa.0.0.copyload = load ptr, ptr %3, align 8, !tbaa !5
  %.sroa.2.0.copyload = load i64, ptr %5, align 8, !tbaa !9
  %9 = call noundef i32 @_ZN4dali4expr13BroadcastNdimENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE(ptr %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %3, i64 noundef 0)
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = call noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28) %11)
  %13 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  %14 = icmp sgt i64 %13, 1
  br i1 %14, label %.lr.ph, label %.preheader57

15:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  %17 = icmp sgt i64 %16, %indvars.iv.next
  br i1 %17, label %.lr.ph, label %.preheader57, !llvm.loop !11

.preheader57:                                     ; preds = %15, %8
  %.not4765 = icmp sgt i32 %12, 0
  br i1 %.not4765, label %.preheader56.lr.ph, label %.critedge52

.preheader56.lr.ph:                               ; preds = %.preheader57
  %.not4863 = icmp sgt i32 %9, 0
  %18 = getelementptr inbounds i8, ptr %4, i64 8
  br i1 %.not4863, label %.preheader56.us.preheader, label %.critedge52

.preheader56.us.preheader:                        ; preds = %.preheader56.lr.ph
  %wide.trip.count = zext nneg i32 %12 to i64
  br label %.preheader56.us

.preheader56.us:                                  ; preds = %.preheader56.us.preheader, %..critedge50.loopexit_crit_edge.us
  %indvars.iv77 = phi i64 [ 0, %.preheader56.us.preheader ], [ %indvars.iv.next78, %..critedge50.loopexit_crit_edge.us ]
  br label %.preheader.us

.critedge.us:                                     ; preds = %41, %.preheader.us
  %19 = add nuw nsw i32 %.03764.us, 1
  %exitcond.not = icmp eq i32 %19, %9
  br i1 %exitcond.not, label %..critedge50.loopexit_crit_edge.us, label %.preheader.us, !llvm.loop !13

20:                                               ; preds = %.lr.ph62.us, %41
  %indvars.iv74 = phi i64 [ 0, %.lr.ph62.us ], [ %indvars.iv.next75, %41 ]
  %.03460.us = phi i32 [ -1, %.lr.ph62.us ], [ %.23655.us, %41 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %3, i64 noundef %indvars.iv74)
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = call { ptr, i64 } @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE17tensor_shape_spanEl(ptr noundef nonnull align 8 dereferenceable(28) %22, i64 noundef %indvars.iv77)
  %24 = extractvalue { ptr, i64 } %23, 0
  store ptr %24, ptr %4, align 8
  %25 = extractvalue { ptr, i64 } %23, 1
  store i64 %25, ptr %18, align 8
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %3, i64 noundef %indvars.iv74)
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = call noundef i32 @_ZNK4dali15TensorListShapeILin1EE10sample_dimEv(ptr noundef nonnull align 8 dereferenceable(32) %27)
  %29 = icmp slt i32 %.03764.us, %28
  br i1 %29, label %30, label %35

30:                                               ; preds = %20
  %31 = add i32 %28, %44
  %32 = sext i32 %31 to i64
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIKlLln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %32)
  %34 = load i64, ptr %33, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %30, %20
  %36 = phi i64 [ %34, %30 ], [ 1, %20 ]
  %37 = icmp eq i32 %.03460.us, -1
  br i1 %37, label %.thread.us, label %38

38:                                               ; preds = %35
  %39 = sext i32 %.03460.us to i64
  %.not.us = icmp eq i64 %36, %39
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br i1 %.not.us, label %41, label %.critedge52

.thread.us:                                       ; preds = %35
  %40 = trunc i64 %36 to i32
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %41

41:                                               ; preds = %.thread.us, %38
  %.23655.us = phi i32 [ %40, %.thread.us ], [ %.03460.us, %38 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %42 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  %.not46.us = icmp sgt i64 %42, %indvars.iv.next75
  br i1 %.not46.us, label %20, label %.critedge.us, !llvm.loop !14

.preheader.us:                                    ; preds = %.preheader56.us, %.critedge.us
  %.03764.us = phi i32 [ 0, %.preheader56.us ], [ %19, %.critedge.us ]
  %43 = call noundef i64 @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  %.not4659.us = icmp sgt i64 %43, 0
  br i1 %.not4659.us, label %.lr.ph62.us, label %.critedge.us

.lr.ph62.us:                                      ; preds = %.preheader.us
  %44 = xor i32 %.03764.us, -1
  br label %20

..critedge50.loopexit_crit_edge.us:               ; preds = %.critedge.us
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count
  br i1 %exitcond80.not, label %.critedge52, label %.preheader56.us, !llvm.loop !15

.lr.ph:                                           ; preds = %8, %15
  %indvars.iv = phi i64 [ %indvars.iv.next, %15 ], [ 1, %8 ]
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIPKNS_15TensorListShapeILin1EEELln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16) %3, i64 noundef %indvars.iv)
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = call noundef i32 @_ZNK4dali19TensorListShapeBaseINS_15TensorListShapeILin1EEELin1EE11num_samplesEv(ptr noundef nonnull align 8 dereferenceable(28) %46)
  %48 = icmp eq i32 %12, %47
  br i1 %48, label %15, label %49

49:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.17, i32 noundef 201, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4dali4expr16NeedBroadcastingENS_4spanIPKNS_15TensorListShapeILin1EEELln1EEE) #5
  unreachable

.critedge52:                                      ; preds = %..critedge50.loopexit_crit_edge.us, %38, %.preheader56.lr.ph, %.preheader57, %2
  %.8 = phi i1 [ false, %2 ], [ false, %.preheader57 ], [ false, %.preheader56.lr.ph ], [ true, %38 ], [ false, %..critedge50.loopexit_crit_edge.us ]
  ret i1 %.8
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4dali4spanIKlLln1EEixEl(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { noreturn 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 }
attributes #5 = { noreturn 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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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