; LLVM IR from jdeokkim/ferox :: src (world)

; 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.stbds_array_header = type { i64, i64, ptr, i64 }
%struct.stbds_hash_index = type { ptr, i64, i64, i64, i64, i64, i64, i64, i64, %struct.stbds_string_arena, ptr }
%struct.stbds_string_arena = type { ptr, i64, i8, i8 }
%struct.stbds_hash_bucket = type { [8 x i64], [8 x i64] }

; Function Attrs: nounwind uwtable
declare dso_local ptr @stbds_arrgrowf(ptr noundef, i64 noundef, i64 noundef, i64 noundef) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

22:                                               ; preds = %6
  %23 = load i64, ptr %9, align 8, !tbaa !9
  %24 = call ptr @stbds_arrgrowf(ptr noundef null, i64 noundef %23, i64 noundef 0, i64 noundef 1)
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.stbds_array_header, ptr %25, i64 -1
  %27 = getelementptr inbounds %struct.stbds_array_header, ptr %26, i32 0, i32 0
  %28 = load i64, ptr %27, align 8, !tbaa !13
  %29 = add i64 %28, 1
  store i64 %29, ptr %27, align 8, !tbaa !13
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = load i64, ptr %9, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 1 %30, i8 0, i64 %31, i1 false)
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 -1, ptr %32, align 8, !tbaa !9
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load i64, ptr %9, align 8, !tbaa !9
  %35 = getelementptr inbounds i8, ptr %33, i64 %34
  store ptr %35, ptr %7, align 8
  store i32 1, ptr %15, align 4
  br label %78

36:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = load i64, ptr %9, align 8, !tbaa !9
  %39 = sub i64 0, %38
  %40 = getelementptr inbounds i8, ptr %37, i64 %39
  store ptr %40, ptr %17, align 8, !tbaa !5
  %41 = load ptr, ptr %17, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.stbds_array_header, ptr %41, i64 -1
  %43 = getelementptr inbounds %struct.stbds_array_header, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  store ptr %44, ptr %16, align 8, !tbaa !5
  %45 = load ptr, ptr %16, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %36
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 -1, ptr %48, align 8, !tbaa !9
  br label %76

49:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = load i64, ptr %11, align 8, !tbaa !9
  %54 = load i64, ptr %14, align 8, !tbaa !9
  %55 = load i32, ptr %13, align 4, !tbaa !11
  %56 = call i64 @stbds_hm_find_slot(ptr noundef %50, i64 noundef %51, ptr noundef %52, i64 noundef %53, i64 noundef %54, i32 noundef %55)
  store i64 %56, ptr %18, align 8, !tbaa !9
  %57 = load i64, ptr %18, align 8, !tbaa !9
  %58 = icmp slt i64 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %49
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 -1, ptr %60, align 8, !tbaa !9
  br label %75

61:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.stbds_hash_index, ptr %62, i32 0, i32 10
  %64 = load ptr, ptr %63, align 8, !tbaa !16
  %65 = load i64, ptr %18, align 8, !tbaa !9
  %66 = ashr i64 %65, 3
  %67 = getelementptr inbounds %struct.stbds_hash_bucket, ptr %64, i64 %66
  store ptr %67, ptr %19, align 8, !tbaa !5
  %68 = load ptr, ptr %19, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.stbds_hash_bucket, ptr %68, i32 0, i32 1
  %70 = load i64, ptr %18, align 8, !tbaa !9
  %71 = and i64 %70, 7
  %72 = getelementptr inbounds [8 x i64], ptr %69, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !9
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %73, ptr %74, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  br label %75

75:                                               ; preds = %61, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  br label %76

76:                                               ; preds = %75, %47
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %77, ptr %7, align 8
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %78

78:                                               ; preds = %76, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %79 = load ptr, ptr %7, align 8
  ret ptr %79
}

; Function Attrs: nounwind uwtable
declare hidden i64 @stbds_hm_find_slot(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef, i32 noundef) #0

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !10, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 8, !6, i64 16, !10, i64 24}
!15 = !{!14, !6, i64 16}
!16 = !{!17, !6, i64 96}
!17 = !{!"", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !18, i64 72, !6, i64 96}
!18 = !{!"stbds_string_arena", !6, i64 0, !10, i64 8, !7, i64 16, !7, i64 17}


; 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.stbds_hash_bucket = type { [8 x i64], [8 x i64] }

; Function Attrs: nounwind uwtable
declare dso_local ptr @stbds_arrgrowf(ptr noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @stbds_hmget_key_ts(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr nocapture noundef writeonly %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = icmp eq ptr %0, null
  br i1 %7, label %8, label %14

8:                                                ; preds = %6
  %9 = tail call ptr @stbds_arrgrowf(ptr noundef null, i64 noundef %1, i64 noundef 0, i64 noundef 1)
  %10 = getelementptr inbounds i8, ptr %9, i64 -32
  %11 = load i64, ptr %10, align 8, !tbaa !5
  %12 = add i64 %11, 1
  store i64 %12, ptr %10, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 1 %9, i8 0, i64 %1, i1 false)
  store i64 -1, ptr %4, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %9, i64 %1
  br label %31

14:                                               ; preds = %6
  %15 = sub i64 0, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 %15
  %17 = getelementptr inbounds i8, ptr %16, i64 -16
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = icmp eq ptr %18, null
  br i1 %19, label %30, label %20

20:                                               ; preds = %14
  %21 = tail call i64 @stbds_hm_find_slot(ptr noundef nonnull %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef 0, i32 noundef %5)
  %22 = icmp slt i64 %21, 0
  br i1 %22, label %30, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %18, i64 96
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = lshr i64 %21, 3
  %27 = and i64 %21, 7
  %28 = getelementptr inbounds %struct.stbds_hash_bucket, ptr %25, i64 %26, i32 1, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !11
  br label %30

30:                                               ; preds = %23, %20, %14
  %storemerge30 = phi i64 [ -1, %14 ], [ %29, %23 ], [ -1, %20 ]
  store i64 %storemerge30, ptr %4, align 8, !tbaa !11
  br label %31

31:                                               ; preds = %30, %8
  %.0 = phi ptr [ %13, %8 ], [ %0, %30 ]
  ret ptr %.0
}

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }

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


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