; LLVM IR from godzilla-foundation/godzilla-community :: core/deps/nanomsg-1.1.5/src/utils (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.nn_hash = type { i32, i32, ptr }
%struct.nn_list = type { ptr, ptr }
%struct.nn_hash_item = type { i32, %struct.nn_list_item }
%struct.nn_list_item = type { ptr, ptr }

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [52 x i8], align 1

; 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(none)
declare i64 @llvm.expect.i64(i64, i64) #1

declare void @nn_backtrace_print() #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare i32 @fflush(ptr noundef) #2

; Function Attrs: noreturn
declare void @nn_err_abort() #4

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

; Function Attrs: nounwind uwtable
define dso_local void @nn_hash_insert(ptr noundef %0, i32 noundef %1, ptr noundef %2) #5 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = call i32 @nn_hash_key(i32 noundef %9)
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.nn_hash, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = urem i32 %10, %13
  store i32 %14, ptr %8, align 4, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.nn_hash, ptr %15, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds %struct.nn_list, ptr %17, i64 %19
  %21 = call ptr @nn_list_begin(ptr noundef %20)
  store ptr %21, ptr %7, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %59, %3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.nn_hash, ptr %24, i32 0, i32 2
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds %struct.nn_list, ptr %26, i64 %28
  %30 = call ptr @nn_list_end(ptr noundef %29)
  %31 = icmp ne ptr %23, %30
  br i1 %31, label %32, label %68

32:                                               ; preds = %22
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %33
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 -8
  br label %40

39:                                               ; preds = %33
  br label %40

40:                                               ; preds = %39, %36
  %41 = phi ptr [ %38, %36 ], [ null, %39 ]
  %42 = getelementptr inbounds %struct.nn_hash_item, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 8, !tbaa !14
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = icmp ne i32 %43, %44
  %46 = xor i1 %45, true
  %47 = zext i1 %46 to i32
  %48 = sext i32 %47 to i64
  %49 = call i64 @llvm.expect.i64(i64 %48, i64 0)
  %50 = icmp ne i64 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %40
  call void @nn_backtrace_print()
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 101) #6
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = call i32 @fflush(ptr noundef %54)
  call void @nn_err_abort() #7
  unreachable

56:                                               ; preds = %40
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.nn_hash, ptr %60, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds %struct.nn_list, ptr %62, i64 %64
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = call ptr @nn_list_next(ptr noundef %65, ptr noundef %66)
  store ptr %67, ptr %7, align 8, !tbaa !5
  br label %22, !llvm.loop !17

68:                                               ; preds = %22
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.nn_hash_item, ptr %70, i32 0, i32 0
  store i32 %69, ptr %71, align 8, !tbaa !14
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.nn_hash, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !13
  %75 = load i32, ptr %8, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds %struct.nn_list, ptr %74, i64 %76
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.nn_hash_item, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.nn_hash, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !13
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds %struct.nn_list, ptr %82, i64 %84
  %86 = call ptr @nn_list_end(ptr noundef %85)
  call void @nn_list_insert(ptr noundef %77, ptr noundef %79, ptr noundef %86)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.nn_hash, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !19
  %90 = add i32 %89, 1
  store i32 %90, ptr %88, align 4, !tbaa !19
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.nn_hash, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !19
  %94 = mul i32 %93, 2
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.nn_hash, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 8, !tbaa !11
  %98 = icmp ugt i32 %94, %97
  br i1 %98, label %99, label %104

99:                                               ; preds = %68
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.nn_hash, ptr %100, i32 0, i32 0
  %102 = load i32, ptr %101, align 8, !tbaa !11
  %103 = icmp ult i32 %102, -2147483648
  br label %104

104:                                              ; preds = %99, %68
  %105 = phi i1 [ false, %68 ], [ %103, %99 ]
  %106 = zext i1 %105 to i32
  %107 = sext i32 %106 to i64
  %108 = call i64 @llvm.expect.i64(i64 %107, i64 0)
  %109 = icmp ne i64 %108, 0
  br i1 %109, label %110, label %112

110:                                              ; preds = %104
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nn_hash_rehash(ptr noundef %111)
  br label %112

112:                                              ; preds = %110, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @nn_hash_key(i32 noundef) #5

declare ptr @nn_list_begin(ptr noundef) #2

declare ptr @nn_list_end(ptr noundef) #2

declare ptr @nn_list_next(ptr noundef, ptr noundef) #2

declare void @nn_list_insert(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @nn_hash_rehash(ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 "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 = { noreturn "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 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 0}
!12 = !{!"nn_hash", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"nn_hash_item", !10, i64 0, !16, i64 8}
!16 = !{!"nn_list_item", !6, i64 0, !6, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !10, i64 4}


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

%struct.nn_list = type { ptr, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [52 x i8], align 1

declare void @nn_backtrace_print() local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: noreturn
declare void @nn_err_abort() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @nn_hash_insert(ptr noundef %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #3 {
  %4 = tail call i32 @nn_hash_key(i32 noundef %1)
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = urem i32 %4, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = zext i32 %6 to i64
  %10 = getelementptr inbounds %struct.nn_list, ptr %8, i64 %9
  %11 = tail call ptr @nn_list_begin(ptr noundef %10) #5
  %12 = load ptr, ptr %7, align 8, !tbaa !11
  %13 = getelementptr inbounds %struct.nn_list, ptr %12, i64 %9
  %14 = tail call ptr @nn_list_end(ptr noundef %13) #5
  %.not26 = icmp eq ptr %11, %14
  br i1 %.not26, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %23
  %.027 = phi ptr [ %26, %23 ], [ %11, %3 ]
  %15 = icmp ne ptr %.027, null
  tail call void @llvm.assume(i1 %15)
  %16 = getelementptr inbounds i8, ptr %.027, i64 -8
  %17 = load i32, ptr %16, align 8, !tbaa !12
  %.not25 = icmp eq i32 %17, %1
  br i1 %.not25, label %18, label %23, !prof !15

18:                                               ; preds = %.lr.ph
  tail call void @nn_backtrace_print() #5
  %19 = load ptr, ptr @stderr, align 8, !tbaa !16
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 101) #6
  %21 = load ptr, ptr @stderr, align 8, !tbaa !16
  %22 = tail call i32 @fflush(ptr noundef %21)
  tail call void @nn_err_abort() #7
  unreachable

23:                                               ; preds = %.lr.ph
  %24 = load ptr, ptr %7, align 8, !tbaa !11
  %25 = getelementptr inbounds %struct.nn_list, ptr %24, i64 %9
  %26 = tail call ptr @nn_list_next(ptr noundef %25, ptr noundef nonnull %.027) #5
  %27 = load ptr, ptr %7, align 8, !tbaa !11
  %28 = getelementptr inbounds %struct.nn_list, ptr %27, i64 %9
  %29 = tail call ptr @nn_list_end(ptr noundef %28) #5
  %.not = icmp eq ptr %26, %29
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %23, %3
  store i32 %1, ptr %2, align 8, !tbaa !12
  %30 = load ptr, ptr %7, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.nn_list, ptr %30, i64 %9
  %32 = getelementptr inbounds i8, ptr %2, i64 8
  %33 = tail call ptr @nn_list_end(ptr noundef %31) #5
  tail call void @nn_list_insert(ptr noundef %31, ptr noundef nonnull %32, ptr noundef %33) #5
  %34 = getelementptr inbounds i8, ptr %0, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !19
  %36 = add i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !19
  %37 = shl i32 %36, 1
  %38 = load i32, ptr %0, align 8, !tbaa !5
  %39 = icmp ugt i32 %37, %38
  %40 = icmp sgt i32 %38, -1
  %spec.select = and i1 %39, %40
  br i1 %spec.select, label %41, label %42, !prof !15

41:                                               ; preds = %._crit_edge
  tail call void @nn_hash_rehash(ptr noundef nonnull %0)
  br label %42

42:                                               ; preds = %41, %._crit_edge
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @nn_hash_key(i32 noundef) local_unnamed_addr #3

declare ptr @nn_list_begin(ptr noundef) local_unnamed_addr #0

declare ptr @nn_list_end(ptr noundef) local_unnamed_addr #0

declare ptr @nn_list_next(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @nn_list_insert(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @nn_hash_rehash(ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4

attributes #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 = { nofree 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 "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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { 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, !7, i64 0}
!6 = !{!"nn_hash", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!13, !7, i64 0}
!13 = !{!"nn_hash_item", !7, i64 0, !14, i64 8}
!14 = !{!"nn_list_item", !10, i64 0, !10, i64 8}
!15 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !7, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass