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

; 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.HT_info = type { i32, i32, i8, ptr, i32, i64, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @HT_CreateIndex(ptr noundef %0, i8 noundef signext %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct.HT_info, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i8 %1, ptr %8, align 1, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !10
  store i32 %4, ptr %11, align 4, !tbaa !10
  call void (...) @BF_Init()
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call i32 @BF_CreateFile(ptr noundef %26)
  %28 = icmp slt i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %5
  call void @BF_PrintError(ptr noundef @.str)
  store i32 -1, ptr %6, align 4
  br label %180

30:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = call i32 @BF_OpenFile(ptr noundef %31)
  store i32 %32, ptr %12, align 4, !tbaa !10
  %33 = icmp slt i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %30
  call void @BF_PrintError(ptr noundef @.str.1)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %179

35:                                               ; preds = %30
  %36 = load i32, ptr %12, align 4, !tbaa !10
  %37 = call i32 @BF_AllocateBlock(i32 noundef %36)
  %38 = icmp slt i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %35
  call void @BF_PrintError(ptr noundef @.str.2)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %179

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store ptr null, ptr %14, align 8, !tbaa !5
  %41 = load i32, ptr %12, align 4, !tbaa !10
  %42 = load i32, ptr %12, align 4, !tbaa !10
  %43 = call i32 @BF_GetBlockCounter(i32 noundef %42)
  %44 = sub nsw i32 %43, 1
  %45 = call i32 @BF_ReadBlock(i32 noundef %41, i32 noundef %44, ptr noundef %14)
  %46 = icmp slt i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %178

48:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #7
  %49 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 0
  store i32 1, ptr %49, align 8, !tbaa !12
  %50 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 1
  %51 = load i32, ptr %12, align 4, !tbaa !10
  store i32 %51, ptr %50, align 4, !tbaa !15
  %52 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 2
  %53 = load i8, ptr %8, align 1, !tbaa !9
  store i8 %53, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 3
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = call i64 @strlen(ptr noundef %55) #8
  %57 = add i64 %56, 1
  %58 = mul i64 1, %57
  %59 = call noalias ptr @malloc(i64 noundef %58) #9
  store ptr %59, ptr %54, align 8, !tbaa !17
  %60 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 4
  %61 = load i32, ptr %10, align 4, !tbaa !10
  store i32 %61, ptr %60, align 8, !tbaa !18
  %62 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 5
  %63 = load i32, ptr %11, align 4, !tbaa !10
  %64 = sext i32 %63 to i64
  store i64 %64, ptr %62, align 8, !tbaa !19
  %65 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 6
  %66 = load i32, ptr %12, align 4, !tbaa !10
  %67 = call i32 @BF_GetBlockCounter(i32 noundef %66)
  %68 = sub nsw i32 %67, 1
  store i32 %68, ptr %65, align 8, !tbaa !20
  %69 = getelementptr inbounds %struct.HT_info, ptr %15, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = call ptr @strcpy(ptr noundef %70, ptr noundef %71) #7
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %73, ptr align 8 %15, i64 48, i1 false)
  %74 = load i32, ptr %12, align 4, !tbaa !10
  %75 = load i32, ptr %12, align 4, !tbaa !10
  %76 = call i32 @BF_GetBlockCounter(i32 noundef %75)
  %77 = sub nsw i32 %76, 1
  %78 = call i32 @BF_WriteBlock(i32 noundef %74, i32 noundef %77)
  %79 = icmp slt i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %48
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %177

81:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %82 = load i32, ptr %11, align 4, !tbaa !10
  %83 = sext i32 %82 to i64
  %84 = mul i64 %83, 4
  %85 = udiv i64 %84, 508
  %86 = trunc i64 %85 to i32
  store i32 %86, ptr %16, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %87 = load i32, ptr %11, align 4, !tbaa !10
  %88 = sext i32 %87 to i64
  %89 = mul i64 %88, 4
  %90 = urem i64 %89, 508
  %91 = trunc i64 %90 to i32
  store i32 %91, ptr %17, align 4, !tbaa !10
  %92 = load i32, ptr %17, align 4, !tbaa !10
  %93 = icmp sgt i32 %92, 0
  br i1 %93, label %94, label %97

94:                                               ; preds = %81
  %95 = load i32, ptr %16, align 4, !tbaa !10
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %16, align 4, !tbaa !10
  br label %97

97:                                               ; preds = %94, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %98, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %99 = load i32, ptr %12, align 4, !tbaa !10
  %100 = call i32 @BF_GetBlockCounter(i32 noundef %99)
  %101 = sub nsw i32 %100, 1
  store i32 %101, ptr %21, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 1, ptr %22, align 4, !tbaa !10
  br label %102

102:                                              ; preds = %170, %97
  %103 = load i32, ptr %22, align 4, !tbaa !10
  %104 = load i32, ptr %16, align 4, !tbaa !10
  %105 = icmp sle i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 2, ptr %13, align 4
  br label %173

107:                                              ; preds = %102
  %108 = load i32, ptr %12, align 4, !tbaa !10
  %109 = call i32 @BF_AllocateBlock(i32 noundef %108)
  %110 = icmp slt i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %107
  call void @BF_PrintError(ptr noundef @.str.2)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %173

112:                                              ; preds = %107
  %113 = load i32, ptr %12, align 4, !tbaa !10
  %114 = call i32 @BF_GetBlockCounter(i32 noundef %113)
  %115 = sub nsw i32 %114, 1
  store i32 %115, ptr %20, align 4, !tbaa !10
  %116 = load i32, ptr %12, align 4, !tbaa !10
  %117 = load i32, ptr %20, align 4, !tbaa !10
  %118 = call i32 @BF_ReadBlock(i32 noundef %116, i32 noundef %117, ptr noundef %18)
  %119 = icmp slt i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %112
  call void @BF_PrintError(ptr noundef @.str.3)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %173

121:                                              ; preds = %112
  %122 = load ptr, ptr %19, align 8, !tbaa !5
  %123 = getelementptr inbounds i8, ptr %122, i64 512
  %124 = getelementptr inbounds i8, ptr %123, i64 -4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %124, ptr align 4 %20, i64 4, i1 false)
  %125 = load i32, ptr %12, align 4, !tbaa !10
  %126 = load i32, ptr %21, align 4, !tbaa !10
  %127 = call i32 @BF_WriteBlock(i32 noundef %125, i32 noundef %126)
  %128 = icmp slt i32 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %121
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %173

130:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %131 = load i32, ptr %22, align 4, !tbaa !10
  %132 = load i32, ptr %16, align 4, !tbaa !10
  %133 = icmp eq i32 %131, %132
  br i1 %133, label %134, label %142

134:                                              ; preds = %130
  %135 = load i32, ptr %17, align 4, !tbaa !10
  %136 = icmp sgt i32 %135, 0
  br i1 %136, label %137, label %142

137:                                              ; preds = %134
  %138 = load i32, ptr %17, align 4, !tbaa !10
  %139 = sext i32 %138 to i64
  %140 = udiv i64 %139, 4
  %141 = trunc i64 %140 to i32
  store i32 %141, ptr %23, align 4, !tbaa !10
  br label %143

142:                                              ; preds = %134, %130
  store i32 127, ptr %23, align 4, !tbaa !10
  br label %143

143:                                              ; preds = %142, %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 -1, ptr %24, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !10
  br label %144

144:                                              ; preds = %155, %143
  %145 = load i32, ptr %25, align 4, !tbaa !10
  %146 = load i32, ptr %23, align 4, !tbaa !10
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %158

149:                                              ; preds = %144
  %150 = load ptr, ptr %18, align 8, !tbaa !5
  %151 = load i32, ptr %25, align 4, !tbaa !10
  %152 = sext i32 %151 to i64
  %153 = mul i64 %152, 4
  %154 = getelementptr inbounds i8, ptr %150, i64 %153
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %154, ptr align 4 %24, i64 4, i1 false)
  br label %155

155:                                              ; preds = %149
  %156 = load i32, ptr %25, align 4, !tbaa !10
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %25, align 4, !tbaa !10
  br label %144, !llvm.loop !21

158:                                              ; preds = %148
  %159 = load i32, ptr %12, align 4, !tbaa !10
  %160 = load i32, ptr %20, align 4, !tbaa !10
  %161 = call i32 @BF_WriteBlock(i32 noundef %159, i32 noundef %160)
  %162 = icmp slt i32 %161, 0
  br i1 %162, label %163, label %164

163:                                              ; preds = %158
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %167

164:                                              ; preds = %158
  %165 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %165, ptr %19, align 8, !tbaa !5
  %166 = load i32, ptr %20, align 4, !tbaa !10
  store i32 %166, ptr %21, align 4, !tbaa !10
  store i32 0, ptr %13, align 4
  br label %167

167:                                              ; preds = %164, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  %168 = load i32, ptr %13, align 4
  switch i32 %168, label %173 [
    i32 0, label %169
  ]

169:                                              ; preds = %167
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %22, align 4, !tbaa !10
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %22, align 4, !tbaa !10
  br label %102, !llvm.loop !23

173:                                              ; preds = %167, %129, %120, %111, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  %174 = load i32, ptr %13, align 4
  switch i32 %174, label %176 [
    i32 2, label %175
  ]

175:                                              ; preds = %173
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %176

176:                                              ; preds = %175, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %177

177:                                              ; preds = %176, %80
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #7
  br label %178

178:                                              ; preds = %177, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %179

179:                                              ; preds = %178, %39, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %180

180:                                              ; preds = %179, %29
  %181 = load i32, ptr %6, align 4
  ret i32 %181
}

declare void @BF_Init(...) #1

declare i32 @BF_CreateFile(ptr noundef) #1

declare void @BF_PrintError(ptr noundef) #1

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

declare i32 @BF_OpenFile(ptr noundef) #1

declare i32 @BF_AllocateBlock(i32 noundef) #1

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

declare i32 @BF_GetBlockCounter(i32 noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #5

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

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

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

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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind allocsize(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 "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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"HT_info", !11, i64 0, !11, i64 4, !7, i64 8, !6, i64 16, !11, i64 24, !14, i64 32, !11, i64 40}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !11, i64 4}
!16 = !{!13, !7, i64 8}
!17 = !{!13, !6, i64 16}
!18 = !{!13, !11, i64 24}
!19 = !{!13, !14, i64 32}
!20 = !{!13, !11, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @HT_CreateIndex(ptr noundef %0, i8 noundef signext %1, ptr nocapture noundef readonly %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  tail call void (...) @BF_Init() #7
  %8 = tail call i32 @BF_CreateFile(ptr noundef %0) #7
  %9 = icmp slt i32 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %5
  tail call void @BF_PrintError(ptr noundef nonnull @.str) #7
  br label %113

11:                                               ; preds = %5
  %12 = tail call i32 @BF_OpenFile(ptr noundef %0) #7
  %13 = icmp slt i32 %12, 0
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  tail call void @BF_PrintError(ptr noundef nonnull @.str.1) #7
  br label %113

15:                                               ; preds = %11
  %16 = tail call i32 @BF_AllocateBlock(i32 noundef %12) #7
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  tail call void @BF_PrintError(ptr noundef nonnull @.str.2) #7
  br label %113

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  store ptr null, ptr %6, align 8, !tbaa !5
  %20 = tail call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %21 = add nsw i32 %20, -1
  %22 = call i32 @BF_ReadBlock(i32 noundef %12, i32 noundef %21, ptr noundef nonnull %6) #7
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %19
  call void @BF_PrintError(ptr noundef nonnull @.str.3) #7
  br label %112

25:                                               ; preds = %19
  %26 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #8
  %27 = add i64 %26, 1
  %28 = call noalias ptr @malloc(i64 noundef %27) #9
  %29 = sext i32 %4 to i64
  %30 = call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %31 = add nsw i32 %30, -1
  %32 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %28, ptr noundef nonnull dereferenceable(1) %2) #7
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 1, ptr %33, align 1
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 4
  store i32 %12, ptr %.sroa.4.0..sroa_idx, align 1
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 8
  store i8 %1, ptr %.sroa.5.0..sroa_idx, align 1
  %.sroa.620.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 16
  store ptr %28, ptr %.sroa.620.0..sroa_idx, align 1
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 24
  store i32 %3, ptr %.sroa.8.0..sroa_idx, align 1
  %.sroa.921.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 32
  store i64 %29, ptr %.sroa.921.0..sroa_idx, align 1
  %.sroa.10.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 40
  store i32 %31, ptr %.sroa.10.0..sroa_idx, align 1
  %34 = call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %35 = add nsw i32 %34, -1
  %36 = call i32 @BF_WriteBlock(i32 noundef %12, i32 noundef %35) #7
  %37 = icmp slt i32 %36, 0
  br i1 %37, label %112, label %38

38:                                               ; preds = %25
  %39 = shl nsw i64 %29, 2
  %40 = udiv i64 %39, 508
  %41 = trunc i64 %40 to i32
  %42 = urem i64 %39, 508
  %43 = icmp ne i64 %42, 0
  %44 = zext i1 %43 to i32
  %spec.select = add i32 %44, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  store ptr null, ptr %7, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %.not64 = icmp sgt i32 %spec.select, 0
  br i1 %.not64, label %.lr.ph70, label %.loopexit

.lr.ph70:                                         ; preds = %38
  %47 = add nsw i32 %46, -1
  br i1 %43, label %.lr.ph70.split.preheader, label %.lr.ph70.split.us

.lr.ph70.split.preheader:                         ; preds = %.lr.ph70
  %48 = lshr exact i64 %42, 2
  %49 = trunc nuw nsw i64 %48 to i32
  %50 = call i32 @llvm.umax.i32(i32 %49, i32 1)
  br label %.lr.ph70.split

.lr.ph70.split.us:                                ; preds = %.lr.ph70, %62
  %.not68.us = phi i1 [ %.not.us, %62 ], [ true, %.lr.ph70 ]
  %.04967.us = phi i32 [ %64, %62 ], [ 1, %.lr.ph70 ]
  %.05066.us = phi i32 [ %55, %62 ], [ %47, %.lr.ph70 ]
  %.05465.us = phi ptr [ %63, %62 ], [ %45, %.lr.ph70 ]
  %51 = call i32 @BF_AllocateBlock(i32 noundef %12) #7
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %.loopexit.sink.split, label %53

53:                                               ; preds = %.lr.ph70.split.us
  %54 = call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %55 = add nsw i32 %54, -1
  %56 = call i32 @BF_ReadBlock(i32 noundef %12, i32 noundef %55, ptr noundef nonnull %7) #7
  %57 = icmp slt i32 %56, 0
  br i1 %57, label %.loopexit.sink.split, label %58

58:                                               ; preds = %53
  %59 = getelementptr inbounds i8, ptr %.05465.us, i64 508
  store i32 %55, ptr %59, align 1
  %60 = call i32 @BF_WriteBlock(i32 noundef %12, i32 noundef %.05066.us) #7
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %.loopexit, label %.lr.ph.us

62:                                               ; preds = %._crit_edge.us
  %63 = load ptr, ptr %7, align 8
  %64 = add nuw i32 %.04967.us, 1
  %.not.us = icmp slt i32 %.04967.us, %spec.select
  %exitcond92.not = icmp eq i32 %.04967.us, %spec.select
  br i1 %exitcond92.not, label %.loopexit, label %.lr.ph70.split.us, !llvm.loop !9

.lr.ph.us:                                        ; preds = %58, %.lr.ph.us.3
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.lr.ph.us.3 ], [ 0, %58 ]
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = shl nuw nsw i64 %indvars.iv, 2
  %67 = getelementptr inbounds i8, ptr %65, i64 %66
  store i32 -1, ptr %67, align 1
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next = shl i64 %indvars.iv, 2
  %69 = or disjoint i64 %indvars.iv.next, 4
  %70 = getelementptr inbounds i8, ptr %68, i64 %69
  store i32 -1, ptr %70, align 1
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next.1 = shl i64 %indvars.iv, 2
  %72 = or disjoint i64 %indvars.iv.next.1, 8
  %73 = getelementptr inbounds i8, ptr %71, i64 %72
  store i32 -1, ptr %73, align 1
  %exitcond.not.2 = icmp eq i64 %indvars.iv, 124
  br i1 %exitcond.not.2, label %._crit_edge.us, label %.lr.ph.us.3, !llvm.loop !11

.lr.ph.us.3:                                      ; preds = %.lr.ph.us
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next.2 = shl i64 %indvars.iv, 2
  %75 = or disjoint i64 %indvars.iv.next.2, 12
  %76 = getelementptr inbounds i8, ptr %74, i64 %75
  store i32 -1, ptr %76, align 1
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  br label %.lr.ph.us

._crit_edge.us:                                   ; preds = %.lr.ph.us
  %77 = call i32 @BF_WriteBlock(i32 noundef %12, i32 noundef %55) #7
  %78 = icmp sgt i32 %77, -1
  br i1 %78, label %62, label %.loopexit

.lr.ph70.split:                                   ; preds = %.lr.ph70.split.preheader, %109
  %.not68 = phi i1 [ %.not, %109 ], [ true, %.lr.ph70.split.preheader ]
  %.04967 = phi i32 [ %111, %109 ], [ 1, %.lr.ph70.split.preheader ]
  %.05066 = phi i32 [ %83, %109 ], [ %47, %.lr.ph70.split.preheader ]
  %.05465 = phi ptr [ %110, %109 ], [ %45, %.lr.ph70.split.preheader ]
  %79 = call i32 @BF_AllocateBlock(i32 noundef %12) #7
  %80 = icmp slt i32 %79, 0
  br i1 %80, label %.loopexit.sink.split, label %81

81:                                               ; preds = %.lr.ph70.split
  %82 = call i32 @BF_GetBlockCounter(i32 noundef %12) #7
  %83 = add nsw i32 %82, -1
  %84 = call i32 @BF_ReadBlock(i32 noundef %12, i32 noundef %83, ptr noundef nonnull %7) #7
  %85 = icmp slt i32 %84, 0
  br i1 %85, label %.loopexit.sink.split, label %86

86:                                               ; preds = %81
  %87 = getelementptr inbounds i8, ptr %.05465, i64 508
  store i32 %83, ptr %87, align 1
  %88 = call i32 @BF_WriteBlock(i32 noundef %12, i32 noundef %.05066) #7
  %89 = icmp slt i32 %88, 0
  br i1 %89, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %86
  %90 = icmp eq i32 %.04967, %spec.select
  %umax = select i1 %90, i32 %50, i32 127
  %wide.trip.count = zext nneg i32 %umax to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %91 = icmp ult i32 %umax, 4
  br i1 %91, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv93.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next94.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %indvars.iv93.epil = phi i64 [ %indvars.iv.next94.epil, %.lr.ph.epil ], [ %indvars.iv93.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.unr-lcssa ]
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = shl nuw nsw i64 %indvars.iv93.epil, 2
  %94 = getelementptr inbounds i8, ptr %92, i64 %93
  store i32 -1, ptr %94, align 1
  %indvars.iv.next94.epil = add nuw nsw i64 %indvars.iv93.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.unr-lcssa
  %95 = call i32 @BF_WriteBlock(i32 noundef %12, i32 noundef %83) #7
  %96 = icmp sgt i32 %95, -1
  br i1 %96, label %109, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv93 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next94.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = shl nuw nsw i64 %indvars.iv93, 2
  %99 = getelementptr inbounds i8, ptr %97, i64 %98
  store i32 -1, ptr %99, align 1
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next94 = shl i64 %indvars.iv93, 2
  %101 = or disjoint i64 %indvars.iv.next94, 4
  %102 = getelementptr inbounds i8, ptr %100, i64 %101
  store i32 -1, ptr %102, align 1
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next94.1 = shl i64 %indvars.iv93, 2
  %104 = or disjoint i64 %indvars.iv.next94.1, 8
  %105 = getelementptr inbounds i8, ptr %103, i64 %104
  store i32 -1, ptr %105, align 1
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %indvars.iv.next94.2 = shl i64 %indvars.iv93, 2
  %107 = or disjoint i64 %indvars.iv.next94.2, 12
  %108 = getelementptr inbounds i8, ptr %106, i64 %107
  store i32 -1, ptr %108, align 1
  %indvars.iv.next94.3 = add nuw nsw i64 %indvars.iv93, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !11

109:                                              ; preds = %._crit_edge
  %110 = load ptr, ptr %7, align 8
  %111 = add nuw i32 %.04967, 1
  %.not = icmp slt i32 %.04967, %spec.select
  %exitcond97.not = icmp eq i32 %.04967, %spec.select
  br i1 %exitcond97.not, label %.loopexit, label %.lr.ph70.split, !llvm.loop !9

.loopexit.sink.split:                             ; preds = %53, %.lr.ph70.split.us, %81, %.lr.ph70.split
  %.str.3.sink = phi ptr [ @.str.2, %.lr.ph70.split ], [ @.str.3, %81 ], [ @.str.2, %.lr.ph70.split.us ], [ @.str.3, %53 ]
  %.not62.ph = phi i1 [ %.not68, %.lr.ph70.split ], [ %.not68, %81 ], [ %.not68.us, %.lr.ph70.split.us ], [ %.not68.us, %53 ]
  call void @BF_PrintError(ptr noundef nonnull %.str.3.sink) #7
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge.us, %62, %58, %._crit_edge, %109, %86, %.loopexit.sink.split, %38
  %.not62 = phi i1 [ false, %38 ], [ %.not62.ph, %.loopexit.sink.split ], [ %.not68, %._crit_edge ], [ %.not, %109 ], [ %.not68, %86 ], [ %.not68.us, %._crit_edge.us ], [ %.not.us, %62 ], [ %.not68.us, %58 ]
  %spec.select59 = sext i1 %.not62 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %112

112:                                              ; preds = %.loopexit, %25, %24
  %.5 = phi i32 [ -1, %24 ], [ %spec.select59, %.loopexit ], [ -1, %25 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %113

113:                                              ; preds = %14, %18, %112, %10
  %.7 = phi i32 [ -1, %10 ], [ -1, %14 ], [ -1, %18 ], [ %.5, %112 ]
  ret i32 %.7
}

declare void @BF_Init(...) local_unnamed_addr #1

declare i32 @BF_CreateFile(ptr noundef) local_unnamed_addr #1

declare void @BF_PrintError(ptr noundef) local_unnamed_addr #1

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

declare i32 @BF_OpenFile(ptr noundef) local_unnamed_addr #1

declare i32 @BF_AllocateBlock(i32 noundef) local_unnamed_addr #1

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

declare i32 @BF_GetBlockCounter(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #6

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 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: 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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}


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