; LLVM IR from sylefeb/Silixel :: src/fstapi (fstapi)

; 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.collchain_t = type { ptr, ptr, i32, i32, [1 x i8] }

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

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

; 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) #2

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

21:                                               ; preds = %4
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = add i32 %22, 1
  %24 = zext i32 %23 to i64
  %25 = mul i64 %24, 8
  %26 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %25) #6
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %26, ptr %27, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %21, %4
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  store ptr %30, ptr %13, align 8, !tbaa !5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = call i32 @j_hash(ptr noundef %31, i32 noundef %32, i32 noundef %33)
  store i32 %34, ptr %11, align 4, !tbaa !9
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = and i32 %34, %35
  store i32 %36, ptr %12, align 4, !tbaa !9
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = load i32, ptr %12, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds ptr, ptr %37, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  store ptr %41, ptr %14, align 8, !tbaa !5
  store ptr %41, ptr %15, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %91, %28
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %96

45:                                               ; preds = %42
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.collchain_t, ptr %46, i32 0, i32 2
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = load i32, ptr %11, align 4, !tbaa !9
  %50 = icmp eq i32 %48, %49
  br i1 %50, label %51, label %91

51:                                               ; preds = %45
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.collchain_t, ptr %52, i32 0, i32 3
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = icmp eq i32 %54, %55
  br i1 %56, label %57, label %91

57:                                               ; preds = %51
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.collchain_t, ptr %58, i32 0, i32 4
  %60 = getelementptr inbounds [1 x i8], ptr %59, i64 0, i64 0
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = call i32 @memcmp(ptr noundef %60, ptr noundef %61, i64 noundef %63) #7
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %91, label %66

66:                                               ; preds = %57
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = icmp ne ptr %67, %68
  br i1 %69, label %70, label %88

70:                                               ; preds = %66
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.collchain_t, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !14
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.collchain_t, ptr %74, i32 0, i32 0
  store ptr %73, ptr %75, align 8, !tbaa !14
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %76, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.collchain_t, ptr %81, i32 0, i32 0
  store ptr %80, ptr %82, align 8, !tbaa !14
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds ptr, ptr %84, i64 %86
  store ptr %83, ptr %87, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %70, %66
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.collchain_t, ptr %89, i32 0, i32 1
  store ptr %90, ptr %5, align 8
  store i32 1, ptr %16, align 4
  br label %128

91:                                               ; preds = %57, %51, %45
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %92, ptr %15, align 8, !tbaa !5
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.collchain_t, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !14
  store ptr %95, ptr %14, align 8, !tbaa !5
  br label %42, !llvm.loop !15

96:                                               ; preds = %42
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = add i64 32, %98
  %100 = sub i64 %99, 1
  %101 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %100) #6
  store ptr %101, ptr %14, align 8, !tbaa !5
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.collchain_t, ptr %102, i32 0, i32 4
  %104 = getelementptr inbounds [1 x i8], ptr %103, i64 0, i64 0
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %104, ptr align 1 %105, i64 %107, i1 false)
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = load ptr, ptr %14, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.collchain_t, ptr %109, i32 0, i32 2
  store i32 %108, ptr %110, align 8, !tbaa !11
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = load ptr, ptr %14, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.collchain_t, ptr %112, i32 0, i32 3
  store i32 %111, ptr %113, align 4, !tbaa !13
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds ptr, ptr %114, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.collchain_t, ptr %119, i32 0, i32 0
  store ptr %118, ptr %120, align 8, !tbaa !14
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  %122 = load ptr, ptr %13, align 8, !tbaa !5
  %123 = load i32, ptr %12, align 4, !tbaa !9
  %124 = zext i32 %123 to i64
  %125 = getelementptr inbounds ptr, ptr %122, i64 %124
  store ptr %121, ptr %125, align 8, !tbaa !5
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.collchain_t, ptr %126, i32 0, i32 1
  store ptr %127, ptr %5, align 8
  store i32 1, ptr %16, align 4
  br label %128

128:                                              ; preds = %96, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %129 = load ptr, ptr %5, align 8
  ret ptr %129
}

; Function Attrs: nounwind uwtable
declare hidden i32 @j_hash(ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"collchain_t", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !7, i64 24}
!13 = !{!12, !10, i64 20}
!14 = !{!12, !6, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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: 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 #0

; Function Attrs: mustprogress 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: nounwind uwtable
define dso_local nonnull ptr @JenkinsIns(ptr nocapture noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %6, label %11

6:                                                ; preds = %4
  %7 = add i32 %3, 1
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 3
  %10 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %9) #4
  store ptr %10, ptr %0, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %6, %4
  %12 = phi ptr [ %10, %6 ], [ %5, %4 ]
  %13 = tail call i32 @j_hash(ptr noundef %1, i32 noundef %2, i32 noundef %2)
  %14 = and i32 %13, %3
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds ptr, ptr %12, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %.not5055 = icmp eq ptr %17, null
  %.pre = zext i32 %2 to i64
  br i1 %.not5055, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %11, %31
  %.057 = phi ptr [ %.04756, %31 ], [ %17, %11 ]
  %.04756 = phi ptr [ %32, %31 ], [ %17, %11 ]
  %18 = getelementptr inbounds i8, ptr %.04756, i64 16
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp eq i32 %19, %13
  br i1 %20, label %21, label %31

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds i8, ptr %.04756, i64 20
  %23 = load i32, ptr %22, align 4, !tbaa !12
  %24 = icmp eq i32 %23, %2
  br i1 %24, label %25, label %31

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %.04756, i64 24
  %bcmp = tail call i32 @bcmp(ptr nonnull %26, ptr %1, i64 %.pre)
  %.not51 = icmp eq i32 %bcmp, 0
  br i1 %.not51, label %27, label %31

27:                                               ; preds = %25
  %.not52 = icmp eq ptr %.057, %.04756
  br i1 %.not52, label %38, label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %.04756, align 8, !tbaa !13
  store ptr %29, ptr %.057, align 8, !tbaa !13
  %30 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %30, ptr %.04756, align 8, !tbaa !13
  br label %.sink.split

31:                                               ; preds = %25, %21, %.lr.ph
  %32 = load ptr, ptr %.04756, align 8, !tbaa !13
  %.not50 = icmp eq ptr %32, null
  br i1 %.not50, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %31, %11
  %33 = add nuw nsw i64 %.pre, 31
  %34 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %33) #4
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %35, ptr align 1 %1, i64 %.pre, i1 false)
  %36 = getelementptr inbounds i8, ptr %34, i64 16
  store i32 %13, ptr %36, align 8, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %34, i64 20
  store i32 %2, ptr %37, align 4, !tbaa !12
  store ptr %17, ptr %34, align 8, !tbaa !13
  br label %.sink.split

.sink.split:                                      ; preds = %._crit_edge, %28
  %.04756.lcssa.sink = phi ptr [ %.04756, %28 ], [ %34, %._crit_edge ]
  store ptr %.04756.lcssa.sink, ptr %16, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %.sink.split, %27
  %.047.pn = phi ptr [ %.04756, %27 ], [ %.04756.lcssa.sink, %.sink.split ]
  %.048 = getelementptr inbounds i8, ptr %.047.pn, i64 8
  ret ptr %.048
}

; Function Attrs: nounwind uwtable
declare hidden i32 @j_hash(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3

attributes #0 = { 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 #1 = { mustprogress 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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 16}
!10 = !{!"collchain_t", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !7, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 20}
!13 = !{!10, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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