; LLVM IR from cruppstahl/upscaledb :: samples/db6.ll (Z8run_demov)

; 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"

%"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 }
%"class.upscaledb::env" = type { ptr }
%"class.upscaledb::db" = type { ptr }
%"class.upscaledb::key" = type { %struct.ups_key_t }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%"class.upscaledb::record" = type { %struct.ups_record_t }
%struct.ups_record_t = type { i32, ptr, i32 }
%struct.ups_parameter_t = type { i32, i64 }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@_ZTIN9upscaledb5errorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8run_demov() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.upscaledb::env", align 8
  %4 = alloca %"class.upscaledb::db", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.upscaledb::key", align 8
  %8 = alloca %"class.upscaledb::record", align 8
  %9 = alloca [3 x %struct.ups_parameter_t], align 16
  %10 = alloca %"class.upscaledb::db", align 8
  %11 = alloca %"class.upscaledb::record", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.upscaledb::db", align 8
  %14 = alloca %"class.upscaledb::record", align 8
  %15 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @_ZN9upscaledb3envC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  invoke void @_ZN9upscaledb2dbC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %16 unwind label %42

16:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #7
  invoke void @_ZN9upscaledb3keyC2EPvtj(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef null, i16 noundef zeroext 0, i32 noundef 0)
          to label %17 unwind label %46

17:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #7
  invoke void @_ZN9upscaledb6recordC2EPvjj(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef null, i32 noundef 0, i32 noundef 0)
          to label %18 unwind label %50

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #7
  call void @llvm.memset.p0.i64(ptr align 16 %9, i8 0, i64 48, i1 false)
  %19 = getelementptr inbounds [3 x %struct.ups_parameter_t], ptr %9, i32 0, i32 0
  %20 = getelementptr inbounds %struct.ups_parameter_t, ptr %19, i32 0, i32 0
  store i32 260, ptr %20, align 16
  %21 = getelementptr inbounds %struct.ups_parameter_t, ptr %19, i32 0, i32 1
  store i64 7, ptr %21, align 8
  %22 = getelementptr inbounds [3 x %struct.ups_parameter_t], ptr %9, i32 0, i32 1
  %23 = getelementptr inbounds %struct.ups_parameter_t, ptr %22, i32 0, i32 0
  store i32 264, ptr %23, align 16
  %24 = getelementptr inbounds %struct.ups_parameter_t, ptr %22, i32 0, i32 1
  store i64 4, ptr %24, align 8
  invoke void @_ZN9upscaledb3env6createEPKcjjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef @.str, i32 noundef 0, i32 noundef 420, ptr noundef null)
          to label %25 unwind label %54

25:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %26 = getelementptr inbounds [3 x %struct.ups_parameter_t], ptr %9, i64 0, i64 0
  invoke void @_ZN9upscaledb3env9create_dbEtjPK15ups_parameter_t(ptr dead_on_unwind writable sret(%"class.upscaledb::db") align 8 %10, ptr noundef nonnull align 8 dereferenceable(8) %3, i16 noundef zeroext 1, i32 noundef 0, ptr noundef %26)
          to label %27 unwind label %58

27:                                               ; preds = %25
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %29 unwind label %62

29:                                               ; preds = %27
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %39, %29
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp ult i32 %31, 10
  br i1 %32, label %33, label %67

33:                                               ; preds = %30
  invoke void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %7, i16 noundef zeroext 4)
          to label %34 unwind label %54

34:                                               ; preds = %33
  invoke void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %35 unwind label %54

35:                                               ; preds = %34
  invoke void @_ZN9upscaledb6record8set_sizeEj(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef 4)
          to label %36 unwind label %54

36:                                               ; preds = %35
  invoke void @_ZN9upscaledb6record8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %2)
          to label %37 unwind label %54

37:                                               ; preds = %36
  invoke void @_ZN9upscaledb2db6insertEPNS_3keyEPNS_6recordEj(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %7, ptr noundef %8, i32 noundef 0)
          to label %38 unwind label %54

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %30, !llvm.loop !9

42:                                               ; preds = %0
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %5, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %6, align 4
  br label %185

46:                                               ; preds = %16
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %5, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %6, align 4
  br label %184

50:                                               ; preds = %17
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %5, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %6, align 4
  br label %183

54:                                               ; preds = %177, %175, %126, %125, %107, %106, %105, %97, %96, %95, %84, %82, %76, %72, %71, %37, %36, %35, %34, %33, %18
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %5, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %6, align 4
  br label %182

58:                                               ; preds = %25
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %5, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %6, align 4
  br label %66

62:                                               ; preds = %27
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %5, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %6, align 4
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br label %66

66:                                               ; preds = %62, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %182

67:                                               ; preds = %30
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %92, %67
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = icmp ult i32 %69, 10
  br i1 %70, label %71, label %95

71:                                               ; preds = %68
  invoke void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %7, i16 noundef zeroext 4)
          to label %72 unwind label %54

72:                                               ; preds = %71
  invoke void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %73 unwind label %54

73:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #7
  invoke void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind writable sret(%"class.upscaledb::record") align 8 %11, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %7, i32 noundef 0)
          to label %74 unwind label %87

74:                                               ; preds = %73
  %75 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %76 unwind label %87

76:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  %77 = invoke noundef ptr @_ZNK9upscaledb6record8get_dataEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %78 unwind label %54

78:                                               ; preds = %76
  %79 = load i32, ptr %77, align 4, !tbaa !5
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = icmp ne i32 %79, %80
  br i1 %81, label %82, label %91

82:                                               ; preds = %78
  %83 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.1)
          to label %84 unwind label %54

84:                                               ; preds = %82
  %85 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %83, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %86 unwind label %54

86:                                               ; preds = %84
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %12, align 4
  br label %180

87:                                               ; preds = %74, %73
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %5, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  br label %182

91:                                               ; preds = %78
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = add i32 %93, 1
  store i32 %94, ptr %2, align 4, !tbaa !5
  br label %68, !llvm.loop !11

95:                                               ; preds = %68
  invoke void @_ZN9upscaledb2db5closeEj(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 0)
          to label %96 unwind label %54

96:                                               ; preds = %95
  invoke void @_ZN9upscaledb3env5closeEj(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0)
          to label %97 unwind label %54

97:                                               ; preds = %96
  invoke void @_ZN9upscaledb3env4openEPKcjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef @.str, i32 noundef 0, ptr noundef null)
          to label %98 unwind label %54

98:                                               ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  invoke void @_ZN9upscaledb3env7open_dbEtjPK15ups_parameter_t(ptr dead_on_unwind writable sret(%"class.upscaledb::db") align 8 %13, ptr noundef nonnull align 8 dereferenceable(8) %3, i16 noundef zeroext 1, i32 noundef 0, ptr noundef null)
          to label %99 unwind label %112

99:                                               ; preds = %98
  %100 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %101 unwind label %116

101:                                              ; preds = %99
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %109, %101
  %103 = load i32, ptr %2, align 4, !tbaa !5
  %104 = icmp ult i32 %103, 10
  br i1 %104, label %105, label %121

105:                                              ; preds = %102
  invoke void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %7, i16 noundef zeroext 4)
          to label %106 unwind label %54

106:                                              ; preds = %105
  invoke void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %107 unwind label %54

107:                                              ; preds = %106
  invoke void @_ZN9upscaledb2db5eraseEPNS_3keyEj(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %7, i32 noundef 0)
          to label %108 unwind label %54

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %2, align 4, !tbaa !5
  %111 = add i32 %110, 1
  store i32 %111, ptr %2, align 4, !tbaa !5
  br label %102, !llvm.loop !12

112:                                              ; preds = %98
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %5, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %6, align 4
  br label %120

116:                                              ; preds = %99
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %5, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %6, align 4
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br label %120

120:                                              ; preds = %116, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %182

121:                                              ; preds = %102
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %166, %121
  %123 = load i32, ptr %2, align 4, !tbaa !5
  %124 = icmp ult i32 %123, 10
  br i1 %124, label %125, label %175

125:                                              ; preds = %122
  invoke void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %7, i16 noundef zeroext 4)
          to label %126 unwind label %54

126:                                              ; preds = %125
  invoke void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %127 unwind label %54

127:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  invoke void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind writable sret(%"class.upscaledb::record") align 8 %14, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %7, i32 noundef 0)
          to label %128 unwind label %131

128:                                              ; preds = %127
  %129 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %130 unwind label %131

130:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  br label %165

131:                                              ; preds = %128, %127
  %132 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN9upscaledb5errorE
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %5, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  br label %135

135:                                              ; preds = %131
  %136 = load i32, ptr %6, align 4
  %137 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN9upscaledb5errorE) #7
  %138 = icmp eq i32 %136, %137
  br i1 %138, label %139, label %182

139:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %140 = load ptr, ptr %5, align 8
  %141 = call ptr @__cxa_begin_catch(ptr %140) #7
  store ptr %141, ptr %15, align 8
  %142 = load ptr, ptr %15, align 8, !tbaa !13
  %143 = invoke noundef i32 @_ZNK9upscaledb5error9get_errnoEv(ptr noundef nonnull align 4 dereferenceable(4) %142)
          to label %144 unwind label %156

144:                                              ; preds = %139
  %145 = icmp ne i32 %143, -11
  br i1 %145, label %146, label %160

146:                                              ; preds = %144
  %147 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.2)
          to label %148 unwind label %156

148:                                              ; preds = %146
  %149 = load ptr, ptr %15, align 8, !tbaa !13
  %150 = invoke noundef ptr @_ZNK9upscaledb5error10get_stringEv(ptr noundef nonnull align 4 dereferenceable(4) %149)
          to label %151 unwind label %156

151:                                              ; preds = %148
  %152 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %147, ptr noundef %150)
          to label %153 unwind label %156

153:                                              ; preds = %151
  %154 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %152, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %155 unwind label %156

155:                                              ; preds = %153
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %12, align 4
  br label %161

156:                                              ; preds = %153, %151, %148, %146, %139
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %5, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %173 unwind label %191

160:                                              ; preds = %144
  store i32 0, ptr %12, align 4
  br label %161

161:                                              ; preds = %160, %155
  invoke void @__cxa_end_catch()
          to label %162 unwind label %169

162:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %163 = load i32, ptr %12, align 4
  switch i32 %163, label %180 [
    i32 0, label %164
  ]

164:                                              ; preds = %162
  br label %165

165:                                              ; preds = %164, %130
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %2, align 4, !tbaa !5
  %168 = add i32 %167, 1
  store i32 %168, ptr %2, align 4, !tbaa !5
  br label %122, !llvm.loop !15

169:                                              ; preds = %161
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %5, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %6, align 4
  br label %174

173:                                              ; preds = %156
  br label %174

174:                                              ; preds = %173, %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %182

175:                                              ; preds = %122
  %176 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %177 unwind label %54

177:                                              ; preds = %175
  %178 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %176, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %179 unwind label %54

179:                                              ; preds = %177
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  br label %180

180:                                              ; preds = %179, %162, %86
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %181 = load i32, ptr %1, align 4
  ret i32 %181

182:                                              ; preds = %174, %135, %120, %87, %66, %54
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  br label %183

183:                                              ; preds = %182, %50
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  br label %184

184:                                              ; preds = %183, %46
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br label %185

185:                                              ; preds = %184, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %5, align 8
  %188 = load i32, ptr %6, align 4
  %189 = insertvalue { ptr, i32 } poison, ptr %187, 0
  %190 = insertvalue { ptr, i32 } %189, i32 %188, 1
  resume { ptr, i32 } %190

191:                                              ; preds = %156
  %192 = landingpad { ptr, i32 }
          catch ptr null
  %193 = extractvalue { ptr, i32 } %192, 0
  call void @__clang_call_terminate(ptr %193) #8
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3envC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb2dbC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3keyC2EPvtj(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i16 noundef zeroext, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6recordC2EPvjj(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env6createEPKcjjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env9create_dbEtjPK15ups_parameter_t(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::db") align 8, ptr noundef nonnull align 8 dereferenceable(8), i16 noundef zeroext, i32 noundef, ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24), i16 noundef zeroext) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6record8set_sizeEj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6record8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db6insertEPNS_3keyEPNS_6recordEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::record") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9upscaledb6record8get_dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db5closeEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env5closeEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env4openEPKcjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env7open_dbEtjPK15ups_parameter_t(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::db") align 8, ptr noundef nonnull align 8 dereferenceable(8), i16 noundef zeroext, i32 noundef, ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db5eraseEPNS_3keyEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #0 align 2

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

declare ptr @__cxa_begin_catch(ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK9upscaledb5error9get_errnoEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK9upscaledb5error10get_stringEv(ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

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 = { mustprogress 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nounwind memory(none) }
attributes #6 = { noinline noreturn nounwind uwtable "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 }
attributes #8 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}


; 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"

%"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 }
%"class.upscaledb::env" = type { ptr }
%"class.upscaledb::db" = type { ptr }
%"class.upscaledb::key" = type { %struct.ups_key_t }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%"class.upscaledb::record" = type { %struct.ups_record_t }
%struct.ups_record_t = type { i32, ptr, i32 }
%struct.ups_parameter_t = type { i32, i64 }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@_ZTIN9upscaledb5errorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8run_demov() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.upscaledb::env", align 8
  %3 = alloca %"class.upscaledb::db", align 8
  %4 = alloca %"class.upscaledb::key", align 8
  %5 = alloca %"class.upscaledb::record", align 8
  %6 = alloca [3 x %struct.ups_parameter_t], align 16
  %7 = alloca %"class.upscaledb::db", align 8
  %8 = alloca %"class.upscaledb::record", align 8
  %9 = alloca %"class.upscaledb::db", align 8
  %10 = alloca %"class.upscaledb::record", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @_ZN9upscaledb3envC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @_ZN9upscaledb2dbC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  call void @_ZN9upscaledb3keyC2EPvtj(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef null, i16 noundef zeroext 0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  call void @_ZN9upscaledb6recordC2EPvjj(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef null, i32 noundef 0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %6, i8 0, i64 48, i1 false)
  store i32 260, ptr %6, align 16
  %11 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 7, ptr %11, align 8
  %12 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 264, ptr %12, align 16
  %13 = getelementptr inbounds i8, ptr %6, i64 24
  store i64 4, ptr %13, align 8
  invoke void @_ZN9upscaledb3env6createEPKcjjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull @.str, i32 noundef 0, i32 noundef 420, ptr noundef null)
          to label %14 unwind label %.loopexit.split-lp.loopexit.split-lp

14:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  invoke void @_ZN9upscaledb3env9create_dbEtjPK15ups_parameter_t(ptr dead_on_unwind nonnull writable sret(%"class.upscaledb::db") align 8 %7, ptr noundef nonnull align 8 dereferenceable(8) %2, i16 noundef zeroext 1, i32 noundef 0, ptr noundef nonnull %6)
          to label %15 unwind label %23

15:                                               ; preds = %14
  %16 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %17 unwind label %25

17:                                               ; preds = %15
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %18

.preheader29:                                     ; preds = %19
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %31

18:                                               ; preds = %17, %19
  call void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %4, i16 noundef zeroext 4)
  call void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull %1)
  call void @_ZN9upscaledb6record8set_sizeEj(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 4)
  call void @_ZN9upscaledb6record8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull %1)
  invoke void @_ZN9upscaledb2db6insertEPNS_3keyEPNS_6recordEj(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 0)
          to label %19 unwind label %.loopexit.split-lp.loopexit

19:                                               ; preds = %18
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = add i32 %20, 1
  store i32 %21, ptr %1, align 4, !tbaa !5
  %22 = icmp ult i32 %21, 10
  br i1 %22, label %18, label %.preheader29, !llvm.loop !9

.loopexit28:                                      ; preds = %50
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit:                      ; preds = %18
  %lpad.loopexit30 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp:             ; preds = %92, %90, %45, %44, %43, %39, %37, %0
  %lpad.loopexit.split-lp31 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

23:                                               ; preds = %14
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %15
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %27

27:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %.loopexit.split-lp

28:                                               ; preds = %32
  %29 = add i32 %35, 1
  store i32 %29, ptr %1, align 4, !tbaa !5
  %30 = icmp ult i32 %29, 10
  br i1 %30, label %31, label %43, !llvm.loop !11

31:                                               ; preds = %.preheader29, %28
  call void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %4, i16 noundef zeroext 4)
  call void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  invoke void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind nonnull writable sret(%"class.upscaledb::record") align 8 %8, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull %4, i32 noundef 0)
          to label %32 unwind label %41

32:                                               ; preds = %31
  %33 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  %34 = call noundef ptr @_ZNK9upscaledb6record8get_dataEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %.not26 = icmp eq i32 %35, %36
  br i1 %.not26, label %28, label %37

37:                                               ; preds = %32
  %38 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.1)
          to label %39 unwind label %.loopexit.split-lp.loopexit.split-lp

39:                                               ; preds = %37
  %40 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.loopexit27 unwind label %.loopexit.split-lp.loopexit.split-lp

41:                                               ; preds = %31
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  br label %.loopexit.split-lp

43:                                               ; preds = %28
  invoke void @_ZN9upscaledb2db5closeEj(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0)
          to label %44 unwind label %.loopexit.split-lp.loopexit.split-lp

44:                                               ; preds = %43
  invoke void @_ZN9upscaledb3env5closeEj(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0)
          to label %45 unwind label %.loopexit.split-lp.loopexit.split-lp

45:                                               ; preds = %44
  invoke void @_ZN9upscaledb3env4openEPKcjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull @.str, i32 noundef 0, ptr noundef null)
          to label %46 unwind label %.loopexit.split-lp.loopexit.split-lp

46:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  invoke void @_ZN9upscaledb3env7open_dbEtjPK15ups_parameter_t(ptr dead_on_unwind nonnull writable sret(%"class.upscaledb::db") align 8 %9, ptr noundef nonnull align 8 dereferenceable(8) %2, i16 noundef zeroext 1, i32 noundef 0, ptr noundef null)
          to label %47 unwind label %55

47:                                               ; preds = %46
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %49 unwind label %57

49:                                               ; preds = %47
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %50

.preheader:                                       ; preds = %51
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %60

50:                                               ; preds = %49, %51
  call void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %4, i16 noundef zeroext 4)
  call void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull %1)
  invoke void @_ZN9upscaledb2db5eraseEPNS_3keyEj(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull %4, i32 noundef 0)
          to label %51 unwind label %.loopexit28

51:                                               ; preds = %50
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = add i32 %52, 1
  store i32 %53, ptr %1, align 4, !tbaa !5
  %54 = icmp ult i32 %53, 10
  br i1 %54, label %50, label %.preheader, !llvm.loop !12

55:                                               ; preds = %46
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %59

57:                                               ; preds = %47
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %59

59:                                               ; preds = %57, %55
  %.pn20 = phi { ptr, i32 } [ %58, %57 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br label %.loopexit.split-lp

60:                                               ; preds = %.preheader, %84
  call void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24) %4, i16 noundef zeroext 4)
  call void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #7
  invoke void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind nonnull writable sret(%"class.upscaledb::record") align 8 %10, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull %4, i32 noundef 0)
          to label %61 unwind label %63

61:                                               ; preds = %60
  %62 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  br label %84

63:                                               ; preds = %60
  %64 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN9upscaledb5errorE
  %65 = extractvalue { ptr, i32 } %64, 1
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  %66 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN9upscaledb5errorE) #7
  %67 = icmp eq i32 %65, %66
  br i1 %67, label %68, label %.loopexit.split-lp

68:                                               ; preds = %63
  %69 = extractvalue { ptr, i32 } %64, 0
  %70 = call ptr @__cxa_begin_catch(ptr %69) #7
  %71 = call noundef i32 @_ZNK9upscaledb5error9get_errnoEv(ptr noundef nonnull align 4 dereferenceable(4) %70)
  %.not = icmp eq i32 %71, -11
  br i1 %.not, label %82, label %72

72:                                               ; preds = %68
  %73 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.2)
          to label %74 unwind label %80

74:                                               ; preds = %72
  %75 = invoke noundef ptr @_ZNK9upscaledb5error10get_stringEv(ptr noundef nonnull align 4 dereferenceable(4) %70)
          to label %76 unwind label %80

76:                                               ; preds = %74
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef %75)
          to label %78 unwind label %80

78:                                               ; preds = %76
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %82 unwind label %80

80:                                               ; preds = %78, %76, %74, %72
  %81 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %.loopexit.split-lp unwind label %94

82:                                               ; preds = %68, %78
  invoke void @__cxa_end_catch()
          to label %83 unwind label %88

83:                                               ; preds = %82
  br i1 %.not, label %84, label %.loopexit27

84:                                               ; preds = %61, %83
  %85 = load i32, ptr %1, align 4, !tbaa !5
  %86 = add i32 %85, 1
  store i32 %86, ptr %1, align 4, !tbaa !5
  %87 = icmp ult i32 %86, 10
  br i1 %87, label %60, label %90, !llvm.loop !13

88:                                               ; preds = %82
  %89 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

90:                                               ; preds = %84
  %91 = invoke 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)
          to label %92 unwind label %.loopexit.split-lp.loopexit.split-lp

92:                                               ; preds = %90
  %93 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %91, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.loopexit27 unwind label %.loopexit.split-lp.loopexit.split-lp

.loopexit27:                                      ; preds = %83, %92, %39
  %.3 = phi i32 [ -1, %39 ], [ 0, %92 ], [ -1, %83 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 %.3

.loopexit.split-lp:                               ; preds = %63, %.loopexit28, %.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %88, %80, %59, %41, %27
  %.merged = phi { ptr, i32 } [ %42, %41 ], [ %.pn20, %59 ], [ %.pn, %27 ], [ %89, %88 ], [ %81, %80 ], [ %lpad.loopexit, %.loopexit28 ], [ %lpad.loopexit30, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp31, %.loopexit.split-lp.loopexit.split-lp ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  resume { ptr, i32 } %.merged

94:                                               ; preds = %80
  %95 = landingpad { ptr, i32 }
          catch ptr null
  %96 = extractvalue { ptr, i32 } %95, 0
  call void @__clang_call_terminate(ptr %96) #8
  unreachable
}

; 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 nounwind uwtable
declare dso_local void @_ZN9upscaledb3envC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb2dbC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3keyC2EPvtj(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i16 noundef zeroext, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6recordC2EPvjj(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env6createEPKcjjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env9create_dbEtjPK15ups_parameter_t(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::db") align 8, ptr noundef nonnull align 8 dereferenceable(8), i16 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9upscaledb2dbaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb2dbD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 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 nounwind uwtable
declare dso_local void @_ZN9upscaledb3key8set_sizeEt(ptr noundef nonnull align 8 dereferenceable(24), i16 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3key8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6record8set_sizeEj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb6record8set_dataEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db6insertEPNS_3keyEPNS_6recordEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db4findEPNS_3keyEj(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::record") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN9upscaledb6recordaSERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9upscaledb6record8get_dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; 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 #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db5closeEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env5closeEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env4openEPKcjPK15ups_parameter_t(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb3env7open_dbEtjPK15ups_parameter_t(ptr dead_on_unwind noalias writable sret(%"class.upscaledb::db") align 8, ptr noundef nonnull align 8 dereferenceable(8), i16 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb2db5eraseEPNS_3keyEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK9upscaledb5error9get_errnoEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK9upscaledb5error10get_stringEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9upscaledb3envD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

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 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nofree nosync nounwind memory(none) }
attributes #6 = { noinline noreturn nounwind uwtable "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 }
attributes #8 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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