; LLVM IR from mitdbg/deneva :: benchmarks/tpcc_query.ll (ZN18TPCCQueryGenerator13gen_new_orderEm)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%class.TPCCQuery = type { %class.BaseQuery, i32, i64, i64, i64, i64, i64, i64, [16 x i8], double, i8, %class.Array.0, i8, i8, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%class.BaseQuery = type { ptr, i64, %class.Array, %class.Array, %class.Array, %class.Array }
%class.Array = type { ptr, i64, i64 }
%class.Array.0 = type { ptr, i64, i64 }
%struct.Item_no = type { i64, i64, i64 }

@g_max_items_per_txn = external global i32, align 4
@g_num_wh = external global i32, align 4
@g_dist_per_wh = external global i32, align 4
@g_cust_per_dist = external global i32, align 4
@g_mpr = external global double, align 8
@g_part_per_txn = external global i32, align 4
@g_max_items = external global i32, align 4

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

; Function Attrs: nounwind
declare i32 @rand() #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN18TPCCQueryGenerator13gen_new_orderEm(ptr noundef nonnull align 8 dereferenceable(16) %0, i64 noundef %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::set", align 8
  %9 = alloca i64, align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca double, align 8
  %12 = alloca i64, align 8
  %13 = alloca %"class.std::set", align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca double, align 8
  %17 = alloca i64, align 8
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %22 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %23 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 320) #9
  invoke void @_ZN9TPCCQueryC2Ev(ptr noundef nonnull align 8 dereferenceable(320) %23)
          to label %24 unwind label %44

24:                                               ; preds = %2
  store ptr %23, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %8) #8
  call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.TPCCQuery, ptr %25, i32 0, i32 1
  store i32 2, ptr %26, align 8, !tbaa !11
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TPCCQuery, ptr %27, i32 0, i32 11
  %29 = load i32, ptr @g_max_items_per_txn, align 4, !tbaa !19
  %30 = zext i32 %29 to i64
  invoke void @_ZN5ArrayIP7Item_noE4initEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %30)
          to label %31 unwind label %48

31:                                               ; preds = %24
  br label %32

32:                                               ; preds = %43, %31
  %33 = load i32, ptr @g_num_wh, align 4, !tbaa !19
  %34 = zext i32 %33 to i64
  %35 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %34)
          to label %36 unwind label %48

36:                                               ; preds = %32
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.TPCCQuery, ptr %37, i32 0, i32 2
  store i64 %35, ptr %38, align 8, !tbaa !21
  %39 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %35)
          to label %40 unwind label %48

40:                                               ; preds = %36
  %41 = load i64, ptr %4, align 8, !tbaa !9
  %42 = icmp ne i64 %39, %41
  br i1 %42, label %43, label %52

43:                                               ; preds = %40
  br label %32, !llvm.loop !22

44:                                               ; preds = %2
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %6, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %7, align 4
  call void @_ZdlPvm(ptr noundef %23, i64 noundef 320) #10
  br label %250

48:                                               ; preds = %62, %56, %52, %36, %32, %24
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %6, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %7, align 4
  br label %249

52:                                               ; preds = %40
  %53 = load i32, ptr @g_dist_per_wh, align 4, !tbaa !19
  %54 = zext i32 %53 to i64
  %55 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %54)
          to label %56 unwind label %48

56:                                               ; preds = %52
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %class.TPCCQuery, ptr %57, i32 0, i32 3
  store i64 %55, ptr %58, align 8, !tbaa !24
  %59 = load i32, ptr @g_cust_per_dist, align 4, !tbaa !19
  %60 = zext i32 %59 to i64
  %61 = invoke noundef i64 @_Z6NURandmmm(i64 noundef 1023, i64 noundef 1, i64 noundef %60)
          to label %62 unwind label %48

62:                                               ; preds = %56
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.TPCCQuery, ptr %63, i32 0, i32 4
  store i64 %61, ptr %64, align 8, !tbaa !25
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.TPCCQuery, ptr %65, i32 0, i32 12
  store i8 0, ptr %66, align 8, !tbaa !26
  %67 = load i32, ptr @g_max_items_per_txn, align 4, !tbaa !19
  %68 = zext i32 %67 to i64
  %69 = invoke noundef i64 @_Z5URandmm(i64 noundef 5, i64 noundef %68)
          to label %70 unwind label %48

70:                                               ; preds = %62
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %class.TPCCQuery, ptr %71, i32 0, i32 14
  store i64 %69, ptr %72, align 8, !tbaa !27
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %class.TPCCQuery, ptr %73, i32 0, i32 15
  store i64 2013, ptr %74, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %class.TPCCQuery, ptr %75, i32 0, i32 2
  %77 = load i64, ptr %76, align 8, !tbaa !21
  %78 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %77)
          to label %79 unwind label %96

79:                                               ; preds = %70
  store i64 %78, ptr %9, align 8, !tbaa !9
  %80 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %81 unwind label %96

81:                                               ; preds = %79
  %82 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %83 = extractvalue { ptr, i8 } %80, 0
  store ptr %83, ptr %82, align 8
  %84 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %85 = extractvalue { ptr, i8 } %80, 1
  store i8 %85, ptr %84, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %86 = call i32 @rand() #8
  %87 = srem i32 %86, 10000
  %88 = sitofp i32 %87 to double
  %89 = fdiv double %88, 1.000000e+04
  store double %89, ptr %11, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %90 = load double, ptr %11, align 8, !tbaa !29
  %91 = load double, ptr @g_mpr, align 8, !tbaa !29
  %92 = fcmp olt double %90, %91
  br i1 %92, label %93, label %100

93:                                               ; preds = %81
  %94 = load i32, ptr @g_part_per_txn, align 4, !tbaa !19
  %95 = zext i32 %94 to i64
  store i64 %95, ptr %12, align 8, !tbaa !9
  br label %101

96:                                               ; preds = %79, %70
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %6, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %249

100:                                              ; preds = %81
  store i64 1, ptr %12, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %100, %93
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #8
  call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  br label %102

102:                                              ; preds = %219, %101
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %class.TPCCQuery, ptr %103, i32 0, i32 11
  %105 = invoke noundef i64 @_ZN5ArrayIP7Item_noE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %104)
          to label %106 unwind label %125

106:                                              ; preds = %102
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %class.TPCCQuery, ptr %107, i32 0, i32 14
  %109 = load i64, ptr %108, align 8, !tbaa !27
  %110 = icmp ult i64 %105, %109
  br i1 %110, label %111, label %222

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %112 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #9
          to label %113 unwind label %129

113:                                              ; preds = %111
  store ptr %112, ptr %14, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %124, %113
  %115 = load i32, ptr @g_max_items, align 4, !tbaa !19
  %116 = zext i32 %115 to i64
  %117 = invoke noundef i64 @_Z6NURandmmm(i64 noundef 8191, i64 noundef 1, i64 noundef %116)
          to label %118 unwind label %129

118:                                              ; preds = %114
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.Item_no, ptr %119, i32 0, i32 0
  store i64 %117, ptr %120, align 8, !tbaa !30
  %121 = invoke noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef nonnull align 8 dereferenceable(8) %120)
          to label %122 unwind label %129

122:                                              ; preds = %118
  %123 = icmp ugt i64 %121, 0
  br i1 %123, label %124, label %133

124:                                              ; preds = %122
  br label %114, !llvm.loop !32

125:                                              ; preds = %222, %102
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %6, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %7, align 4
  br label %248

129:                                              ; preds = %137, %133, %118, %114, %111
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %6, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %7, align 4
  br label %221

133:                                              ; preds = %122
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.Item_no, ptr %134, i32 0, i32 0
  %136 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef nonnull align 8 dereferenceable(8) %135)
          to label %137 unwind label %129

137:                                              ; preds = %133
  %138 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 0
  %139 = extractvalue { ptr, i8 } %136, 0
  store ptr %139, ptr %138, align 8
  %140 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 1
  %141 = extractvalue { ptr, i8 } %136, 1
  store i8 %141, ptr %140, align 8
  %142 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef 10)
          to label %143 unwind label %129

143:                                              ; preds = %137
  %144 = load ptr, ptr %14, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.Item_no, ptr %144, i32 0, i32 2
  store i64 %142, ptr %145, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %146 = call i32 @rand() #8
  %147 = srem i32 %146, 100000
  %148 = sitofp i32 %147 to double
  %149 = fdiv double %148, 1.000000e+05
  store double %149, ptr %16, align 8, !tbaa !29
  %150 = load double, ptr %16, align 8, !tbaa !29
  %151 = fcmp ogt double %150, 1.000000e-02
  br i1 %151, label %159, label %152

152:                                              ; preds = %143
  %153 = load double, ptr %11, align 8, !tbaa !29
  %154 = load double, ptr @g_mpr, align 8, !tbaa !29
  %155 = fcmp ogt double %153, %154
  br i1 %155, label %159, label %156

156:                                              ; preds = %152
  %157 = load i32, ptr @g_num_wh, align 4, !tbaa !19
  %158 = icmp eq i32 %157, 1
  br i1 %158, label %159, label %165

159:                                              ; preds = %156, %152, %143
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %class.TPCCQuery, ptr %160, i32 0, i32 2
  %162 = load i64, ptr %161, align 8, !tbaa !21
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.Item_no, ptr %163, i32 0, i32 1
  store i64 %162, ptr %164, align 8, !tbaa !34
  br label %215

165:                                              ; preds = %156
  %166 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  %167 = load i64, ptr %12, align 8, !tbaa !9
  %168 = icmp ult i64 %166, %167
  br i1 %168, label %169, label %195

169:                                              ; preds = %165
  %170 = load i32, ptr @g_num_wh, align 4, !tbaa !19
  %171 = zext i32 %170 to i64
  %172 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %171)
          to label %173 unwind label %187

173:                                              ; preds = %169
  %174 = load ptr, ptr %14, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.Item_no, ptr %174, i32 0, i32 1
  store i64 %172, ptr %175, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.Item_no, ptr %176, i32 0, i32 1
  %178 = load i64, ptr %177, align 8, !tbaa !34
  %179 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %178)
          to label %180 unwind label %191

180:                                              ; preds = %173
  store i64 %179, ptr %17, align 8, !tbaa !9
  %181 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %17)
          to label %182 unwind label %191

182:                                              ; preds = %180
  %183 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 0
  %184 = extractvalue { ptr, i8 } %181, 0
  store ptr %184, ptr %183, align 8
  %185 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 1
  %186 = extractvalue { ptr, i8 } %181, 1
  store i8 %186, ptr %185, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %214

187:                                              ; preds = %215, %169
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %6, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %7, align 4
  br label %220

191:                                              ; preds = %180, %173
  %192 = landingpad { ptr, i32 }
          cleanup
  %193 = extractvalue { ptr, i32 } %192, 0
  store ptr %193, ptr %6, align 8
  %194 = extractvalue { ptr, i32 } %192, 1
  store i32 %194, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %220

195:                                              ; preds = %165
  br label %196

196:                                              ; preds = %208, %195
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %197 = load i32, ptr @g_num_wh, align 4, !tbaa !19
  %198 = zext i32 %197 to i64
  %199 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %198)
          to label %200 unwind label %209

200:                                              ; preds = %196
  %201 = load ptr, ptr %14, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.Item_no, ptr %201, i32 0, i32 1
  store i64 %199, ptr %202, align 8, !tbaa !34
  %203 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %199)
          to label %204 unwind label %209

204:                                              ; preds = %200
  store i64 %203, ptr %19, align 8, !tbaa !9
  %205 = invoke noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %206 unwind label %209

206:                                              ; preds = %204
  %207 = icmp eq i64 %205, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br i1 %207, label %208, label %213

208:                                              ; preds = %206
  br label %196, !llvm.loop !35

209:                                              ; preds = %204, %200, %196
  %210 = landingpad { ptr, i32 }
          cleanup
  %211 = extractvalue { ptr, i32 } %210, 0
  store ptr %211, ptr %6, align 8
  %212 = extractvalue { ptr, i32 } %210, 1
  store i32 %212, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %220

213:                                              ; preds = %206
  br label %214

214:                                              ; preds = %213, %182
  br label %215

215:                                              ; preds = %214, %159
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = getelementptr inbounds %class.TPCCQuery, ptr %216, i32 0, i32 11
  %218 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN5ArrayIP7Item_noE3addES1_(ptr noundef nonnull align 8 dereferenceable(24) %217, ptr noundef %218)
          to label %219 unwind label %187

219:                                              ; preds = %215
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %102, !llvm.loop !36

220:                                              ; preds = %209, %191, %187
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %221

221:                                              ; preds = %220, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %248

222:                                              ; preds = %106
  %223 = load ptr, ptr %5, align 8, !tbaa !5
  %224 = getelementptr inbounds %class.BaseQuery, ptr %223, i32 0, i32 2
  %225 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  invoke void @_ZN5ArrayImE4initEm(ptr noundef nonnull align 8 dereferenceable(24) %224, i64 noundef %225)
          to label %226 unwind label %125

226:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %227 = call ptr @_ZNKSt3setImSt4lessImESaImEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  %228 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %227, ptr %228, align 8
  br label %229

229:                                              ; preds = %240, %226
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %230 = call ptr @_ZNKSt3setImSt4lessImESaImEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  %231 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %230, ptr %231, align 8
  %232 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorImES2_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br i1 %232, label %234, label %233

233:                                              ; preds = %229
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %246

234:                                              ; preds = %229
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = getelementptr inbounds %class.BaseQuery, ptr %235, i32 0, i32 2
  %237 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorImEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  %238 = load i64, ptr %237, align 8, !tbaa !9
  invoke void @_ZN5ArrayImE3addEm(ptr noundef nonnull align 8 dereferenceable(24) %236, i64 noundef %238)
          to label %239 unwind label %242

239:                                              ; preds = %234
  br label %240

240:                                              ; preds = %239
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorImEppEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  br label %229, !llvm.loop !37

242:                                              ; preds = %234
  %243 = landingpad { ptr, i32 }
          cleanup
  %244 = extractvalue { ptr, i32 } %243, 0
  store ptr %244, ptr %6, align 8
  %245 = extractvalue { ptr, i32 } %243, 1
  store i32 %245, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %248

246:                                              ; preds = %233
  %247 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  ret ptr %247

248:                                              ; preds = %242, %221, %125
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %249

249:                                              ; preds = %248, %96, %48
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #8
  br label %250

250:                                              ; preds = %249, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %251

251:                                              ; preds = %250
  %252 = load ptr, ptr %6, align 8
  %253 = load i32, ptr %7, align 4
  %254 = insertvalue { ptr, i32 } poison, ptr %252, 0
  %255 = insertvalue { ptr, i32 } %254, i32 %253, 1
  resume { ptr, i32 } %255
}

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

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

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

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

declare noundef i64 @_Z10wh_to_partm(i64 noundef) #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9TPCCQueryC2Ev(ptr noundef nonnull align 8 dereferenceable(320)) unnamed_addr #6 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

declare noundef i64 @_Z5URandmm(i64 noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

declare noundef i64 @_Z6NURandmmm(i64 noundef, i64 noundef, i64 noundef) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorImES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #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 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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, !15, i64 112}
!12 = !{!"_ZTS9TPCCQuery", !13, i64 0, !15, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !7, i64 168, !16, i64 184, !17, i64 192, !18, i64 200, !17, i64 224, !17, i64 225, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312}
!13 = !{!"_ZTS9BaseQuery", !10, i64 8, !14, i64 16, !14, i64 40, !14, i64 64, !14, i64 88}
!14 = !{!"_ZTS5ArrayImE", !6, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!"_ZTS11TPCCTxnType", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS5ArrayIP7Item_noE", !6, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!12, !10, i64 120}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!12, !10, i64 128}
!25 = !{!12, !10, i64 136}
!26 = !{!12, !17, i64 224}
!27 = !{!12, !10, i64 232}
!28 = !{!12, !10, i64 240}
!29 = !{!16, !16, i64 0}
!30 = !{!31, !10, i64 0}
!31 = !{!"_ZTS7Item_no", !10, i64 0, !10, i64 8, !10, i64 16}
!32 = distinct !{!32, !23}
!33 = !{!31, !10, i64 16}
!34 = !{!31, !10, i64 8}
!35 = distinct !{!35, !23}
!36 = distinct !{!36, !23}
!37 = distinct !{!37, !23}


; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@g_max_items_per_txn = external local_unnamed_addr global i32, align 4
@g_num_wh = external local_unnamed_addr global i32, align 4
@g_dist_per_wh = external local_unnamed_addr global i32, align 4
@g_cust_per_dist = external local_unnamed_addr global i32, align 4
@g_mpr = external local_unnamed_addr global double, align 8
@g_part_per_txn = external local_unnamed_addr global i32, align 4
@g_max_items = external local_unnamed_addr global i32, align 4

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZN18TPCCQueryGenerator13gen_new_orderEm(ptr nocapture noundef nonnull readnone align 8 dereferenceable(16) %0, i64 noundef %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::set", align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::set", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = tail call noalias noundef nonnull dereferenceable(320) ptr @_Znwm(i64 noundef 320) #8
  invoke void @_ZN9TPCCQueryC2Ev(ptr noundef nonnull align 8 dereferenceable(320) %10)
          to label %11 unwind label %24

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #9
  call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  %12 = getelementptr inbounds i8, ptr %10, i64 112
  store i32 2, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %10, i64 200
  %14 = load i32, ptr @g_max_items_per_txn, align 4, !tbaa !17
  %15 = zext i32 %14 to i64
  invoke void @_ZN5ArrayIP7Item_noE4initEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %15)
          to label %.preheader50 unwind label %.loopexit.split-lp52

.preheader50:                                     ; preds = %11
  %16 = getelementptr inbounds i8, ptr %10, i64 120
  br label %17

17:                                               ; preds = %.preheader50, %23
  %18 = load i32, ptr @g_num_wh, align 4, !tbaa !17
  %19 = zext i32 %18 to i64
  %20 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %19)
          to label %21 unwind label %.loopexit51

21:                                               ; preds = %17
  store i64 %20, ptr %16, align 8, !tbaa !19
  %22 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %20)
          to label %23 unwind label %.loopexit51

23:                                               ; preds = %21
  %.not = icmp eq i64 %22, %1
  br i1 %.not, label %26, label %17, !llvm.loop !20

24:                                               ; preds = %2
  %25 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %10, i64 noundef 320) #10
  br label %136

.loopexit51:                                      ; preds = %17, %21
  %lpad.loopexit53 = landingpad { ptr, i32 }
          cleanup
  br label %135

.loopexit.split-lp52:                             ; preds = %11, %26, %30, %35
  %lpad.loopexit.split-lp54 = landingpad { ptr, i32 }
          cleanup
  br label %135

26:                                               ; preds = %23
  %27 = load i32, ptr @g_dist_per_wh, align 4, !tbaa !17
  %28 = zext i32 %27 to i64
  %29 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %28)
          to label %30 unwind label %.loopexit.split-lp52

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %10, i64 128
  store i64 %29, ptr %31, align 8, !tbaa !22
  %32 = load i32, ptr @g_cust_per_dist, align 4, !tbaa !17
  %33 = zext i32 %32 to i64
  %34 = invoke noundef i64 @_Z6NURandmmm(i64 noundef 1023, i64 noundef 1, i64 noundef %33)
          to label %35 unwind label %.loopexit.split-lp52

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %10, i64 136
  store i64 %34, ptr %36, align 8, !tbaa !23
  %37 = getelementptr inbounds i8, ptr %10, i64 224
  store i8 0, ptr %37, align 8, !tbaa !24
  %38 = load i32, ptr @g_max_items_per_txn, align 4, !tbaa !17
  %39 = zext i32 %38 to i64
  %40 = invoke noundef i64 @_Z5URandmm(i64 noundef 5, i64 noundef %39)
          to label %41 unwind label %.loopexit.split-lp52

41:                                               ; preds = %35
  %42 = getelementptr inbounds i8, ptr %10, i64 232
  store i64 %40, ptr %42, align 8, !tbaa !25
  %43 = getelementptr inbounds i8, ptr %10, i64 240
  store i64 2013, ptr %43, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %44 = load i64, ptr %16, align 8, !tbaa !19
  %45 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %44)
          to label %46 unwind label %60

46:                                               ; preds = %41
  store i64 %45, ptr %4, align 8, !tbaa !27
  %47 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %48 unwind label %60

48:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  %49 = call i32 @rand() #9
  %50 = srem i32 %49, 10000
  %51 = sitofp i32 %50 to double
  %52 = fdiv double %51, 1.000000e+04
  %53 = load double, ptr @g_mpr, align 8, !tbaa !28
  %54 = fcmp olt double %52, %53
  %55 = load i32, ptr @g_part_per_txn, align 4
  %56 = zext i32 %55 to i64
  %.041 = select i1 %54, i64 %56, i64 1
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #9
  call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #9
  %57 = call noundef i64 @_ZN5ArrayIP7Item_noE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %58 = load i64, ptr %42, align 8, !tbaa !25
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %.lr.ph, label %._crit_edge

60:                                               ; preds = %46, %41
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br label %135

.lr.ph:                                           ; preds = %48, %.loopexit
  %62 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #8
          to label %.preheader48 unwind label %.loopexit.split-lp

.preheader48:                                     ; preds = %.lr.ph, %68
  %63 = load i32, ptr @g_max_items, align 4, !tbaa !17
  %64 = zext i32 %63 to i64
  %65 = invoke noundef i64 @_Z6NURandmmm(i64 noundef 8191, i64 noundef 1, i64 noundef %64)
          to label %66 unwind label %.loopexit49

66:                                               ; preds = %.preheader48
  store i64 %65, ptr %62, align 8, !tbaa !29
  %67 = invoke noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %62)
          to label %68 unwind label %.loopexit49

68:                                               ; preds = %66
  %.not42 = icmp eq i64 %67, 0
  br i1 %.not42, label %71, label %.preheader48, !llvm.loop !31

69:                                               ; preds = %._crit_edge
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %134

.loopexit49:                                      ; preds = %.preheader48, %66
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %134

.loopexit.split-lp:                               ; preds = %.lr.ph, %71, %73
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %134

71:                                               ; preds = %68
  %72 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %62)
          to label %73 unwind label %.loopexit.split-lp

73:                                               ; preds = %71
  %74 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef 10)
          to label %75 unwind label %.loopexit.split-lp

75:                                               ; preds = %73
  %76 = getelementptr inbounds i8, ptr %62, i64 16
  store i64 %74, ptr %76, align 8, !tbaa !32
  %77 = call i32 @rand() #9
  %78 = srem i32 %77, 100000
  %79 = sitofp i32 %78 to double
  %80 = fdiv double %79, 1.000000e+05
  %81 = fcmp ogt double %80, 1.000000e-02
  br i1 %81, label %87, label %82

82:                                               ; preds = %75
  %83 = load double, ptr @g_mpr, align 8, !tbaa !28
  %84 = fcmp ogt double %52, %83
  %85 = load i32, ptr @g_num_wh, align 4
  %86 = icmp eq i32 %85, 1
  %or.cond = select i1 %84, i1 true, i1 %86
  br i1 %or.cond, label %87, label %90

87:                                               ; preds = %82, %75
  %88 = load i64, ptr %16, align 8, !tbaa !19
  %89 = getelementptr inbounds i8, ptr %62, i64 8
  store i64 %88, ptr %89, align 8, !tbaa !33
  br label %.loopexit

90:                                               ; preds = %82
  %91 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  %92 = icmp ult i64 %91, %.041
  br i1 %92, label %94, label %.preheader

.preheader:                                       ; preds = %90
  %93 = getelementptr inbounds i8, ptr %62, i64 8
  br label %108

94:                                               ; preds = %90
  %95 = load i32, ptr @g_num_wh, align 4, !tbaa !17
  %96 = zext i32 %95 to i64
  %97 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %96)
          to label %98 unwind label %104

98:                                               ; preds = %94
  %99 = getelementptr inbounds i8, ptr %62, i64 8
  store i64 %97, ptr %99, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %100 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %97)
          to label %101 unwind label %106

101:                                              ; preds = %98
  store i64 %100, ptr %6, align 8, !tbaa !27
  %102 = invoke { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %103 unwind label %106

103:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %.loopexit

104:                                              ; preds = %94
  %105 = landingpad { ptr, i32 }
          cleanup
  br label %134

106:                                              ; preds = %101, %98
  %107 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %134

108:                                              ; preds = %.preheader, %116
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %109 = load i32, ptr @g_num_wh, align 4, !tbaa !17
  %110 = zext i32 %109 to i64
  %111 = invoke noundef i64 @_Z5URandmm(i64 noundef 1, i64 noundef %110)
          to label %112 unwind label %118

112:                                              ; preds = %108
  store i64 %111, ptr %93, align 8, !tbaa !33
  %113 = invoke noundef i64 @_Z10wh_to_partm(i64 noundef %111)
          to label %114 unwind label %118

114:                                              ; preds = %112
  store i64 %113, ptr %7, align 8, !tbaa !27
  %115 = invoke noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %116 unwind label %118

116:                                              ; preds = %114
  %117 = icmp eq i64 %115, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  br i1 %117, label %108, label %.loopexit, !llvm.loop !34

118:                                              ; preds = %114, %112, %108
  %119 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  br label %134

.loopexit:                                        ; preds = %116, %103, %87
  call void @_ZN5ArrayIP7Item_noE3addES1_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull %62)
  %120 = call noundef i64 @_ZN5ArrayIP7Item_noE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %121 = load i64, ptr %42, align 8, !tbaa !25
  %122 = icmp ult i64 %120, %121
  br i1 %122, label %.lr.ph, label %._crit_edge, !llvm.loop !35

._crit_edge:                                      ; preds = %.loopexit, %48
  %123 = getelementptr inbounds i8, ptr %10, i64 16
  %124 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  invoke void @_ZN5ArrayImE4initEm(ptr noundef nonnull align 8 dereferenceable(24) %123, i64 noundef %124)
          to label %125 unwind label %69

125:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %126 = call ptr @_ZNKSt3setImSt4lessImESaImEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  store ptr %126, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #9
  %127 = call ptr @_ZNKSt3setImSt4lessImESaImEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  store ptr %127, ptr %9, align 8
  %128 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorImES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  br i1 %128, label %.lr.ph57, label %._crit_edge58

._crit_edge58:                                    ; preds = %.lr.ph57, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #9
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #9
  ret ptr %10

.lr.ph57:                                         ; preds = %125, %.lr.ph57
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorImEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  %130 = load i64, ptr %129, align 8, !tbaa !27
  call void @_ZN5ArrayImE3addEm(ptr noundef nonnull align 8 dereferenceable(24) %123, i64 noundef %130)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorImEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #9
  %132 = call ptr @_ZNKSt3setImSt4lessImESaImEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  store ptr %132, ptr %9, align 8
  %133 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorImES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  br i1 %133, label %.lr.ph57, label %._crit_edge58, !llvm.loop !36

134:                                              ; preds = %.loopexit49, %.loopexit.split-lp, %118, %106, %104, %69
  %.pn.pn.pn = phi { ptr, i32 } [ %70, %69 ], [ %107, %106 ], [ %105, %104 ], [ %119, %118 ], [ %lpad.loopexit, %.loopexit49 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #9
  br label %135

135:                                              ; preds = %.loopexit51, %.loopexit.split-lp52, %134, %60
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %134 ], [ %61, %60 ], [ %lpad.loopexit53, %.loopexit51 ], [ %lpad.loopexit.split-lp54, %.loopexit.split-lp52 ]
  call void @_ZNSt3setImSt4lessImESaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #9
  br label %136

136:                                              ; preds = %135, %24
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %135 ], [ %25, %24 ]
  resume { ptr, i32 } %.pn.pn.pn.pn.pn
}

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

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

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

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

declare noundef i64 @_Z10wh_to_partm(i64 noundef) local_unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9TPCCQueryC2Ev(ptr noundef nonnull align 8 dereferenceable(320)) unnamed_addr #6 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #7

declare noundef i64 @_Z5URandmm(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertEOm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

declare noundef i64 @_Z6NURandmmm(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorImES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #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 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { builtin 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, !13, i64 112}
!6 = !{!"_ZTS9TPCCQuery", !7, i64 0, !13, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !8, i64 160, !9, i64 168, !14, i64 184, !15, i64 192, !16, i64 200, !15, i64 224, !15, i64 225, !8, i64 232, !8, i64 240, !8, i64 248, !8, i64 256, !8, i64 264, !8, i64 272, !8, i64 280, !8, i64 288, !8, i64 296, !8, i64 304, !8, i64 312}
!7 = !{!"_ZTS9BaseQuery", !8, i64 8, !11, i64 16, !11, i64 40, !11, i64 64, !11, i64 88}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS5ArrayImE", !12, i64 0, !8, i64 8, !8, i64 16}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"_ZTS11TPCCTxnType", !9, i64 0}
!14 = !{!"double", !9, i64 0}
!15 = !{!"bool", !9, i64 0}
!16 = !{!"_ZTS5ArrayIP7Item_noE", !12, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !9, i64 0}
!19 = !{!6, !8, i64 120}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!6, !8, i64 128}
!23 = !{!6, !8, i64 136}
!24 = !{!6, !15, i64 224}
!25 = !{!6, !8, i64 232}
!26 = !{!6, !8, i64 240}
!27 = !{!8, !8, i64 0}
!28 = !{!14, !14, i64 0}
!29 = !{!30, !8, i64 0}
!30 = !{!"_ZTS7Item_no", !8, i64 0, !8, i64 8, !8, i64 16}
!31 = distinct !{!31, !21}
!32 = !{!30, !8, i64 16}
!33 = !{!30, !8, i64 8}
!34 = distinct !{!34, !21}
!35 = distinct !{!35, !21}
!36 = distinct !{!36, !21}


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