; LLVM IR from mwarning/KadNode :: src (kad)

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

%union.anon.0 = type { [1 x i64] }

@.str.63 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [60 x i8], align 1
@__PRETTY_FUNCTION__.dht_hash = external hidden unnamed_addr constant [84 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [15 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 @dht_hash(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7) #2 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %union.anon.0, align 8
  %18 = alloca i32, align 4
  %19 = alloca i16, align 2
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store ptr %2, ptr %11, align 8, !tbaa !5
  store i32 %3, ptr %12, align 4, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store i32 %5, ptr %14, align 4, !tbaa !9
  store ptr %6, ptr %15, align 8, !tbaa !5
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %20 = load i32, ptr %12, align 4, !tbaa !9
  %21 = icmp eq i32 %20, 8
  br i1 %21, label %22, label %23

22:                                               ; preds = %8
  br label %24

23:                                               ; preds = %8
  call void @__assert_fail(ptr noundef @.str.63, ptr noundef @.str.64, i32 noundef 297, ptr noundef @__PRETTY_FUNCTION__.dht_hash) #5
  unreachable

24:                                               ; preds = %22
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 1 %25, i64 8, i1 false)
  %26 = load i32, ptr %14, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 4
  br i1 %27, label %31, label %28

28:                                               ; preds = %24
  %29 = load i32, ptr %14, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 16
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %24
  br label %33

32:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.65, ptr noundef @.str.64, i32 noundef 300, ptr noundef @__PRETTY_FUNCTION__.dht_hash) #5
  unreachable

33:                                               ; preds = %31
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 4
  br i1 %35, label %36, label %47

36:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = load i32, ptr %37, align 4, !tbaa !9
  store i32 %38, ptr %18, align 4, !tbaa !9
  %39 = load i32, ptr %18, align 4, !tbaa !9
  %40 = getelementptr inbounds [2 x i32], ptr %17, i64 0, i64 0
  %41 = load i32, ptr %40, align 8, !tbaa !11
  %42 = xor i32 %41, %39
  store i32 %42, ptr %40, align 8, !tbaa !11
  %43 = load i32, ptr %18, align 4, !tbaa !9
  %44 = getelementptr inbounds [2 x i32], ptr %17, i64 0, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = xor i32 %45, %43
  store i32 %46, ptr %44, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %59

47:                                               ; preds = %33
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load i64, ptr %48, align 8, !tbaa !12
  %50 = getelementptr inbounds [1 x i64], ptr %17, i64 0, i64 0
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = xor i64 %51, %49
  store i64 %52, ptr %50, align 8, !tbaa !11
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = getelementptr inbounds i64, ptr %53, i64 8
  %55 = load i64, ptr %54, align 8, !tbaa !12
  %56 = getelementptr inbounds [1 x i64], ptr %17, i64 0, i64 0
  %57 = load i64, ptr %56, align 8, !tbaa !11
  %58 = xor i64 %57, %55
  store i64 %58, ptr %56, align 8, !tbaa !11
  br label %59

59:                                               ; preds = %47, %36
  %60 = load i32, ptr %16, align 4, !tbaa !9
  %61 = icmp eq i32 %60, 2
  br i1 %61, label %62, label %63

62:                                               ; preds = %59
  br label %64

63:                                               ; preds = %59
  call void @__assert_fail(ptr noundef @.str.66, ptr noundef @.str.64, i32 noundef 310, ptr noundef @__PRETTY_FUNCTION__.dht_hash) #5
  unreachable

64:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #4
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  %66 = load i16, ptr %65, align 2, !tbaa !14
  store i16 %66, ptr %19, align 2, !tbaa !14
  %67 = load i16, ptr %19, align 2, !tbaa !14
  %68 = zext i16 %67 to i32
  %69 = getelementptr inbounds [4 x i16], ptr %17, i64 0, i64 0
  %70 = load i16, ptr %69, align 8, !tbaa !11
  %71 = zext i16 %70 to i32
  %72 = xor i32 %71, %68
  %73 = trunc i32 %72 to i16
  store i16 %73, ptr %69, align 8, !tbaa !11
  %74 = load i16, ptr %19, align 2, !tbaa !14
  %75 = zext i16 %74 to i32
  %76 = getelementptr inbounds [4 x i16], ptr %17, i64 0, i64 1
  %77 = load i16, ptr %76, align 2, !tbaa !11
  %78 = zext i16 %77 to i32
  %79 = xor i32 %78, %75
  %80 = trunc i32 %79 to i16
  store i16 %80, ptr %76, align 2, !tbaa !11
  %81 = load i16, ptr %19, align 2, !tbaa !14
  %82 = zext i16 %81 to i32
  %83 = getelementptr inbounds [4 x i16], ptr %17, i64 0, i64 2
  %84 = load i16, ptr %83, align 4, !tbaa !11
  %85 = zext i16 %84 to i32
  %86 = xor i32 %85, %82
  %87 = trunc i32 %86 to i16
  store i16 %87, ptr %83, align 4, !tbaa !11
  %88 = load i16, ptr %19, align 2, !tbaa !14
  %89 = zext i16 %88 to i32
  %90 = getelementptr inbounds [4 x i16], ptr %17, i64 0, i64 3
  %91 = load i16, ptr %90, align 2, !tbaa !11
  %92 = zext i16 %91 to i32
  %93 = xor i32 %92, %89
  %94 = trunc i32 %93 to i16
  store i16 %94, ptr %90, align 2, !tbaa !11
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = icmp eq i32 %95, 8
  br i1 %96, label %97, label %98

97:                                               ; preds = %64
  br label %99

98:                                               ; preds = %64
  call void @__assert_fail(ptr noundef @.str.67, ptr noundef @.str.64, i32 noundef 317, ptr noundef @__PRETTY_FUNCTION__.dht_hash) #5
  unreachable

99:                                               ; preds = %97
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %100, ptr align 8 %17, i64 8, i1 false)
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}


; 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.63 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [60 x i8], align 1
@__PRETTY_FUNCTION__.dht_hash = external hidden unnamed_addr constant [84 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @dht_hash(ptr nocapture noundef writeonly %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef readonly %4, i32 noundef %5, ptr nocapture noundef readonly %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = icmp eq i32 %3, 8
  br i1 %9, label %11, label %10

10:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.63, ptr noundef nonnull @.str.64, i32 noundef 297, ptr noundef nonnull @__PRETTY_FUNCTION__.dht_hash) #2
  unreachable

11:                                               ; preds = %8
  %.sroa.0.0.copyload = load i32, ptr %2, align 1
  %.sroa.14.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  %.sroa.14.0.copyload = load i32, ptr %.sroa.14.0..sroa_idx, align 1
  switch i32 %5, label %12 [
    i32 4, label %13
    i32 16, label %17
  ]

12:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.65, ptr noundef nonnull @.str.64, i32 noundef 300, ptr noundef nonnull @__PRETTY_FUNCTION__.dht_hash) #2
  unreachable

13:                                               ; preds = %11
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = xor i32 %14, %.sroa.0.0.copyload
  %16 = xor i32 %14, %.sroa.14.0.copyload
  %.sroa.14.sroa.12.0.extract.shift55 = lshr i32 %16, 16
  br label %23

17:                                               ; preds = %11
  %18 = load i64, ptr %4, align 8, !tbaa !9
  %.sroa.14.0.insert.ext = zext i32 %.sroa.14.0.copyload to i64
  %.sroa.14.0.insert.shift = shl nuw i64 %.sroa.14.0.insert.ext, 32
  %.sroa.0.0.insert.ext = zext i32 %.sroa.0.0.copyload to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.14.0.insert.shift, %.sroa.0.0.insert.ext
  %19 = xor i64 %18, %.sroa.0.0.insert.insert
  %20 = getelementptr inbounds i8, ptr %4, i64 64
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = xor i64 %19, %21
  %.sroa.0.sroa.0.0.extract.trunc65 = trunc i64 %22 to i32
  %.sroa.14.0.extract.shift21 = lshr i64 %22, 32
  %.sroa.14.sroa.0.0.extract.trunc31 = trunc nuw i64 %.sroa.14.0.extract.shift21 to i32
  %sum.shift = lshr i64 %22, 48
  %.sroa.14.sroa.12.0.extract.trunc46 = trunc nuw nsw i64 %sum.shift to i32
  br label %23

23:                                               ; preds = %17, %13
  %.sroa.14.sroa.12.0 = phi i32 [ %.sroa.14.sroa.12.0.extract.shift55, %13 ], [ %.sroa.14.sroa.12.0.extract.trunc46, %17 ]
  %.sroa.14.sroa.0.0 = phi i32 [ %16, %13 ], [ %.sroa.14.sroa.0.0.extract.trunc31, %17 ]
  %.sroa.0.sroa.0.0 = phi i32 [ %15, %13 ], [ %.sroa.0.sroa.0.0.extract.trunc65, %17 ]
  %24 = icmp eq i32 %7, 2
  br i1 %24, label %26, label %25

25:                                               ; preds = %23
  tail call void @__assert_fail(ptr noundef nonnull @.str.66, ptr noundef nonnull @.str.64, i32 noundef 310, ptr noundef nonnull @__PRETTY_FUNCTION__.dht_hash) #2
  unreachable

26:                                               ; preds = %23
  %27 = icmp eq i32 %1, 8
  br i1 %27, label %29, label %28

28:                                               ; preds = %26
  tail call void @__assert_fail(ptr noundef nonnull @.str.67, ptr noundef nonnull @.str.64, i32 noundef 317, ptr noundef nonnull @__PRETTY_FUNCTION__.dht_hash) #2
  unreachable

29:                                               ; preds = %26
  %30 = load i16, ptr %6, align 2, !tbaa !11
  %31 = trunc nuw i32 %.sroa.14.sroa.12.0 to i16
  %32 = xor i16 %30, %31
  %33 = trunc i32 %.sroa.14.sroa.0.0 to i16
  %34 = xor i16 %30, %33
  %.sroa.0.sroa.12.0 = lshr i32 %.sroa.0.sroa.0.0, 16
  %35 = trunc nuw i32 %.sroa.0.sroa.12.0 to i16
  %36 = xor i16 %30, %35
  %37 = trunc i32 %.sroa.0.sroa.0.0 to i16
  %38 = xor i16 %30, %37
  %.sroa.0.sroa.12.0.insert.ext83 = zext i16 %36 to i32
  %.sroa.0.sroa.12.0.insert.shift84 = shl nuw i32 %.sroa.0.sroa.12.0.insert.ext83, 16
  %.sroa.0.sroa.0.0.insert.ext66 = zext i16 %38 to i32
  %.sroa.0.sroa.0.0.insert.insert68 = or disjoint i32 %.sroa.0.sroa.12.0.insert.shift84, %.sroa.0.sroa.0.0.insert.ext66
  store i32 %.sroa.0.sroa.0.0.insert.insert68, ptr %0, align 1
  %.sroa.14.0..sroa_idx23 = getelementptr inbounds i8, ptr %0, i64 4
  %.sroa.14.sroa.12.0.insert.ext47 = zext i16 %32 to i32
  %.sroa.14.sroa.12.0.insert.shift48 = shl nuw i32 %.sroa.14.sroa.12.0.insert.ext47, 16
  %.sroa.14.sroa.0.0.insert.ext32 = zext i16 %34 to i32
  %.sroa.14.sroa.0.0.insert.insert34 = or disjoint i32 %.sroa.14.sroa.12.0.insert.shift48, %.sroa.14.sroa.0.0.insert.ext32
  store i32 %.sroa.14.sroa.0.0.insert.insert34, ptr %.sroa.14.0..sroa_idx23, align 1
  ret void
}

; 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass