; LLVM IR from AngelPn/DBMS-Simulator :: src (HP)

; 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.HP_info = type { i32, i32, i8, ptr, i32, i32 }
%struct.record = type { i32, [15 x i8], [25 x i8], [50 x i8] }

@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

declare void @BF_PrintError(ptr noundef) #0

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

declare i32 @BF_AllocateBlock(i32 noundef) #0

declare i32 @BF_ReadBlock(i32 noundef, i32 noundef, ptr noundef) #0

declare i32 @BF_GetBlockCounter(i32 noundef) #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) #2

declare i32 @BF_WriteBlock(i32 noundef, i32 noundef) #0

; 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 i32 @HP_InsertEntry(ptr noundef byval(%struct.HP_info) align 8 %0, ptr noundef byval(%struct.record) align 8 %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 -1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 5
  %20 = load i32, ptr %19, align 4, !tbaa !13
  %21 = call i32 @BF_ReadBlock(i32 noundef %18, i32 noundef %20, ptr noundef %8)
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %2
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %172

24:                                               ; preds = %2
  %25 = load ptr, ptr %8, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 512
  %27 = getelementptr inbounds i8, ptr %26, i64 -8
  %28 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %28, ptr %4, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %85, %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = icmp ne i32 %30, -1
  br i1 %31, label %32, label %91

32:                                               ; preds = %29
  %33 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = call i32 @BF_ReadBlock(i32 noundef %34, i32 noundef %35, ptr noundef %8)
  %37 = icmp slt i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %172

39:                                               ; preds = %32
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %40, i64 512
  %42 = getelementptr inbounds i8, ptr %41, i64 -4
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %74, %39
  %45 = load i32, ptr %10, align 4, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 4, ptr %9, align 4
  br label %77

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %50 = load ptr, ptr %8, align 8, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul i64 %52, 96
  %54 = getelementptr inbounds i8, ptr %50, i64 %53
  store ptr %54, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %55 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 3
  %56 = load ptr, ptr %55, align 8, !tbaa !14
  %57 = call ptr @get_key(ptr noundef %1, ptr noundef %56)
  store ptr %57, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %58 = load ptr, ptr %11, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 3
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = call ptr @get_key(ptr noundef %58, ptr noundef %60)
  store ptr %61, ptr %13, align 8, !tbaa !9
  %62 = load ptr, ptr %12, align 8, !tbaa !9
  %63 = load ptr, ptr %13, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 4
  %65 = load i32, ptr %64, align 8, !tbaa !15
  %66 = sext i32 %65 to i64
  %67 = call i32 @memcmp(ptr noundef %62, ptr noundef %63, i64 noundef %66) #6
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %49
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %71

70:                                               ; preds = %49
  store i32 0, ptr %9, align 4
  br label %71

71:                                               ; preds = %70, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %72 = load i32, ptr %9, align 4
  switch i32 %72, label %77 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %10, align 4, !tbaa !5
  br label %44, !llvm.loop !16

77:                                               ; preds = %71, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %78 = load i32, ptr %9, align 4
  switch i32 %78, label %172 [
    i32 4, label %79
  ]

79:                                               ; preds = %77
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp ult i64 %81, 5
  br i1 %82, label %83, label %85

83:                                               ; preds = %79
  %84 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %84, ptr %6, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %83, %79
  %86 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %86, ptr %5, align 4, !tbaa !5
  %87 = load ptr, ptr %8, align 8, !tbaa !9
  %88 = getelementptr inbounds i8, ptr %87, i64 512
  %89 = getelementptr inbounds i8, ptr %88, i64 -8
  %90 = load i32, ptr %89, align 4, !tbaa !5
  store i32 %90, ptr %4, align 4, !tbaa !5
  br label %29, !llvm.loop !18

91:                                               ; preds = %29
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = icmp eq i32 %92, -1
  br i1 %93, label %94, label %140

94:                                               ; preds = %91
  %95 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %96 = load i32, ptr %95, align 4, !tbaa !11
  %97 = call i32 @BF_AllocateBlock(i32 noundef %96)
  %98 = icmp slt i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %94
  call void @BF_PrintError(ptr noundef @.str.2)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %172

100:                                              ; preds = %94
  %101 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !11
  %103 = call i32 @BF_GetBlockCounter(i32 noundef %102)
  %104 = sub nsw i32 %103, 1
  store i32 %104, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !9
  %105 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = call i32 @BF_ReadBlock(i32 noundef %106, i32 noundef %107, ptr noundef %14)
  %109 = icmp slt i32 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %100
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %137

111:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %112 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !11
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = call i32 @BF_ReadBlock(i32 noundef %113, i32 noundef %114, ptr noundef %15)
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %117, label %118

117:                                              ; preds = %111
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %136

118:                                              ; preds = %111
  %119 = load ptr, ptr %15, align 8, !tbaa !9
  %120 = getelementptr inbounds i8, ptr %119, i64 512
  %121 = getelementptr inbounds i8, ptr %120, i64 -8
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %121, ptr align 4 %4, i64 4, i1 false)
  %122 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = call i32 @BF_WriteBlock(i32 noundef %123, i32 noundef %124)
  %126 = icmp slt i32 %125, 0
  br i1 %126, label %127, label %128

127:                                              ; preds = %118
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %136

128:                                              ; preds = %118
  %129 = load ptr, ptr %14, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %129, ptr align 8 %1, i64 96, i1 false)
  store i32 1, ptr %7, align 4, !tbaa !5
  %130 = load ptr, ptr %14, align 8, !tbaa !9
  %131 = getelementptr inbounds i8, ptr %130, i64 512
  %132 = getelementptr inbounds i8, ptr %131, i64 -4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %132, ptr align 4 %7, i64 4, i1 false)
  store i32 -1, ptr %7, align 4, !tbaa !5
  %133 = load ptr, ptr %14, align 8, !tbaa !9
  %134 = getelementptr inbounds i8, ptr %133, i64 512
  %135 = getelementptr inbounds i8, ptr %134, i64 -8
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %135, ptr align 4 %7, i64 4, i1 false)
  store i32 0, ptr %9, align 4
  br label %136

136:                                              ; preds = %128, %127, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %137

137:                                              ; preds = %136, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %138 = load i32, ptr %9, align 4
  switch i32 %138, label %172 [
    i32 0, label %139
  ]

139:                                              ; preds = %137
  br label %163

140:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %141 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !11
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = call i32 @BF_ReadBlock(i32 noundef %142, i32 noundef %143, ptr noundef %16)
  %145 = icmp slt i32 %144, 0
  br i1 %145, label %146, label %147

146:                                              ; preds = %140
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %160

147:                                              ; preds = %140
  %148 = load i32, ptr %7, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %7, align 4, !tbaa !5
  %150 = load ptr, ptr %16, align 8, !tbaa !9
  %151 = getelementptr inbounds i8, ptr %150, i64 512
  %152 = getelementptr inbounds i8, ptr %151, i64 -4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %152, ptr align 4 %7, i64 4, i1 false)
  %153 = load ptr, ptr %16, align 8, !tbaa !9
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = sub nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = mul i64 %156, 96
  %158 = getelementptr inbounds i8, ptr %153, i64 %157
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %158, ptr align 8 %1, i64 96, i1 false)
  %159 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %159, ptr %4, align 4, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %160

160:                                              ; preds = %147, %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %161 = load i32, ptr %9, align 4
  switch i32 %161, label %172 [
    i32 0, label %162
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %139
  %164 = getelementptr inbounds %struct.HP_info, ptr %0, i32 0, i32 1
  %165 = load i32, ptr %164, align 4, !tbaa !11
  %166 = load i32, ptr %4, align 4, !tbaa !5
  %167 = call i32 @BF_WriteBlock(i32 noundef %165, i32 noundef %166)
  %168 = icmp slt i32 %167, 0
  br i1 %168, label %169, label %170

169:                                              ; preds = %163
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %172

170:                                              ; preds = %163
  %171 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %171, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %172

172:                                              ; preds = %170, %169, %160, %137, %99, %77, %38, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %173 = load i32, ptr %3, align 4
  ret i32 %173
}

declare ptr @get_key(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 4}
!12 = !{!"HP_info", !6, i64 0, !6, i64 4, !7, i64 8, !10, i64 16, !6, i64 24, !6, i64 28}
!13 = !{!12, !6, i64 28}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !6, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !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.HP_info = type { i32, i32, i8, ptr, i32, i32 }
%struct.record = type { i32, [15 x i8], [25 x i8], [50 x i8] }

@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

declare void @BF_PrintError(ptr noundef) local_unnamed_addr #0

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

declare i32 @BF_AllocateBlock(i32 noundef) local_unnamed_addr #0

declare i32 @BF_ReadBlock(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i32 @BF_GetBlockCounter(i32 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) #2

declare i32 @BF_WriteBlock(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress 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 i32 @HP_InsertEntry(ptr nocapture noundef readonly byval(%struct.HP_info) align 8 %0, ptr noundef byval(%struct.record) align 8 %1) local_unnamed_addr #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store ptr null, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 28
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %11 = call i32 @BF_ReadBlock(i32 noundef %8, i32 noundef %10, ptr noundef nonnull %3) #5
  %12 = icmp slt i32 %11, 0
  br i1 %12, label %18, label %.preheader

.preheader:                                       ; preds = %2
  %.pn60 = load ptr, ptr %3, align 8, !tbaa !5
  %.032.in61 = getelementptr inbounds i8, ptr %.pn60, i64 504
  %.03262 = load i32, ptr %.032.in61, align 4, !tbaa !13
  %.not63 = icmp eq i32 %.03262, -1
  br i1 %.not63, label %._crit_edge.thread, label %.lr.ph66

.lr.ph66:                                         ; preds = %.preheader
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load i32, ptr %15, align 8
  %17 = sext i32 %16 to i64
  br label %19

18:                                               ; preds = %2
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #5
  br label %.loopexit

19:                                               ; preds = %.lr.ph66, %.critedge
  %.03265 = phi i32 [ %.03262, %.lr.ph66 ], [ %.032, %.critedge ]
  %.04364 = phi i32 [ -1, %.lr.ph66 ], [ %spec.select, %.critedge ]
  %20 = call i32 @BF_ReadBlock(i32 noundef %8, i32 noundef %.03265, ptr noundef nonnull %3) #5
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #5
  br label %.loopexit

23:                                               ; preds = %19
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 508
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %.not4658 = icmp sgt i32 %26, 0
  br i1 %.not4658, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %23
  %wide.trip.count = zext nneg i32 %26 to i64
  br label %.lr.ph

27:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.loopexit, label %.lr.ph, !llvm.loop !14

.lr.ph:                                           ; preds = %.lr.ph.preheader, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %27 ]
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = mul nuw nsw i64 %indvars.iv, 96
  %30 = getelementptr inbounds i8, ptr %28, i64 %29
  %31 = call ptr @get_key(ptr noundef nonnull %1, ptr noundef %14) #5
  %32 = call ptr @get_key(ptr noundef %30, ptr noundef %14) #5
  %bcmp = call i32 @bcmp(ptr %31, ptr %32, i64 %17)
  %.not45 = icmp eq i32 %bcmp, 0
  br i1 %.not45, label %.loopexit, label %27

.critedge.loopexit:                               ; preds = %27
  %.pn.pre = load ptr, ptr %3, align 8, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %23
  %.pn = phi ptr [ %.pn.pre, %.critedge.loopexit ], [ %24, %23 ]
  %33 = icmp ult i32 %26, 5
  %spec.select = select i1 %33, i32 %.03265, i32 %.04364
  %.032.in = getelementptr inbounds i8, ptr %.pn, i64 504
  %.032 = load i32, ptr %.032.in, align 4, !tbaa !13
  %.not = icmp eq i32 %.032, -1
  br i1 %.not, label %._crit_edge, label %19, !llvm.loop !16

._crit_edge:                                      ; preds = %.critedge
  %34 = icmp eq i32 %spec.select, -1
  br i1 %34, label %._crit_edge.thread, label %56

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %.035.lcssa77 = phi i32 [ %.03265, %._crit_edge ], [ 0, %.preheader ]
  %35 = call i32 @BF_AllocateBlock(i32 noundef %8) #5
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %._crit_edge.thread
  call void @BF_PrintError(ptr noundef nonnull @.str.2) #5
  br label %.loopexit

38:                                               ; preds = %._crit_edge.thread
  %39 = call i32 @BF_GetBlockCounter(i32 noundef %8) #5
  %40 = add nsw i32 %39, -1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  %41 = call i32 @BF_ReadBlock(i32 noundef %8, i32 noundef %40, ptr noundef nonnull %4) #5
  %42 = icmp slt i32 %41, 0
  br i1 %42, label %.critedge48, label %43

.critedge48:                                      ; preds = %38
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %.loopexit

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %44 = call i32 @BF_ReadBlock(i32 noundef %8, i32 noundef %.035.lcssa77, ptr noundef nonnull %5) #5
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #5
  br label %.critedge50

47:                                               ; preds = %43
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 504
  store i32 %40, ptr %49, align 1
  %50 = call i32 @BF_WriteBlock(i32 noundef %8, i32 noundef %.035.lcssa77) #5
  %51 = icmp slt i32 %50, 0
  br i1 %51, label %.critedge50, label %52

52:                                               ; preds = %47
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(96) %53, ptr noundef nonnull align 8 dereferenceable(96) %1, i64 96, i1 false)
  %54 = getelementptr inbounds i8, ptr %53, i64 508
  store i32 1, ptr %54, align 1
  %55 = getelementptr inbounds i8, ptr %53, i64 504
  store i32 -1, ptr %55, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %66

56:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %57 = call i32 @BF_ReadBlock(i32 noundef %8, i32 noundef %spec.select, ptr noundef nonnull %6) #5
  %58 = icmp sgt i32 %57, -1
  br i1 %58, label %.thread, label %65

.thread:                                          ; preds = %56
  %59 = add nsw i32 %26, 1
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 508
  store i32 %59, ptr %61, align 1
  %62 = sext i32 %26 to i64
  %63 = mul nsw i64 %62, 96
  %64 = getelementptr inbounds i8, ptr %60, i64 %63
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(96) %64, ptr noundef nonnull align 8 dereferenceable(96) %1, i64 96, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %66

65:                                               ; preds = %56
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %.loopexit

66:                                               ; preds = %.thread, %52
  %.234 = phi i32 [ %40, %52 ], [ %spec.select, %.thread ]
  %67 = call i32 @BF_WriteBlock(i32 noundef %8, i32 noundef %.234) #5
  %.inv = icmp sgt i32 %67, -1
  %..234 = select i1 %.inv, i32 %.234, i32 -1
  br label %.loopexit

.critedge50:                                      ; preds = %47, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %65, %.critedge50, %66, %.critedge48, %37, %22, %18
  %.7 = phi i32 [ -1, %18 ], [ -1, %22 ], [ -1, %37 ], [ -1, %65 ], [ -1, %.critedge48 ], [ %..234, %66 ], [ -1, %.critedge50 ], [ -1, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 %.7
}

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { nofree nounwind willreturn memory(argmem: read) }
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, !11, i64 4}
!10 = !{!"HP_info", !11, i64 0, !11, i64 4, !7, i64 8, !6, i64 16, !11, i64 24, !11, i64 28}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 28}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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