; LLVM IR from dpt/Containers :: libraries/datastruct/hash (walk-cont)

; 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.hash = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr }
%struct.hash__node = type { ptr, %struct.item }
%struct.item = type { ptr, i64, ptr }

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@__PRETTY_FUNCTION__.hash_walk_continuation = external hidden unnamed_addr constant [81 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @hash_walk_continuation(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr null, ptr %16, align 8, !tbaa !5
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp eq i32 %18, -1
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  store i64 120, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

21:                                               ; preds = %5
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = and i32 %22, -65536
  %24 = lshr i32 %23, 16
  store i32 %24, ptr %12, align 4, !tbaa !9
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = and i32 %25, 65535
  %27 = lshr i32 %26, 0
  store i32 %27, ptr %13, align 4, !tbaa !9
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.hash, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = icmp uge i32 %28, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %21
  store i64 121, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

34:                                               ; preds = %21
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %58

37:                                               ; preds = %34
  br label %38

38:                                               ; preds = %47, %37
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.hash, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %41, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %50

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

50:                                               ; preds = %38
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.hash, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !11
  %55 = icmp eq i32 %51, %54
  br i1 %55, label %56, label %57

56:                                               ; preds = %50
  store i64 120, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

57:                                               ; preds = %50
  br label %58

58:                                               ; preds = %57, %34
  store i32 0, ptr %14, align 4, !tbaa !9
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.hash, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %61, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  store ptr %65, ptr %15, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %80, %58
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %82

69:                                               ; preds = %66
  %70 = load ptr, ptr %15, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hash__node, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !16
  store ptr %72, ptr %16, align 8, !tbaa !5
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  br label %82

77:                                               ; preds = %69
  %78 = load i32, ptr %14, align 4, !tbaa !9
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %14, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %77
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %81, ptr %15, align 8, !tbaa !5
  br label %66, !llvm.loop !20

82:                                               ; preds = %76, %66
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %82
  store i64 121, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

86:                                               ; preds = %82
  %87 = load ptr, ptr %15, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.hash__node, ptr %87, i32 0, i32 1
  %89 = getelementptr inbounds %struct.item, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !21
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %90, ptr %91, align 8, !tbaa !5
  %92 = load ptr, ptr %15, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.hash__node, ptr %92, i32 0, i32 1
  %94 = getelementptr inbounds %struct.item, ptr %93, i32 0, i32 2
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %95, ptr %96, align 8, !tbaa !5
  %97 = load i32, ptr %14, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  %99 = icmp sle i32 %98, 65535
  br i1 %99, label %100, label %101

100:                                              ; preds = %86
  br label %102

101:                                              ; preds = %86
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__.hash_walk_continuation) #4
  unreachable

102:                                              ; preds = %100
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %112

105:                                              ; preds = %102
  %106 = load i32, ptr %12, align 4, !tbaa !9
  %107 = shl i32 %106, 16
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  %110 = or i32 %107, %109
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %110, ptr %111, align 4, !tbaa !9
  store i64 0, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

112:                                              ; preds = %102
  br label %113

113:                                              ; preds = %133, %112
  %114 = load i32, ptr %12, align 4, !tbaa !9
  %115 = add i32 %114, 1
  store i32 %115, ptr %12, align 4, !tbaa !9
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.hash, ptr %116, i32 0, i32 1
  %118 = load i32, ptr %117, align 8, !tbaa !11
  %119 = icmp ult i32 %115, %118
  br i1 %119, label %120, label %134

120:                                              ; preds = %113
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.hash, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !13
  %124 = load i32, ptr %12, align 4, !tbaa !9
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds ptr, ptr %123, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %133

129:                                              ; preds = %120
  %130 = load i32, ptr %12, align 4, !tbaa !9
  %131 = shl i32 %130, 16
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %131, ptr %132, align 4, !tbaa !9
  store i64 0, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

133:                                              ; preds = %120
  br label %113, !llvm.loop !23

134:                                              ; preds = %113
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -1, ptr %135, align 4, !tbaa !9
  store i64 0, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %136

136:                                              ; preds = %134, %129, %105, %85, %56, %33, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  %137 = load i64, ptr %6, align 8
  ret i64 %137
}

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }
attributes #4 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"hash", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 0}
!17 = !{!"hash__node", !6, i64 0, !18, i64 8}
!18 = !{!"item", !6, i64 0, !19, i64 8, !6, i64 16}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !15}
!21 = !{!17, !6, i64 8}
!22 = !{!17, !6, i64 24}
!23 = distinct !{!23, !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"

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@__PRETTY_FUNCTION__.hash_walk_continuation = external hidden unnamed_addr constant [81 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 122) i64 @hash_walk_continuation(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = icmp eq i32 %1, -1
  br i1 %6, label %.thread, label %7

7:                                                ; preds = %5
  %8 = lshr i32 %1, 16
  %9 = and i32 %1, 65535
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %.not = icmp ult i32 %8, %11
  br i1 %.not, label %12, label %.thread

12:                                               ; preds = %7
  %13 = icmp eq i32 %1, 0
  %.pre = load ptr, ptr %0, align 8, !tbaa !11
  br i1 %13, label %.preheader49, label %21

.preheader49:                                     ; preds = %12, %.preheader49
  %.039 = phi i32 [ %18, %.preheader49 ], [ 0, %12 ]
  %14 = zext i32 %.039 to i64
  %15 = getelementptr inbounds ptr, ptr %.pre, i64 %14
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %17 = icmp eq ptr %16, null
  %18 = add i32 %.039, 1
  br i1 %17, label %.preheader49, label %19, !llvm.loop !13

19:                                               ; preds = %.preheader49
  %20 = icmp eq i32 %.039, %11
  br i1 %20, label %.thread, label %.lr.ph.preheader

21:                                               ; preds = %12
  %.phi.trans.insert = zext nneg i32 %8 to i64
  %.phi.trans.insert60 = getelementptr inbounds ptr, ptr %.pre, i64 %.phi.trans.insert
  %.pre61 = load ptr, ptr %.phi.trans.insert60, align 8, !tbaa !12
  %.not4553 = icmp eq ptr %.pre61, null
  br i1 %.not4553, label %.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %19, %21
  %.14066 = phi i32 [ %8, %21 ], [ %.039, %19 ]
  %22 = phi ptr [ %.pre61, %21 ], [ %16, %19 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %25
  %.03655 = phi ptr [ %23, %25 ], [ %22, %.lr.ph.preheader ]
  %.03754 = phi i32 [ %26, %25 ], [ 0, %.lr.ph.preheader ]
  %23 = load ptr, ptr %.03655, align 8, !tbaa !15
  %24 = icmp eq i32 %.03754, %9
  br i1 %24, label %27, label %25

25:                                               ; preds = %.lr.ph
  %26 = add nuw nsw i32 %.03754, 1
  %.not45 = icmp eq ptr %23, null
  br i1 %.not45, label %.thread, label %.lr.ph, !llvm.loop !19

27:                                               ; preds = %.lr.ph
  %28 = getelementptr inbounds i8, ptr %.03655, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !20
  store ptr %29, ptr %3, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %.03655, i64 24
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  store ptr %31, ptr %4, align 8, !tbaa !12
  %32 = add nuw nsw i32 %9, 1
  %.not62 = icmp eq i32 %9, 65535
  br i1 %.not62, label %33, label %34

33:                                               ; preds = %27
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 73, ptr noundef nonnull @__PRETTY_FUNCTION__.hash_walk_continuation) #2
  unreachable

34:                                               ; preds = %27
  %.not46 = icmp eq ptr %23, null
  br i1 %.not46, label %.preheader, label %35

35:                                               ; preds = %34
  %36 = shl i32 %.14066, 16
  %37 = or i32 %32, %36
  br label %.thread.sink.split

.preheader:                                       ; preds = %34, %40
  %.2 = phi i32 [ %38, %40 ], [ %.14066, %34 ]
  %38 = add i32 %.2, 1
  %39 = icmp ult i32 %38, %11
  br i1 %39, label %40, label %.thread.sink.split

40:                                               ; preds = %.preheader
  %41 = load ptr, ptr %0, align 8, !tbaa !11
  %42 = zext i32 %38 to i64
  %43 = getelementptr inbounds ptr, ptr %41, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %.not47 = icmp eq ptr %44, null
  br i1 %.not47, label %.preheader, label %45, !llvm.loop !22

45:                                               ; preds = %40
  %46 = shl i32 %38, 16
  br label %.thread.sink.split

.thread.sink.split:                               ; preds = %.preheader, %35, %45
  %.sink = phi i32 [ %46, %45 ], [ %37, %35 ], [ -1, %.preheader ]
  store i32 %.sink, ptr %2, align 4, !tbaa !23
  br label %.thread

.thread:                                          ; preds = %25, %.thread.sink.split, %21, %19, %7, %5
  %.038 = phi i64 [ 120, %5 ], [ 121, %7 ], [ 120, %19 ], [ 121, %21 ], [ 0, %.thread.sink.split ], [ 121, %25 ]
  ret i64 %.038
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 = { 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 #2 = { 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, !10, i64 8}
!6 = !{!"hash", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !7, i64 0}
!16 = !{!"hash__node", !7, i64 0, !17, i64 8}
!17 = !{!"item", !7, i64 0, !18, i64 8, !7, i64 16}
!18 = !{!"long", !8, i64 0}
!19 = distinct !{!19, !14}
!20 = !{!16, !7, i64 8}
!21 = !{!16, !7, i64 24}
!22 = distinct !{!22, !14}
!23 = !{!10, !10, i64 0}


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