; LLVM IR from mbheinen/bpa-ipf-tsp :: libgui (dmgr)

; 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.DBID = type { ptr, i64, i64, i64, i64, i64, i64, ptr, i64 }
%struct.schem = type { i8, i8, i64, i64, i64, ptr }

; Function Attrs: nounwind uwtable
declare dso_local void @db_resetlock(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @db_setlock(ptr 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

; Function Attrs: nounwind uwtable
declare hidden void @isearch(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 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

; Function Attrs: nounwind uwtable
define dso_local i32 @db_insert(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca [32 x ptr], align 16
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.DBID, ptr %24, i32 0, i32 3
  %26 = load i64, ptr %25, align 8, !tbaa !9
  store i64 %26, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 256, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.DBID, ptr %27, i32 0, i32 4
  %29 = load i64, ptr %28, align 8, !tbaa !13
  store i64 %29, ptr %18, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.DBID, ptr %30, i32 0, i32 5
  %32 = load i64, ptr %31, align 8, !tbaa !14
  store i64 %32, ptr %19, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %33 = load i64, ptr %19, align 8, !tbaa !12
  %34 = add i64 %33, 8
  store i64 %34, ptr %20, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.DBID, ptr %35, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !15
  %38 = call i64 @db_randomlevel(i64 noundef %37)
  store i64 %38, ptr %21, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  call void @db_setlock(ptr noundef %39)
  br label %40

40:                                               ; preds = %63, %3
  %41 = load i64, ptr %18, align 8, !tbaa !12
  %42 = icmp sgt i64 %41, 0
  br i1 %42, label %43, label %66

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.DBID, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !16
  %47 = load i64, ptr %18, align 8, !tbaa !12
  %48 = getelementptr inbounds [0 x %struct.schem], ptr %46, i64 0, i64 %47
  %49 = getelementptr inbounds %struct.schem, ptr %48, i32 0, i32 0
  %50 = load i8, ptr %49, align 8, !tbaa !17
  %51 = sext i8 %50 to i32
  %52 = icmp eq i32 %51, 117
  br i1 %52, label %53, label %62

53:                                               ; preds = %43
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = load i64, ptr %18, align 8, !tbaa !12
  %57 = call i32 @xsearch(ptr noundef %54, ptr noundef %55, ptr noundef %15, i64 noundef %56)
  %58 = icmp eq i32 %57, 2
  br i1 %58, label %59, label %61

59:                                               ; preds = %53
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  call void @db_resetlock(ptr noundef %60)
  store i32 4, ptr %4, align 4
  store i32 1, ptr %23, align 4
  br label %189

61:                                               ; preds = %53
  br label %62

62:                                               ; preds = %61, %43
  br label %63

63:                                               ; preds = %62
  %64 = load i64, ptr %18, align 8, !tbaa !12
  %65 = add nsw i64 %64, -1
  store i64 %65, ptr %18, align 8, !tbaa !12
  br label %40, !llvm.loop !19

66:                                               ; preds = %40
  %67 = load i64, ptr %21, align 8, !tbaa !12
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.DBID, ptr %68, i32 0, i32 2
  %70 = load i64, ptr %69, align 8, !tbaa !21
  %71 = load i64, ptr %19, align 8, !tbaa !12
  %72 = load i64, ptr %8, align 8, !tbaa !12
  %73 = call i32 @db_newnode(ptr noundef %14, i64 noundef %67, i64 noundef %70, i64 noundef %71, i64 noundef %72)
  store i32 %73, ptr %22, align 4, !tbaa !22
  %74 = load i32, ptr %22, align 4, !tbaa !22
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %79

76:                                               ; preds = %66
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  call void @db_resetlock(ptr noundef %77)
  %78 = load i32, ptr %22, align 4, !tbaa !22
  store i32 %78, ptr %4, align 4
  store i32 1, ptr %23, align 4
  br label %189

79:                                               ; preds = %66
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = load i64, ptr %20, align 8, !tbaa !12
  %82 = getelementptr inbounds i8, ptr %80, i64 %81
  store ptr %82, ptr %10, align 8, !tbaa !5
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = load i64, ptr %19, align 8, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %83, ptr align 1 %85, i64 %86, i1 false)
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.DBID, ptr %87, i32 0, i32 4
  %89 = load i64, ptr %88, align 8, !tbaa !13
  store i64 %89, ptr %18, align 8, !tbaa !12
  br label %90

90:                                               ; preds = %182, %79
  %91 = load i64, ptr %18, align 8, !tbaa !12
  %92 = icmp sgt i64 %91, 0
  br i1 %92, label %93, label %185

93:                                               ; preds = %90
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.DBID, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !16
  %97 = load i64, ptr %18, align 8, !tbaa !12
  %98 = getelementptr inbounds [0 x %struct.schem], ptr %96, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.schem, ptr %98, i32 0, i32 0
  %100 = load i8, ptr %99, align 8, !tbaa !17
  %101 = sext i8 %100 to i32
  %102 = icmp eq i32 %101, 110
  br i1 %102, label %103, label %104

103:                                              ; preds = %93
  br label %182

104:                                              ; preds = %93
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds [32 x ptr], ptr %16, i64 0, i64 0
  %109 = load i64, ptr %18, align 8, !tbaa !12
  call void @isearch(ptr noundef %105, ptr noundef %106, ptr noundef %107, ptr noundef %108, i64 noundef %109)
  %110 = load i64, ptr %21, align 8, !tbaa !12
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.DBID, ptr %111, i32 0, i32 6
  %113 = load i64, ptr %112, align 8, !tbaa !24
  %114 = icmp sgt i64 %110, %113
  br i1 %114, label %115, label %136

115:                                              ; preds = %104
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.DBID, ptr %116, i32 0, i32 6
  %118 = load i64, ptr %117, align 8, !tbaa !24
  store i64 %118, ptr %17, align 8, !tbaa !12
  br label %119

119:                                              ; preds = %129, %115
  %120 = load i64, ptr %17, align 8, !tbaa !12
  %121 = load i64, ptr %21, align 8, !tbaa !12
  %122 = icmp slt i64 %120, %121
  br i1 %122, label %123, label %132

123:                                              ; preds = %119
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.DBID, ptr %124, i32 0, i32 7
  %126 = load ptr, ptr %125, align 8, !tbaa !25
  %127 = load i64, ptr %17, align 8, !tbaa !12
  %128 = getelementptr inbounds [32 x ptr], ptr %16, i64 0, i64 %127
  store ptr %126, ptr %128, align 8, !tbaa !5
  br label %129

129:                                              ; preds = %123
  %130 = load i64, ptr %17, align 8, !tbaa !12
  %131 = add nsw i64 %130, 1
  store i64 %131, ptr %17, align 8, !tbaa !12
  br label %119, !llvm.loop !26

132:                                              ; preds = %119
  %133 = load i64, ptr %21, align 8, !tbaa !12
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.DBID, ptr %134, i32 0, i32 6
  store i64 %133, ptr %135, align 8, !tbaa !24
  br label %136

136:                                              ; preds = %132, %104
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.DBID, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !16
  %140 = load i64, ptr %18, align 8, !tbaa !12
  %141 = getelementptr inbounds [0 x %struct.schem], ptr %139, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.schem, ptr %141, i32 0, i32 4
  %143 = load i64, ptr %142, align 8, !tbaa !27
  store i64 %143, ptr %9, align 8, !tbaa !12
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = load i64, ptr %21, align 8, !tbaa !12
  %146 = load i64, ptr %9, align 8, !tbaa !12
  %147 = mul nsw i64 %145, %146
  %148 = mul i64 %147, 8
  %149 = getelementptr inbounds i8, ptr %144, i64 %148
  store ptr %149, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %17, align 8, !tbaa !12
  br label %150

150:                                              ; preds = %178, %136
  %151 = load i64, ptr %17, align 8, !tbaa !12
  %152 = load i64, ptr %21, align 8, !tbaa !12
  %153 = icmp slt i64 %151, %152
  br i1 %153, label %154, label %181

154:                                              ; preds = %150
  %155 = load i64, ptr %17, align 8, !tbaa !12
  %156 = getelementptr inbounds [32 x ptr], ptr %16, i64 0, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !5
  store ptr %157, ptr %13, align 8, !tbaa !5
  %158 = load ptr, ptr %13, align 8, !tbaa !5
  %159 = load i64, ptr %20, align 8, !tbaa !12
  %160 = getelementptr inbounds i8, ptr %158, i64 %159
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = load i64, ptr %19, align 8, !tbaa !12
  %163 = getelementptr inbounds i8, ptr %161, i64 %162
  %164 = load i64, ptr %163, align 8, !tbaa !12
  %165 = load i64, ptr %9, align 8, !tbaa !12
  %166 = mul nsw i64 %164, %165
  %167 = load i64, ptr %17, align 8, !tbaa !12
  %168 = add nsw i64 %166, %167
  %169 = mul i64 %168, 8
  %170 = getelementptr inbounds i8, ptr %160, i64 %169
  store ptr %170, ptr %12, align 8, !tbaa !5
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = load ptr, ptr %171, align 8, !tbaa !5
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = load i64, ptr %17, align 8, !tbaa !12
  %175 = getelementptr inbounds ptr, ptr %173, i64 %174
  store ptr %172, ptr %175, align 8, !tbaa !5
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %176, ptr %177, align 8, !tbaa !5
  br label %178

178:                                              ; preds = %154
  %179 = load i64, ptr %17, align 8, !tbaa !12
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %17, align 8, !tbaa !12
  br label %150, !llvm.loop !28

181:                                              ; preds = %150
  br label %182

182:                                              ; preds = %181, %103
  %183 = load i64, ptr %18, align 8, !tbaa !12
  %184 = add nsw i64 %183, -1
  store i64 %184, ptr %18, align 8, !tbaa !12
  br label %90, !llvm.loop !29

185:                                              ; preds = %90
  %186 = load ptr, ptr %14, align 8, !tbaa !5
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %186, ptr %187, align 8, !tbaa !5
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  call void @db_resetlock(ptr noundef %188)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %23, align 4
  br label %189

189:                                              ; preds = %185, %76, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 256, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %190 = load i32, ptr %4, align 4
  ret i32 %190
}

; Function Attrs: nounwind uwtable
declare hidden i64 @db_randomlevel(i64 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: readwrite) }
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, !11, i64 24}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !6, i64 56, !11, i64 64}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 32}
!14 = !{!10, !11, i64 40}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"schem", !7, i64 0, !7, i64 1, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !11, i64 16}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = !{!10, !11, i64 48}
!25 = !{!10, !6, i64 56}
!26 = distinct !{!26, !20}
!27 = !{!18, !11, i64 24}
!28 = distinct !{!28, !20}
!29 = distinct !{!29, !20}


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

; Function Attrs: nounwind uwtable
declare dso_local void @db_resetlock(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @db_setlock(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

; 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
declare hidden i32 @db_newnode(ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @isearch(ptr noundef, ptr noundef, ptr noundef, ptr 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) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @db_insert(ptr noundef %0, ptr noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [32 x ptr], align 16
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load i64, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load i64, ptr %11, align 8, !tbaa !12
  %13 = add i64 %12, 8
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i64, ptr %14, align 8, !tbaa !13
  %16 = tail call i64 @db_randomlevel(i64 noundef %15)
  %.fr78 = freeze i64 %16
  tail call void @db_setlock(ptr noundef %0)
  %17 = icmp sgt i64 %10, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %26
  %.06469 = phi i64 [ %27, %26 ], [ %10, %3 ]
  %18 = load ptr, ptr %0, align 8, !tbaa !14
  %19 = getelementptr inbounds [0 x %struct.schem], ptr %18, i64 0, i64 %.06469
  %20 = load i8, ptr %19, align 8, !tbaa !15
  %21 = icmp eq i8 %20, 117
  br i1 %21, label %22, label %26

22:                                               ; preds = %.lr.ph
  %23 = call i32 @xsearch(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %5, i64 noundef %.06469)
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  call void @db_resetlock(ptr noundef nonnull %0)
  br label %122

26:                                               ; preds = %.lr.ph, %22
  %27 = add nsw i64 %.06469, -1
  %28 = icmp sgt i64 %.06469, 1
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %26, %3
  %29 = getelementptr inbounds i8, ptr %0, i64 16
  %30 = load i64, ptr %29, align 8, !tbaa !19
  %31 = call i32 @db_newnode(ptr noundef nonnull %4, i64 noundef %.fr78, i64 noundef %30, i64 noundef %12, i64 noundef %8)
  %.not = icmp eq i32 %31, 0
  br i1 %.not, label %33, label %32

32:                                               ; preds = %._crit_edge
  call void @db_resetlock(ptr noundef nonnull %0)
  br label %122

33:                                               ; preds = %._crit_edge
  %34 = load ptr, ptr %4, align 8, !tbaa !20
  %35 = getelementptr inbounds i8, ptr %34, i64 %13
  %36 = load ptr, ptr %1, align 8, !tbaa !20
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %34, ptr align 1 %36, i64 %12, i1 false)
  %37 = load i64, ptr %9, align 8, !tbaa !11
  %38 = icmp sgt i64 %37, 0
  br i1 %38, label %.lr.ph76, label %._crit_edge77

.lr.ph76:                                         ; preds = %33
  %39 = getelementptr inbounds i8, ptr %0, i64 48
  %40 = getelementptr inbounds i8, ptr %0, i64 56
  %41 = shl i64 %.fr78, 3
  %42 = icmp sgt i64 %.fr78, 0
  br i1 %42, label %.lr.ph76.split.us.preheader, label %.lr.ph76.split

.lr.ph76.split.us.preheader:                      ; preds = %.lr.ph76
  %xtraiter = and i64 %.fr78, 1
  %43 = icmp eq i64 %.fr78, 1
  %unroll_iter = and i64 %.fr78, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph76.split.us

.lr.ph76.split.us:                                ; preds = %.lr.ph76.split.us.preheader, %..loopexit_crit_edge.us
  %.16574.us = phi i64 [ %97, %..loopexit_crit_edge.us ], [ %37, %.lr.ph76.split.us.preheader ]
  %44 = load ptr, ptr %0, align 8, !tbaa !14
  %45 = getelementptr inbounds [0 x %struct.schem], ptr %44, i64 0, i64 %.16574.us
  %46 = load i8, ptr %45, align 8, !tbaa !15
  %47 = icmp eq i8 %46, 110
  br i1 %47, label %..loopexit_crit_edge.us, label %48

48:                                               ; preds = %.lr.ph76.split.us
  %49 = load ptr, ptr %4, align 8, !tbaa !20
  call void @isearch(ptr noundef nonnull %0, ptr noundef %49, ptr noundef nonnull %1, ptr noundef nonnull %6, i64 noundef %.16574.us)
  %50 = load i64, ptr %39, align 8, !tbaa !21
  %51 = icmp sgt i64 %.fr78, %50
  br i1 %51, label %.preheader.us, label %.lr.ph73.us

.loopexit99:                                      ; preds = %scalar.ph85, %middle.block84
  store i64 %.fr78, ptr %39, align 8, !tbaa !21
  br label %.lr.ph73.us

.lr.ph73.us:                                      ; preds = %.loopexit99, %48
  %52 = load ptr, ptr %0, align 8, !tbaa !14
  %53 = getelementptr inbounds [0 x %struct.schem], ptr %52, i64 0, i64 %.16574.us, i32 4
  %54 = load i64, ptr %53, align 8, !tbaa !22
  %55 = mul i64 %41, %54
  %56 = getelementptr inbounds i8, ptr %35, i64 %55
  br i1 %43, label %..loopexit_crit_edge.us.loopexit.unr-lcssa, label %.lr.ph73.us.new

.lr.ph73.us.new:                                  ; preds = %.lr.ph73.us, %.lr.ph73.us.new
  %.171.us = phi i64 [ %82, %.lr.ph73.us.new ], [ 0, %.lr.ph73.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph73.us.new ], [ 0, %.lr.ph73.us ]
  %57 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %.171.us
  %58 = load ptr, ptr %57, align 16, !tbaa !20
  %59 = getelementptr inbounds i8, ptr %58, i64 %13
  %60 = getelementptr inbounds i8, ptr %58, i64 %12
  %61 = load i64, ptr %60, align 8, !tbaa !23
  %62 = mul nsw i64 %61, %54
  %63 = add nsw i64 %62, %.171.us
  %64 = shl i64 %63, 3
  %65 = getelementptr inbounds i8, ptr %59, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !20
  %67 = getelementptr inbounds ptr, ptr %56, i64 %.171.us
  store ptr %66, ptr %67, align 8, !tbaa !20
  %68 = load ptr, ptr %4, align 8, !tbaa !20
  store ptr %68, ptr %65, align 8, !tbaa !20
  %69 = or disjoint i64 %.171.us, 1
  %70 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %69
  %71 = load ptr, ptr %70, align 8, !tbaa !20
  %72 = getelementptr inbounds i8, ptr %71, i64 %13
  %73 = getelementptr inbounds i8, ptr %71, i64 %12
  %74 = load i64, ptr %73, align 8, !tbaa !23
  %75 = mul nsw i64 %74, %54
  %76 = add nsw i64 %75, %69
  %77 = shl i64 %76, 3
  %78 = getelementptr inbounds i8, ptr %72, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !20
  %80 = getelementptr inbounds ptr, ptr %56, i64 %69
  store ptr %79, ptr %80, align 8, !tbaa !20
  %81 = load ptr, ptr %4, align 8, !tbaa !20
  store ptr %81, ptr %78, align 8, !tbaa !20
  %82 = add nuw nsw i64 %.171.us, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %..loopexit_crit_edge.us.loopexit.unr-lcssa, label %.lr.ph73.us.new, !llvm.loop !24

scalar.ph85:                                      ; preds = %scalar.ph85.preheader, %scalar.ph85
  %.06370.us = phi i64 [ %84, %scalar.ph85 ], [ %.06370.us.ph, %scalar.ph85.preheader ]
  %83 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %.06370.us
  store ptr %99, ptr %83, align 8, !tbaa !20
  %84 = add nsw i64 %.06370.us, 1
  %exitcond80.not = icmp eq i64 %84, %.fr78
  br i1 %exitcond80.not, label %.loopexit99, label %scalar.ph85, !llvm.loop !25

..loopexit_crit_edge.us.loopexit.unr-lcssa:       ; preds = %.lr.ph73.us.new, %.lr.ph73.us
  %.171.us.unr = phi i64 [ 0, %.lr.ph73.us ], [ %82, %.lr.ph73.us.new ]
  br i1 %lcmp.mod.not, label %..loopexit_crit_edge.us, label %..loopexit_crit_edge.us.loopexit.epilog-lcssa

..loopexit_crit_edge.us.loopexit.epilog-lcssa:    ; preds = %..loopexit_crit_edge.us.loopexit.unr-lcssa
  %85 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %.171.us.unr
  %86 = load ptr, ptr %85, align 8, !tbaa !20
  %87 = getelementptr inbounds i8, ptr %86, i64 %13
  %88 = getelementptr inbounds i8, ptr %86, i64 %12
  %89 = load i64, ptr %88, align 8, !tbaa !23
  %90 = mul nsw i64 %89, %54
  %91 = add nsw i64 %90, %.171.us.unr
  %92 = shl i64 %91, 3
  %93 = getelementptr inbounds i8, ptr %87, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !20
  %95 = getelementptr inbounds ptr, ptr %56, i64 %.171.us.unr
  store ptr %94, ptr %95, align 8, !tbaa !20
  %96 = load ptr, ptr %4, align 8, !tbaa !20
  store ptr %96, ptr %93, align 8, !tbaa !20
  br label %..loopexit_crit_edge.us

..loopexit_crit_edge.us:                          ; preds = %..loopexit_crit_edge.us.loopexit.epilog-lcssa, %..loopexit_crit_edge.us.loopexit.unr-lcssa, %.lr.ph76.split.us
  %97 = add nsw i64 %.16574.us, -1
  %98 = icmp sgt i64 %.16574.us, 1
  br i1 %98, label %.lr.ph76.split.us, label %._crit_edge77, !llvm.loop !28

.preheader.us:                                    ; preds = %48
  %99 = load ptr, ptr %40, align 8, !tbaa !29
  %100 = sub i64 %.fr78, %50
  %min.iters.check86 = icmp ult i64 %100, 4
  br i1 %min.iters.check86, label %scalar.ph85.preheader, label %vector.ph87

scalar.ph85.preheader:                            ; preds = %middle.block84, %.preheader.us
  %.06370.us.ph = phi i64 [ %50, %.preheader.us ], [ %ind.end90, %middle.block84 ]
  br label %scalar.ph85

vector.ph87:                                      ; preds = %.preheader.us
  %n.vec89 = and i64 %100, -4
  %ind.end90 = add i64 %50, %n.vec89
  %broadcast.splatinsert95 = insertelement <2 x ptr> poison, ptr %99, i64 0
  %broadcast.splat96 = shufflevector <2 x ptr> %broadcast.splatinsert95, <2 x ptr> poison, <2 x i32> zeroinitializer
  br label %vector.body92

vector.body92:                                    ; preds = %vector.body92, %vector.ph87
  %index93 = phi i64 [ 0, %vector.ph87 ], [ %index.next97, %vector.body92 ]
  %offset.idx94 = add i64 %50, %index93
  %101 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %offset.idx94
  %102 = getelementptr inbounds i8, ptr %101, i64 16
  store <2 x ptr> %broadcast.splat96, ptr %101, align 8, !tbaa !20
  store <2 x ptr> %broadcast.splat96, ptr %102, align 8, !tbaa !20
  %index.next97 = add nuw i64 %index93, 4
  %103 = icmp eq i64 %index.next97, %n.vec89
  br i1 %103, label %middle.block84, label %vector.body92, !llvm.loop !30

middle.block84:                                   ; preds = %vector.body92
  %cmp.n98 = icmp eq i64 %100, %n.vec89
  br i1 %cmp.n98, label %.loopexit99, label %scalar.ph85.preheader

.lr.ph76.split:                                   ; preds = %.lr.ph76, %.loopexit
  %.16574 = phi i64 [ %119, %.loopexit ], [ %37, %.lr.ph76 ]
  %104 = load ptr, ptr %0, align 8, !tbaa !14
  %105 = getelementptr inbounds [0 x %struct.schem], ptr %104, i64 0, i64 %.16574
  %106 = load i8, ptr %105, align 8, !tbaa !15
  %107 = icmp eq i8 %106, 110
  br i1 %107, label %.loopexit, label %108

108:                                              ; preds = %.lr.ph76.split
  %109 = load ptr, ptr %4, align 8, !tbaa !20
  call void @isearch(ptr noundef nonnull %0, ptr noundef %109, ptr noundef nonnull %1, ptr noundef nonnull %6, i64 noundef %.16574)
  %110 = load i64, ptr %39, align 8, !tbaa !21
  %111 = icmp sgt i64 %.fr78, %110
  br i1 %111, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %108
  %112 = load ptr, ptr %40, align 8, !tbaa !29
  %113 = sub i64 %.fr78, %110
  %min.iters.check = icmp ult i64 %113, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.preheader
  %n.vec = and i64 %113, -4
  %ind.end = add i64 %110, %n.vec
  %broadcast.splatinsert = insertelement <2 x ptr> poison, ptr %112, i64 0
  %broadcast.splat = shufflevector <2 x ptr> %broadcast.splatinsert, <2 x ptr> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %110, %index
  %114 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %offset.idx
  %115 = getelementptr inbounds i8, ptr %114, i64 16
  store <2 x ptr> %broadcast.splat, ptr %114, align 8, !tbaa !20
  store <2 x ptr> %broadcast.splat, ptr %115, align 8, !tbaa !20
  %index.next = add nuw i64 %index, 4
  %116 = icmp eq i64 %index.next, %n.vec
  br i1 %116, label %middle.block, label %vector.body, !llvm.loop !31

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %113, %n.vec
  br i1 %cmp.n, label %.loopexit100, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %.06370.ph = phi i64 [ %110, %.preheader ], [ %ind.end, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.06370 = phi i64 [ %118, %scalar.ph ], [ %.06370.ph, %scalar.ph.preheader ]
  %117 = getelementptr inbounds [32 x ptr], ptr %6, i64 0, i64 %.06370
  store ptr %112, ptr %117, align 8, !tbaa !20
  %118 = add nsw i64 %.06370, 1
  %exitcond.not = icmp eq i64 %118, %.fr78
  br i1 %exitcond.not, label %.loopexit100, label %scalar.ph, !llvm.loop !32

.loopexit100:                                     ; preds = %scalar.ph, %middle.block
  store i64 %.fr78, ptr %39, align 8, !tbaa !21
  br label %.loopexit

.loopexit:                                        ; preds = %108, %.loopexit100, %.lr.ph76.split
  %119 = add nsw i64 %.16574, -1
  %120 = icmp sgt i64 %.16574, 1
  br i1 %120, label %.lr.ph76.split, label %._crit_edge77, !llvm.loop !28

._crit_edge77:                                    ; preds = %.loopexit, %..loopexit_crit_edge.us, %33
  %121 = load ptr, ptr %4, align 8, !tbaa !20
  store ptr %121, ptr %2, align 8, !tbaa !20
  call void @db_resetlock(ptr noundef %0)
  br label %122

122:                                              ; preds = %._crit_edge77, %32, %25
  %.0 = phi i32 [ 4, %25 ], [ %31, %32 ], [ 0, %._crit_edge77 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i64 @db_randomlevel(i64 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 24}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !10, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 32}
!12 = !{!6, !10, i64 40}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !8, i64 0}
!16 = !{!"schem", !8, i64 0, !8, i64 1, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !10, i64 16}
!20 = !{!7, !7, i64 0}
!21 = !{!6, !10, i64 48}
!22 = !{!16, !10, i64 24}
!23 = !{!10, !10, i64 0}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18, !26, !27}
!26 = !{!"llvm.loop.unroll.runtime.disable"}
!27 = !{!"llvm.loop.isvectorized", i32 1}
!28 = distinct !{!28, !18}
!29 = !{!6, !7, i64 56}
!30 = distinct !{!30, !18, !27, !26}
!31 = distinct !{!31, !18, !27, !26}
!32 = distinct !{!32, !18, !26, !27}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass