; LLVM IR from Water-Melon/Melon :: src (mln_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.mln_hash_s = type { ptr, i64, ptr, ptr, ptr, ptr, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr }

declare i32 @mln_prime_generate(i32 noundef) #0

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mln_hash_init_fast(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5, i32 noundef %6, i32 noundef %7) #3 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store i64 %5, ptr %15, align 8, !tbaa !9
  store i32 %6, ptr %16, align 4, !tbaa !11
  store i32 %7, ptr %17, align 4, !tbaa !11
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.mln_hash_s, ptr %18, i32 0, i32 9
  store ptr null, ptr %19, align 8, !tbaa !13
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.mln_hash_s, ptr %20, i32 0, i32 10
  store ptr null, ptr %21, align 8, !tbaa !15
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.mln_hash_s, ptr %22, i32 0, i32 11
  store ptr null, ptr %23, align 8, !tbaa !16
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.mln_hash_s, ptr %25, i32 0, i32 2
  store ptr %24, ptr %26, align 8, !tbaa !17
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mln_hash_s, ptr %28, i32 0, i32 3
  store ptr %27, ptr %29, align 8, !tbaa !18
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mln_hash_s, ptr %31, i32 0, i32 4
  store ptr %30, ptr %32, align 8, !tbaa !19
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.mln_hash_s, ptr %34, i32 0, i32 5
  store ptr %33, ptr %35, align 8, !tbaa !20
  %36 = load i32, ptr %17, align 4, !tbaa !11
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %43

38:                                               ; preds = %8
  %39 = load i64, ptr %15, align 8, !tbaa !9
  %40 = trunc i64 %39 to i32
  %41 = call i32 @mln_prime_generate(i32 noundef %40)
  %42 = zext i32 %41 to i64
  br label %45

43:                                               ; preds = %8
  %44 = load i64, ptr %15, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %43, %38
  %46 = phi i64 [ %42, %38 ], [ %44, %43 ]
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mln_hash_s, ptr %47, i32 0, i32 1
  store i64 %46, ptr %48, align 8, !tbaa !21
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.mln_hash_s, ptr %49, i32 0, i32 1
  %51 = load i64, ptr %50, align 8, !tbaa !21
  %52 = call noalias ptr @calloc(i64 noundef %51, i64 noundef 16) #4
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mln_hash_s, ptr %53, i32 0, i32 0
  store ptr %52, ptr %54, align 8, !tbaa !22
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mln_hash_s, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !22
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %45
  store i32 -1, ptr %9, align 4
  br label %140

60:                                               ; preds = %45
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.mln_hash_s, ptr %61, i32 0, i32 6
  store i32 0, ptr %62, align 8, !tbaa !23
  %63 = load i32, ptr %17, align 4, !tbaa !11
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %73

65:                                               ; preds = %60
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mln_hash_s, ptr %66, i32 0, i32 1
  %68 = load i64, ptr %67, align 8, !tbaa !21
  %69 = shl i64 %68, 1
  %70 = trunc i64 %69 to i32
  %71 = call i32 @mln_prime_generate(i32 noundef %70)
  %72 = zext i32 %71 to i64
  br label %78

73:                                               ; preds = %60
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mln_hash_s, ptr %74, i32 0, i32 1
  %76 = load i64, ptr %75, align 8, !tbaa !21
  %77 = shl i64 %76, 1
  br label %78

78:                                               ; preds = %73, %65
  %79 = phi i64 [ %72, %65 ], [ %77, %73 ]
  %80 = trunc i64 %79 to i32
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.mln_hash_s, ptr %81, i32 0, i32 7
  store i32 %80, ptr %82, align 4, !tbaa !24
  %83 = load i32, ptr %16, align 4, !tbaa !11
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mln_hash_s, ptr %84, i32 0, i32 8
  %86 = trunc i32 %83 to i8
  %87 = load i8, ptr %85, align 8
  %88 = and i8 %86, 1
  %89 = and i8 %87, -2
  %90 = or i8 %89, %88
  store i8 %90, ptr %85, align 8
  %91 = zext i8 %88 to i32
  %92 = load i32, ptr %17, align 4, !tbaa !11
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.mln_hash_s, ptr %93, i32 0, i32 8
  %95 = trunc i32 %92 to i8
  %96 = load i8, ptr %94, align 8
  %97 = and i8 %95, 1
  %98 = shl i8 %97, 1
  %99 = and i8 %96, -3
  %100 = or i8 %99, %98
  store i8 %100, ptr %94, align 8
  %101 = zext i8 %97 to i32
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.mln_hash_s, ptr %102, i32 0, i32 1
  %104 = load i64, ptr %103, align 8, !tbaa !21
  %105 = icmp eq i64 %104, 0
  br i1 %105, label %116, label %106

106:                                              ; preds = %78
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.mln_hash_s, ptr %107, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !17
  %110 = icmp eq ptr %109, null
  br i1 %110, label %116, label %111

111:                                              ; preds = %106
  %112 = load ptr, ptr %10, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.mln_hash_s, ptr %112, i32 0, i32 3
  %114 = load ptr, ptr %113, align 8, !tbaa !18
  %115 = icmp eq ptr %114, null
  br i1 %115, label %116, label %133

116:                                              ; preds = %111, %106, %78
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.mln_hash_s, ptr %117, i32 0, i32 9
  %119 = load ptr, ptr %118, align 8, !tbaa !13
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %128

121:                                              ; preds = %116
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.mln_hash_s, ptr %122, i32 0, i32 11
  %124 = load ptr, ptr %123, align 8, !tbaa !16
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.mln_hash_s, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !22
  call void %124(ptr noundef %127)
  br label %132

128:                                              ; preds = %116
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.mln_hash_s, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !22
  call void @free(ptr noundef %131) #5
  br label %132

132:                                              ; preds = %128, %121
  store i32 -1, ptr %9, align 4
  br label %140

133:                                              ; preds = %111
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.mln_hash_s, ptr %134, i32 0, i32 13
  store ptr null, ptr %135, align 8, !tbaa !25
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.mln_hash_s, ptr %136, i32 0, i32 12
  store ptr null, ptr %137, align 8, !tbaa !26
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.mln_hash_s, ptr %138, i32 0, i32 14
  store ptr null, ptr %139, align 8, !tbaa !27
  store i32 0, ptr %9, align 4
  br label %140

140:                                              ; preds = %133, %132, %59
  %141 = load i32, ptr %9, align 4
  ret i32 %141
}

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 = { nounwind allocsize(0,1) "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 "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 allocsize(0,1) }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 64}
!14 = !{!"mln_hash_s", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!15 = !{!14, !6, i64 72}
!16 = !{!14, !6, i64 80}
!17 = !{!14, !6, i64 16}
!18 = !{!14, !6, i64 24}
!19 = !{!14, !6, i64 32}
!20 = !{!14, !6, i64 40}
!21 = !{!14, !10, i64 8}
!22 = !{!14, !6, i64 0}
!23 = !{!14, !12, i64 48}
!24 = !{!14, !12, i64 52}
!25 = !{!14, !6, i64 96}
!26 = !{!14, !6, i64 88}
!27 = !{!14, !6, i64 104}


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

declare i32 @mln_prime_generate(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @mln_hash_init_fast(ptr nocapture noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #3 {
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  store ptr %1, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %2, ptr %12, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %3, ptr %13, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %4, ptr %14, align 8, !tbaa !14
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %19, label %15

15:                                               ; preds = %8
  %16 = trunc i64 %5 to i32
  %17 = tail call i32 @mln_prime_generate(i32 noundef %16) #5
  %18 = zext i32 %17 to i64
  br label %19

19:                                               ; preds = %8, %15
  %20 = phi i64 [ %18, %15 ], [ %5, %8 ]
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %20, ptr %21, align 8, !tbaa !15
  %22 = tail call noalias ptr @calloc(i64 noundef %20, i64 noundef 16) #6
  store ptr %22, ptr %0, align 8, !tbaa !16
  %23 = icmp eq ptr %22, null
  br i1 %23, label %59, label %24

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 0, ptr %25, align 8, !tbaa !17
  %.tr37 = trunc i64 %20 to i32
  %26 = shl i32 %.tr37, 1
  br i1 %.not, label %29, label %27

27:                                               ; preds = %24
  %28 = tail call i32 @mln_prime_generate(i32 noundef %26) #5
  %.pre = load i64, ptr %21, align 8, !tbaa !15
  br label %29

29:                                               ; preds = %24, %27
  %30 = phi i64 [ %.pre, %27 ], [ %20, %24 ]
  %31 = phi i32 [ %28, %27 ], [ %26, %24 ]
  %32 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %31, ptr %32, align 4, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %0, i64 56
  %34 = trunc i32 %6 to i8
  %35 = load i8, ptr %33, align 8
  %36 = and i8 %34, 1
  %37 = and i8 %35, -4
  %38 = trunc i32 %7 to i8
  %39 = shl i8 %38, 1
  %40 = and i8 %39, 2
  %41 = or disjoint i8 %40, %36
  %42 = or disjoint i8 %41, %37
  store i8 %42, ptr %33, align 8
  %43 = icmp eq i64 %30, 0
  br i1 %43, label %50, label %44

44:                                               ; preds = %29
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load ptr, ptr %12, align 8, !tbaa !12
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %57

50:                                               ; preds = %47, %44, %29
  %51 = load ptr, ptr %9, align 8, !tbaa !19
  %.not38 = icmp eq ptr %51, null
  br i1 %.not38, label %55, label %52

52:                                               ; preds = %50
  %53 = load ptr, ptr %10, align 8, !tbaa !20
  %54 = load ptr, ptr %0, align 8, !tbaa !16
  tail call void %53(ptr noundef %54) #5
  br label %59

55:                                               ; preds = %50
  %56 = load ptr, ptr %0, align 8, !tbaa !16
  tail call void @free(ptr noundef %56) #5
  br label %59

57:                                               ; preds = %47
  %58 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %58, i8 0, i64 24, i1 false)
  br label %59

59:                                               ; preds = %52, %55, %19, %57
  %.0 = phi i32 [ 0, %57 ], [ -1, %19 ], [ -1, %55 ], [ -1, %52 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }

!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 16}
!6 = !{!"mln_hash_s", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 40}
!15 = !{!6, !10, i64 8}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !11, i64 48}
!18 = !{!6, !11, i64 52}
!19 = !{!6, !7, i64 64}
!20 = !{!6, !7, i64 80}


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