; LLVM IR from cruppstahl/upscaledb :: unittests (issue101)

; 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.ups_parameter_t = type { i32, i64 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%struct.ups_record_t = type { i32, ptr, i32 }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@__const.main.params = external hidden unnamed_addr constant [2 x %struct.ups_parameter_t], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14fillWithRandomP8ups_db_tm(ptr noundef, i64 noundef) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

declare i32 @ups_db_insert(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca [2 x %struct.ups_parameter_t], align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.ups_key_t, align 8
  %11 = alloca %struct.ups_key_t, align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.ups_record_t, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %14 = call i32 @ups_env_create(ptr noundef %2, ptr noundef @.str, i32 noundef 131072, i32 noundef 436, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.main.params, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds [2 x %struct.ups_parameter_t], ptr %3, i64 0, i64 0
  %17 = call i32 @ups_env_create_db(ptr noundef %15, ptr noundef %4, i16 noundef zeroext 1, i32 noundef 0, ptr noundef %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds [2 x %struct.ups_parameter_t], ptr %3, i64 0, i64 0
  %20 = call i32 @ups_env_create_db(ptr noundef %18, ptr noundef %5, i16 noundef zeroext 2, i32 noundef 0, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 200, ptr %6, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load i64, ptr %6, align 8, !tbaa !9
  call void @_Z14fillWithRandomP8ups_db_tm(ptr noundef %21, i64 noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  br label %23

23:                                               ; preds = %80, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call i32 @ups_cursor_create(ptr noundef %8, ptr noundef %24, ptr noundef null, i32 noundef 0)
  store i32 %25, ptr %7, align 4, !tbaa !11
  %26 = icmp ne i32 0, %25
  br i1 %26, label %27, label %31

27:                                               ; preds = %23
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %29 = load i32, ptr %7, align 4, !tbaa !11
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %28, i32 noundef %29)
  br label %31

31:                                               ; preds = %27, %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #7
  %32 = getelementptr inbounds %struct.ups_key_t, ptr %10, i32 0, i32 0
  store i16 4, ptr %32, align 8, !tbaa !13
  %33 = getelementptr inbounds %struct.ups_key_t, ptr %10, i32 0, i32 1
  store ptr %9, ptr %33, align 8, !tbaa !16
  %34 = getelementptr inbounds %struct.ups_key_t, ptr %10, i32 0, i32 2
  store i32 0, ptr %34, align 8, !tbaa !17
  %35 = getelementptr inbounds %struct.ups_key_t, ptr %10, i32 0, i32 3
  store i32 0, ptr %35, align 4, !tbaa !18
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call i32 @ups_cursor_find(ptr noundef %36, ptr noundef %10, ptr noundef null, i32 noundef 24576)
  store i32 %37, ptr %7, align 4, !tbaa !11
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %43

39:                                               ; preds = %31
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %41 = load i32, ptr %7, align 4, !tbaa !11
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %40, i32 noundef %41)
  br label %43

43:                                               ; preds = %39, %31
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #7
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %70, %43
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call i32 @ups_cursor_move(ptr noundef %45, ptr noundef %11, ptr noundef null, i32 noundef 4)
  store i32 %46, ptr %7, align 4, !tbaa !11
  %47 = icmp eq i32 0, %46
  br i1 %47, label %48, label %52

48:                                               ; preds = %44
  %49 = load i64, ptr %12, align 8, !tbaa !9
  %50 = add i64 %49, 1
  store i64 %50, ptr %12, align 8, !tbaa !9
  %51 = icmp ule i64 %49, 100
  br label %52

52:                                               ; preds = %48, %44
  %53 = phi i1 [ false, %44 ], [ %51, %48 ]
  br i1 %53, label %54, label %71

54:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 24, i1 false)
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = call i32 @ups_db_insert(ptr noundef %55, ptr noundef null, ptr noundef %11, ptr noundef %13, i32 noundef 0)
  store i32 %56, ptr %7, align 4, !tbaa !11
  %57 = icmp ne i32 0, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %60 = load i32, ptr %7, align 4, !tbaa !11
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %59, i32 noundef %60)
  br label %62

62:                                               ; preds = %58, %54
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = call i32 @ups_db_erase(ptr noundef %63, ptr noundef null, ptr noundef %11, i32 noundef 0)
  store i32 %64, ptr %7, align 4, !tbaa !11
  %65 = icmp ne i32 0, %64
  br i1 %65, label %66, label %70

66:                                               ; preds = %62
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %68 = load i32, ptr %7, align 4, !tbaa !11
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef %68)
  br label %70

70:                                               ; preds = %66, %62
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  br label %44, !llvm.loop !19

71:                                               ; preds = %52
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = call i32 @ups_cursor_close(ptr noundef %72)
  store i32 %73, ptr %7, align 4, !tbaa !11
  %74 = icmp ne i32 0, %73
  br i1 %74, label %75, label %79

75:                                               ; preds = %71
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %77 = load i32, ptr %7, align 4, !tbaa !11
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %76, i32 noundef %77)
  br label %79

79:                                               ; preds = %75, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %6, align 8, !tbaa !9
  %82 = sub i64 %81, 100
  store i64 %82, ptr %6, align 8, !tbaa !9
  %83 = icmp ugt i64 %82, 0
  br i1 %83, label %23, label %84, !llvm.loop !21

84:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  ret i32 0
}

declare i32 @ups_env_create(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare i32 @ups_env_create_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) #4

declare i32 @ups_cursor_create(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

declare i32 @ups_cursor_find(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @ups_cursor_move(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @ups_db_erase(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @ups_cursor_close(ptr noundef) #4

attributes #0 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "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 norecurse 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 #6 = { inlinehint mustprogress 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 #7 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTS9ups_key_t", !15, i64 0, !6, i64 8, !12, i64 16, !12, i64 20}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !12, i64 16}
!18 = !{!14, !12, i64 20}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !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.ups_parameter_t = type { i32, i64 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%struct.ups_record_t = type { i32, ptr, i32 }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@__const.main.params = external hidden unnamed_addr constant [2 x %struct.ups_parameter_t], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

declare i32 @ups_db_insert(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #5 {
  %1 = alloca ptr, align 8
  %2 = alloca [2 x %struct.ups_parameter_t], align 16
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %struct.ups_key_t, align 8
  %8 = alloca %struct.ups_key_t, align 8
  %9 = alloca %struct.ups_record_t, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %10 = call i32 @ups_env_create(ptr noundef nonnull %1, ptr noundef nonnull @.str, i32 noundef 131072, i32 noundef 436, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %2, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.params, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = call i32 @ups_env_create_db(ptr noundef %11, ptr noundef nonnull %3, i16 noundef zeroext 1, i32 noundef 0, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = call i32 @ups_env_create_db(ptr noundef %13, ptr noundef nonnull %4, i16 noundef zeroext 2, i32 noundef 0, ptr noundef nonnull %2)
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_Z14fillWithRandomP8ups_db_tm(ptr noundef %15, i64 noundef 200)
  %16 = getelementptr inbounds i8, ptr %7, i64 8
  %17 = getelementptr inbounds i8, ptr %7, i64 16
  %18 = getelementptr inbounds i8, ptr %7, i64 20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = call i32 @ups_cursor_create(ptr noundef nonnull %5, ptr noundef %19, ptr noundef null, i32 noundef 0)
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %24, label %21

21:                                               ; preds = %0
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef %20)
  br label %24

24:                                               ; preds = %21, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  store i16 4, ptr %7, align 8, !tbaa !11
  store ptr %6, ptr %16, align 8, !tbaa !14
  store i32 0, ptr %17, align 8, !tbaa !15
  store i32 0, ptr %18, align 4, !tbaa !16
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i32 @ups_cursor_find(ptr noundef %25, ptr noundef nonnull %7, ptr noundef null, i32 noundef 24576)
  %.not15 = icmp eq i32 %26, 0
  br i1 %.not15, label %30, label %27

27:                                               ; preds = %24
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %28, i32 noundef %26)
  br label %30

30:                                               ; preds = %27, %24
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call i32 @ups_cursor_move(ptr noundef %31, ptr noundef nonnull %8, ptr noundef null, i32 noundef 4)
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %30, %47
  %.020 = phi i64 [ %34, %47 ], [ 0, %30 ]
  %34 = add nuw nsw i64 %.020, 1
  %exitcond.not = icmp eq i64 %.020, 101
  br i1 %exitcond.not, label %.critedge, label %35

35:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call i32 @ups_db_insert(ptr noundef %36, ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 0)
  %.not18 = icmp eq i32 %37, 0
  br i1 %.not18, label %41, label %38

38:                                               ; preds = %35
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %39, i32 noundef %37)
  br label %41

41:                                               ; preds = %38, %35
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = call i32 @ups_db_erase(ptr noundef %42, ptr noundef null, ptr noundef nonnull %8, i32 noundef 0)
  %.not19 = icmp eq i32 %43, 0
  br i1 %.not19, label %47, label %44

44:                                               ; preds = %41
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %45, i32 noundef %43)
  br label %47

47:                                               ; preds = %44, %41
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = call i32 @ups_cursor_move(ptr noundef %48, ptr noundef nonnull %8, ptr noundef null, i32 noundef 4)
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %.lr.ph, label %.critedge, !llvm.loop !17

.critedge:                                        ; preds = %.lr.ph, %47, %30
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call i32 @ups_cursor_close(ptr noundef %51)
  %.not16 = icmp eq i32 %52, 0
  br i1 %.not16, label %56, label %53

53:                                               ; preds = %.critedge
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %54, i32 noundef %52)
  br label %56

56:                                               ; preds = %53, %.critedge
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = call i32 @ups_cursor_create(ptr noundef nonnull %5, ptr noundef %57, ptr noundef null, i32 noundef 0)
  %.not.1 = icmp eq i32 %58, 0
  br i1 %.not.1, label %62, label %59

59:                                               ; preds = %56
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %60, i32 noundef %58)
  br label %62

62:                                               ; preds = %59, %56
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  store i16 4, ptr %7, align 8, !tbaa !11
  store ptr %6, ptr %16, align 8, !tbaa !14
  store i32 0, ptr %17, align 8, !tbaa !15
  store i32 0, ptr %18, align 4, !tbaa !16
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = call i32 @ups_cursor_find(ptr noundef %63, ptr noundef nonnull %7, ptr noundef null, i32 noundef 24576)
  %.not15.1 = icmp eq i32 %64, 0
  br i1 %.not15.1, label %68, label %65

65:                                               ; preds = %62
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %66, i32 noundef %64)
  br label %68

68:                                               ; preds = %65, %62
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = call i32 @ups_cursor_move(ptr noundef %69, ptr noundef nonnull %8, ptr noundef null, i32 noundef 4)
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %.lr.ph.1, label %.critedge.1

.lr.ph.1:                                         ; preds = %68, %85
  %.020.1 = phi i64 [ %72, %85 ], [ 0, %68 ]
  %72 = add nuw nsw i64 %.020.1, 1
  %exitcond.1.not = icmp eq i64 %.020.1, 101
  br i1 %exitcond.1.not, label %.critedge.1, label %73

73:                                               ; preds = %.lr.ph.1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = call i32 @ups_db_insert(ptr noundef %74, ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 0)
  %.not18.1 = icmp eq i32 %75, 0
  br i1 %.not18.1, label %79, label %76

76:                                               ; preds = %73
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %77, i32 noundef %75)
  br label %79

79:                                               ; preds = %76, %73
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = call i32 @ups_db_erase(ptr noundef %80, ptr noundef null, ptr noundef nonnull %8, i32 noundef 0)
  %.not19.1 = icmp eq i32 %81, 0
  br i1 %.not19.1, label %85, label %82

82:                                               ; preds = %79
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %83, i32 noundef %81)
  br label %85

85:                                               ; preds = %82, %79
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = call i32 @ups_cursor_move(ptr noundef %86, ptr noundef nonnull %8, ptr noundef null, i32 noundef 4)
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %.lr.ph.1, label %.critedge.1, !llvm.loop !17

.critedge.1:                                      ; preds = %.lr.ph.1, %85, %68
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = call i32 @ups_cursor_close(ptr noundef %89)
  %.not16.1 = icmp eq i32 %90, 0
  br i1 %.not16.1, label %94, label %91

91:                                               ; preds = %.critedge.1
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %92, i32 noundef %90)
  br label %94

94:                                               ; preds = %91, %.critedge.1
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret i32 0
}

declare i32 @ups_env_create(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @ups_env_create_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @ups_cursor_create(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

declare i32 @ups_cursor_find(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @ups_cursor_move(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @ups_db_erase(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @ups_cursor_close(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "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 norecurse 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 #6 = { inlinehint mustprogress 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 #7 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS9ups_key_t", !13, i64 0, !6, i64 8, !10, i64 16, !10, i64 20}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 20}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass