; LLVM IR from lionsoul2014/friso :: src (friso_hash)

; 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.friso_hash_cdt = type { i32, i32, float, i32, ptr }
%struct.hash_entry = type { ptr, ptr, ptr }

; 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: inlinehint nounwind uwtable
declare hidden i32 @hash(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

13:                                               ; preds = %2
  br label %20

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.friso_hash_cdt, ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = call i32 @hash(ptr noundef %15, i32 noundef %18)
  br label %20

20:                                               ; preds = %14, %13
  %21 = phi i32 [ 0, %13 ], [ %19, %14 ]
  store i32 %21, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.friso_hash_cdt, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = load i32, ptr %6, align 4, !tbaa !13
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds ptr, ptr %24, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  store ptr %28, ptr %7, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %80, %20
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %85

32:                                               ; preds = %29
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.hash_entry, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = icmp eq ptr %33, %36
  br i1 %37, label %53, label %38

38:                                               ; preds = %32
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %79

41:                                               ; preds = %38
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.hash_entry, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %79

46:                                               ; preds = %41
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.hash_entry, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = call i32 @strcmp(ptr noundef %47, ptr noundef %50) #5
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %79

53:                                               ; preds = %46, %32
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %54, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %67

57:                                               ; preds = %53
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hash_entry, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.friso_hash_cdt, ptr %61, i32 0, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %64 = load i32, ptr %6, align 4, !tbaa !13
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds ptr, ptr %63, i64 %65
  store ptr %60, ptr %66, align 8, !tbaa !5
  br label %73

67:                                               ; preds = %53
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.hash_entry, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.hash_entry, ptr %71, i32 0, i32 2
  store ptr %70, ptr %72, align 8, !tbaa !17
  br label %73

73:                                               ; preds = %67, %57
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.friso_hash_cdt, ptr %74, i32 0, i32 1
  %76 = load i32, ptr %75, align 4, !tbaa !18
  %77 = add i32 %76, -1
  store i32 %77, ptr %75, align 4, !tbaa !18
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %78, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %86

79:                                               ; preds = %46, %41, %38
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %81, ptr %8, align 8, !tbaa !5
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.hash_entry, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  store ptr %84, ptr %7, align 8, !tbaa !5
  br label %29, !llvm.loop !19

85:                                               ; preds = %29
  store ptr null, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %86

86:                                               ; preds = %85, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %87 = load ptr, ptr %3, align 8
  ret ptr %87
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind willreturn memory(read) "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 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !12, i64 8, !11, i64 12, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!16, !6, i64 0}
!16 = !{!"hash_entry", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 16}
!18 = !{!10, !11, i64 4}
!19 = distinct !{!19, !20}
!20 = !{!"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"

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @hash(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @hash_remove_mapping(ptr nocapture noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %4, label %.thread

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.02432 = load ptr, ptr %6, align 8, !tbaa !12
  %.not33 = icmp eq ptr %.02432, null
  br i1 %.not33, label %.loopexit, label %.lr.ph.split.us

.thread:                                          ; preds = %2
  %7 = load i32, ptr %0, align 8, !tbaa !13
  %8 = tail call i32 @hash(ptr noundef nonnull %1, i32 noundef %7)
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds ptr, ptr %11, i64 %9
  %.0243254 = load ptr, ptr %12, align 8, !tbaa !12
  %.not3355 = icmp eq ptr %.0243254, null
  br i1 %.not3355, label %.loopexit, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %4
  %13 = load ptr, ptr %.02432, align 8, !tbaa !14
  %14 = icmp eq ptr %13, null
  br i1 %14, label %.split.us.thread, label %.lr.ph47

15:                                               ; preds = %.lr.ph47
  %16 = load ptr, ptr %.024.us, align 8, !tbaa !14
  %17 = icmp eq ptr %16, null
  br i1 %17, label %.split.us.thread66, label %.lr.ph47, !llvm.loop !16

.lr.ph47:                                         ; preds = %.lr.ph.split.us, %15
  %.02435.us46 = phi ptr [ %.024.us, %15 ], [ %.02432, %.lr.ph.split.us ]
  %18 = getelementptr inbounds i8, ptr %.02435.us46, i64 16
  %.024.us = load ptr, ptr %18, align 8, !tbaa !12
  %.not.us = icmp eq ptr %.024.us, null
  br i1 %.not.us, label %.loopexit, label %15, !llvm.loop !16

.lr.ph.split:                                     ; preds = %.thread
  %19 = load ptr, ptr %.0243254, align 8, !tbaa !14
  %20 = icmp eq ptr %19, %1
  br i1 %20, label %.split.us.thread, label %.lr.ph40

21:                                               ; preds = %39
  %22 = load ptr, ptr %.024, align 8, !tbaa !14
  %23 = icmp eq ptr %22, %1
  br i1 %23, label %.split.us.thread66, label %.lr.ph40, !llvm.loop !16

.lr.ph40:                                         ; preds = %.lr.ph.split, %21
  %24 = phi ptr [ %22, %21 ], [ %19, %.lr.ph.split ]
  %.0233439 = phi ptr [ %.0243538, %21 ], [ null, %.lr.ph.split ]
  %.0243538 = phi ptr [ %.024, %21 ], [ %.0243254, %.lr.ph.split ]
  %.not28 = icmp eq ptr %24, null
  br i1 %.not28, label %39, label %25

25:                                               ; preds = %.lr.ph40
  %26 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %24) #3
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %.split.us, label %39

.split.us:                                        ; preds = %25
  %28 = icmp eq ptr %.0233439, null
  br i1 %28, label %.split.us.thread, label %.split.us.thread66

.split.us.thread:                                 ; preds = %.lr.ph.split, %.lr.ph.split.us, %.split.us
  %.us-phi3661 = phi ptr [ %.0243538, %.split.us ], [ %.0243254, %.lr.ph.split ], [ %.02432, %.lr.ph.split.us ]
  %29 = phi ptr [ %12, %.split.us ], [ %12, %.lr.ph.split ], [ %6, %.lr.ph.split.us ]
  %30 = getelementptr inbounds i8, ptr %.us-phi3661, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  store ptr %31, ptr %29, align 8, !tbaa !12
  br label %35

.split.us.thread66:                               ; preds = %21, %15, %.split.us
  %.us-phi3670 = phi ptr [ %.0243538, %.split.us ], [ %.024.us, %15 ], [ %.024, %21 ]
  %.us-phi69 = phi ptr [ %.0233439, %.split.us ], [ %.02435.us46, %15 ], [ %.0243538, %21 ]
  %32 = getelementptr inbounds i8, ptr %.us-phi3670, i64 16
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  %34 = getelementptr inbounds i8, ptr %.us-phi69, i64 16
  store ptr %33, ptr %34, align 8, !tbaa !18
  br label %35

35:                                               ; preds = %.split.us.thread66, %.split.us.thread
  %.us-phi3662 = phi ptr [ %.us-phi3670, %.split.us.thread66 ], [ %.us-phi3661, %.split.us.thread ]
  %36 = getelementptr inbounds i8, ptr %0, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !19
  %38 = add i32 %37, -1
  store i32 %38, ptr %36, align 4, !tbaa !19
  br label %.loopexit

39:                                               ; preds = %.lr.ph40, %25
  %40 = getelementptr inbounds i8, ptr %.0243538, i64 16
  %.024 = load ptr, ptr %40, align 8, !tbaa !12
  %.not = icmp eq ptr %.024, null
  br i1 %.not, label %.loopexit, label %21, !llvm.loop !16

.loopexit:                                        ; preds = %39, %.lr.ph47, %.thread, %4, %35
  %.02430 = phi ptr [ %.us-phi3662, %35 ], [ null, %4 ], [ null, %.thread ], [ null, %.lr.ph47 ], [ null, %39 ]
  ret ptr %.02430
}

attributes #0 = { inlinehint 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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 willreturn memory(read) }

!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, !11, i64 16}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 12, !11, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !11, i64 0}
!15 = !{!"hash_entry", !11, i64 0, !11, i64 8, !11, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!15, !11, i64 16}
!19 = !{!6, !7, i64 4}


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