; LLVM IR from NervanaSystems/ngraph :: src/ngraph/partial_shape.ll (ZNK6ngraph12PartialShape7relaxesERKS0_)

; 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.ngraph::Dimension" = type { %"class.ngraph::Interval" }
%"class.ngraph::Interval" = type { i64, i64 }

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

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

; 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 noundef zeroext i1 @_ZNK6ngraph9Dimension10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

declare noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6ngraph9Dimension9is_staticEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6ngraph12PartialShape7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.ngraph::Dimension", align 8
  %7 = alloca %"class.ngraph::Dimension", align 8
  %8 = alloca %"class.ngraph::Dimension", align 8
  %9 = alloca %"class.ngraph::Dimension", align 8
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  %12 = alloca %"class.ngraph::Dimension", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %14 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %15 = getelementptr inbounds %"class.ngraph::Dimension", ptr %6, i32 0, i32 0
  %16 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %17 = extractvalue { i64, i64 } %14, 0
  store i64 %17, ptr %16, align 8
  %18 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %19 = extractvalue { i64, i64 } %14, 1
  store i64 %19, ptr %18, align 8
  %20 = call noundef zeroext i1 @_ZNK6ngraph9Dimension10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  br i1 %20, label %21, label %22

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

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %23)
  %25 = getelementptr inbounds %"class.ngraph::Dimension", ptr %7, i32 0, i32 0
  %26 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 0
  %27 = extractvalue { i64, i64 } %24, 0
  store i64 %27, ptr %26, align 8
  %28 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 1
  %29 = extractvalue { i64, i64 } %24, 1
  store i64 %29, ptr %28, align 8
  %30 = call noundef zeroext i1 @_ZNK6ngraph9Dimension9is_staticEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  br i1 %30, label %31, label %48

31:                                               ; preds = %22
  %32 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %33 = getelementptr inbounds %"class.ngraph::Dimension", ptr %8, i32 0, i32 0
  %34 = getelementptr inbounds { i64, i64 }, ptr %33, i32 0, i32 0
  %35 = extractvalue { i64, i64 } %32, 0
  store i64 %35, ptr %34, align 8
  %36 = getelementptr inbounds { i64, i64 }, ptr %33, i32 0, i32 1
  %37 = extractvalue { i64, i64 } %32, 1
  store i64 %37, ptr %36, align 8
  %38 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %39)
  %41 = getelementptr inbounds %"class.ngraph::Dimension", ptr %9, i32 0, i32 0
  %42 = getelementptr inbounds { i64, i64 }, ptr %41, i32 0, i32 0
  %43 = extractvalue { i64, i64 } %40, 0
  store i64 %43, ptr %42, align 8
  %44 = getelementptr inbounds { i64, i64 }, ptr %41, i32 0, i32 1
  %45 = extractvalue { i64, i64 } %40, 1
  store i64 %45, ptr %44, align 8
  %46 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
  %47 = icmp eq i64 %38, %46
  br label %48

48:                                               ; preds = %31, %22
  %49 = phi i1 [ false, %22 ], [ %47, %31 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  br i1 %49, label %50, label %82

50:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  store i8 1, ptr %10, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %76, %50
  %52 = load i64, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #3
  %53 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %54 = getelementptr inbounds %"class.ngraph::Dimension", ptr %12, i32 0, i32 0
  %55 = getelementptr inbounds { i64, i64 }, ptr %54, i32 0, i32 0
  %56 = extractvalue { i64, i64 } %53, 0
  store i64 %56, ptr %55, align 8
  %57 = getelementptr inbounds { i64, i64 }, ptr %54, i32 0, i32 1
  %58 = extractvalue { i64, i64 } %53, 1
  store i64 %58, ptr %57, align 8
  %59 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %60 = icmp ult i64 %52, %59
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #3
  br i1 %60, label %62, label %61

61:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %79

62:                                               ; preds = %51
  %63 = load i64, ptr %11, align 8, !tbaa !11
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32) %13, i64 noundef %63)
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i64, ptr %11, align 8, !tbaa !11
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32) %65, i64 noundef %66)
  %68 = call noundef zeroext i1 @_ZNK6ngraph9Dimension7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %64, ptr noundef nonnull align 8 dereferenceable(16) %67)
  %69 = zext i1 %68 to i32
  %70 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %71 = trunc i8 %70 to i1
  %72 = zext i1 %71 to i32
  %73 = and i32 %72, %69
  %74 = icmp ne i32 %73, 0
  %75 = zext i1 %74 to i8
  store i8 %75, ptr %10, align 1, !tbaa !9
  br label %76

76:                                               ; preds = %62
  %77 = load i64, ptr %11, align 8, !tbaa !11
  %78 = add i64 %77, 1
  store i64 %78, ptr %11, align 8, !tbaa !11
  br label %51, !llvm.loop !15

79:                                               ; preds = %61
  %80 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %81 = trunc i8 %80 to i1
  store i1 %81, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  br label %83

82:                                               ; preds = %48
  store i1 false, ptr %3, align 1
  br label %83

83:                                               ; preds = %82, %79, %21
  %84 = load i1, ptr %3, align 1
  ret i1 %84
}

declare noundef zeroext i1 @_ZNK6ngraph9Dimension7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"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.ngraph::Dimension" = type { %"class.ngraph::Interval" }
%"class.ngraph::Interval" = type { i64, i64 }

; 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 uwtable
declare dso_local { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; 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 noundef zeroext i1 @_ZNK6ngraph9Dimension10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

declare noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6ngraph9Dimension9is_staticEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6ngraph12PartialShape7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.ngraph::Dimension", align 8
  %4 = alloca %"class.ngraph::Dimension", align 8
  %5 = alloca %"class.ngraph::Dimension", align 8
  %6 = alloca %"class.ngraph::Dimension", align 8
  %7 = alloca %"class.ngraph::Dimension", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  %8 = tail call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %9 = extractvalue { i64, i64 } %8, 0
  store i64 %9, ptr %3, align 8
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  %11 = extractvalue { i64, i64 } %8, 1
  store i64 %11, ptr %10, align 8
  %12 = call noundef zeroext i1 @_ZNK6ngraph9Dimension10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  br i1 %12, label %.loopexit, label %13

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %14 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %15 = extractvalue { i64, i64 } %14, 0
  store i64 %15, ptr %4, align 8
  %16 = getelementptr inbounds i8, ptr %4, i64 8
  %17 = extractvalue { i64, i64 } %14, 1
  store i64 %17, ptr %16, align 8
  %18 = call noundef zeroext i1 @_ZNK6ngraph9Dimension9is_staticEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  br i1 %18, label %19, label %.critedge

19:                                               ; preds = %13
  %20 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %21 = extractvalue { i64, i64 } %20, 0
  store i64 %21, ptr %5, align 8
  %22 = getelementptr inbounds i8, ptr %5, i64 8
  %23 = extractvalue { i64, i64 } %20, 1
  store i64 %23, ptr %22, align 8
  %24 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %25 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %26 = extractvalue { i64, i64 } %25, 0
  store i64 %26, ptr %6, align 8
  %27 = getelementptr inbounds i8, ptr %6, i64 8
  %28 = extractvalue { i64, i64 } %25, 1
  store i64 %28, ptr %27, align 8
  %29 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %30 = icmp eq i64 %24, %29
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  br i1 %30, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  %31 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %32 = extractvalue { i64, i64 } %31, 0
  store i64 %32, ptr %7, align 8
  %33 = getelementptr inbounds i8, ptr %7, i64 8
  %34 = extractvalue { i64, i64 } %31, 1
  store i64 %34, ptr %33, align 8
  %35 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %.not = icmp eq i64 %35, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.013 = phi i64 [ %40, %.lr.ph ], [ 0, %.preheader ]
  %.01012 = phi i1 [ %39, %.lr.ph ], [ true, %.preheader ]
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.013)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6ngraph12PartialShapeixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %.013)
  %38 = call noundef zeroext i1 @_ZNK6ngraph9Dimension7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(16) %37)
  %39 = and i1 %.01012, %38
  %40 = add nuw i64 %.013, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  %41 = call { i64, i64 } @_ZNK6ngraph12PartialShape4rankEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %42 = extractvalue { i64, i64 } %41, 0
  store i64 %42, ptr %7, align 8
  %43 = extractvalue { i64, i64 } %41, 1
  store i64 %43, ptr %33, align 8
  %44 = call noundef i64 @_ZNK6ngraph9Dimension10get_lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %45 = icmp ult i64 %40, %44
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  br i1 %45, label %.lr.ph, label %.loopexit, !llvm.loop !5

.critedge:                                        ; preds = %13
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %19, %.critedge, %2
  %.011 = phi i1 [ true, %2 ], [ false, %.critedge ], [ false, %19 ], [ true, %.preheader ], [ %39, %.lr.ph ]
  ret i1 %.011
}

declare noundef zeroext i1 @_ZNK6ngraph9Dimension7relaxesERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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