; LLVM IR from kylewray/nova :: src/pomdp/utilities (pomdp_expand_cpu)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.nova::NovaPOMDP" = type { i32, i32, i32, i32, i32, i32, float, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4nova33pomdp_expand_construct_belief_cpuEPKNS_9NovaPOMDPEjPf(ptr noundef, i32 noundef, ptr noundef) #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @pomdp_expand_random_cpu(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca float, align 4
  %20 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %91, label %23

23:                                               ; preds = %2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !11
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %91, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !14
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %91, label %33

33:                                               ; preds = %28
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 8, !tbaa !15
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %91, label %38

38:                                               ; preds = %33
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %39, i32 0, i32 3
  %41 = load i32, ptr %40, align 4, !tbaa !16
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %91, label %43

43:                                               ; preds = %38
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %44, i32 0, i32 4
  %46 = load i32, ptr %45, align 8, !tbaa !17
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %91, label %48

48:                                               ; preds = %43
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %49, i32 0, i32 5
  %51 = load i32, ptr %50, align 4, !tbaa !18
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %91, label %53

53:                                               ; preds = %48
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %54, i32 0, i32 8
  %56 = load ptr, ptr %55, align 8, !tbaa !19
  %57 = icmp eq ptr %56, null
  br i1 %57, label %91, label %58

58:                                               ; preds = %53
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %59, i32 0, i32 9
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = icmp eq ptr %61, null
  br i1 %62, label %91, label %63

63:                                               ; preds = %58
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %64, i32 0, i32 10
  %66 = load ptr, ptr %65, align 8, !tbaa !21
  %67 = icmp eq ptr %66, null
  br i1 %67, label %91, label %68

68:                                               ; preds = %63
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %69, i32 0, i32 11
  %71 = load ptr, ptr %70, align 8, !tbaa !22
  %72 = icmp eq ptr %71, null
  br i1 %72, label %91, label %73

73:                                               ; preds = %68
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %74, i32 0, i32 12
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = icmp eq ptr %76, null
  br i1 %77, label %91, label %78

78:                                               ; preds = %73
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %79, i32 0, i32 13
  %81 = load ptr, ptr %80, align 8, !tbaa !24
  %82 = icmp eq ptr %81, null
  br i1 %82, label %91, label %83

83:                                               ; preds = %78
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %84, i32 0, i32 7
  %86 = load i32, ptr %85, align 4, !tbaa !25
  %87 = icmp ult i32 %86, 1
  br i1 %87, label %91, label %88

88:                                               ; preds = %83
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %94

91:                                               ; preds = %88, %83, %78, %73, %68, %63, %58, %53, %48, %43, %38, %33, %28, %23, %2
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str, ptr noundef @.str.1) #9
  store i32 1, ptr %3, align 4
  br label %272

94:                                               ; preds = %88
  %95 = call i64 @time(ptr noundef null) #9
  %96 = trunc i64 %95 to i32
  call void @srand(i32 noundef %96) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !11
  %100 = zext i32 %99 to i64
  %101 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %100, i64 4)
  %102 = extractvalue { i64, i1 } %101, 1
  %103 = extractvalue { i64, i1 } %101, 0
  %104 = select i1 %102, i64 -1, i64 %103
  %105 = call noalias noundef nonnull ptr @_Znam(i64 noundef %104) #10
  store ptr %105, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %106 = load i32, ptr %5, align 4, !tbaa !9
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %107, i32 0, i32 0
  %109 = load i32, ptr %108, align 8, !tbaa !11
  %110 = mul i32 %106, %109
  %111 = zext i32 %110 to i64
  %112 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %111, i64 4)
  %113 = extractvalue { i64, i1 } %112, 1
  %114 = extractvalue { i64, i1 } %112, 0
  %115 = select i1 %113, i64 -1, i64 %114
  %116 = call noalias noundef nonnull ptr @_Znam(i64 noundef %115) #10
  store ptr %116, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %131, %94
  %118 = load i32, ptr %9, align 4, !tbaa !9
  %119 = load i32, ptr %5, align 4, !tbaa !9
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %120, i32 0, i32 0
  %122 = load i32, ptr %121, align 8, !tbaa !11
  %123 = mul i32 %119, %122
  %124 = icmp ult i32 %118, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %134

126:                                              ; preds = %117
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = load i32, ptr %9, align 4, !tbaa !9
  %129 = zext i32 %128 to i64
  %130 = getelementptr inbounds float, ptr %127, i64 %129
  store float 0.000000e+00, ptr %130, align 4, !tbaa !26
  br label %131

131:                                              ; preds = %126
  %132 = load i32, ptr %9, align 4, !tbaa !9
  %133 = add i32 %132, 1
  store i32 %133, ptr %9, align 4, !tbaa !9
  br label %117, !llvm.loop !27

134:                                              ; preds = %125
  br label %135

135:                                              ; preds = %258, %134
  %136 = load i32, ptr %7, align 4, !tbaa !9
  %137 = load i32, ptr %5, align 4, !tbaa !9
  %138 = icmp ult i32 %136, %137
  br i1 %138, label %139, label %259

139:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  %140 = call i32 @rand() #9
  %141 = sitofp i32 %140 to float
  %142 = fdiv float %141, 0x41E0000000000000
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %143, i32 0, i32 4
  %145 = load i32, ptr %144, align 8, !tbaa !17
  %146 = uitofp i32 %145 to float
  %147 = fmul float %142, %146
  %148 = fptoui float %147 to i32
  store i32 %148, ptr %10, align 4, !tbaa !9
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = load i32, ptr %10, align 4, !tbaa !9
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = call noundef i32 @_ZN4nova33pomdp_expand_construct_belief_cpuEPKNS_9NovaPOMDPEjPf(ptr noundef %149, i32 noundef %150, ptr noundef %151)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %153 = call i32 @rand() #9
  %154 = sitofp i32 %153 to float
  %155 = fdiv float %154, 0x41E0000000000000
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %156, i32 0, i32 7
  %158 = load i32, ptr %157, align 4, !tbaa !25
  %159 = add i32 %158, 1
  %160 = uitofp i32 %159 to float
  %161 = fmul float %155, %160
  %162 = fptoui float %161 to i32
  store i32 %162, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %254, %139
  %164 = load i32, ptr %12, align 4, !tbaa !9
  %165 = load i32, ptr %11, align 4, !tbaa !9
  %166 = icmp ult i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 7, ptr %13, align 4
  br label %257

168:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %169 = call i32 @rand() #9
  %170 = sitofp i32 %169 to float
  %171 = fdiv float %170, 0x41E0000000000000
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 8, !tbaa !15
  %175 = uitofp i32 %174 to float
  %176 = fmul float %171, %175
  %177 = fptoui float %176 to i32
  store i32 %177, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store float 0.000000e+00, ptr %15, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %178 = call i32 @rand() #9
  %179 = sitofp i32 %178 to float
  %180 = fdiv float %179, 0x41E0000000000000
  store float %180, ptr %16, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %209, %168
  %182 = load i32, ptr %18, align 4, !tbaa !9
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %183, i32 0, i32 3
  %185 = load i32, ptr %184, align 4, !tbaa !16
  %186 = icmp ult i32 %182, %185
  br i1 %186, label %188, label %187

187:                                              ; preds = %181
  store i32 10, ptr %13, align 4
  br label %212

188:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store float 0.000000e+00, ptr %19, align 4, !tbaa !26
  %189 = load ptr, ptr %4, align 8, !tbaa !5
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = load i32, ptr %14, align 4, !tbaa !9
  %192 = load i32, ptr %18, align 4, !tbaa !9
  %193 = call noundef i32 @_ZN4nova40pomdp_expand_probability_observation_cpuEPKNS_9NovaPOMDPEPKfjjRf(ptr noundef %189, ptr noundef %190, i32 noundef %191, i32 noundef %192, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %194 = load float, ptr %19, align 4, !tbaa !26
  %195 = load float, ptr %15, align 4, !tbaa !26
  %196 = fadd float %195, %194
  store float %196, ptr %15, align 4, !tbaa !26
  %197 = load float, ptr %15, align 4, !tbaa !26
  %198 = load float, ptr %16, align 4, !tbaa !26
  %199 = fcmp oge float %197, %198
  br i1 %199, label %200, label %205

200:                                              ; preds = %188
  %201 = load float, ptr %19, align 4, !tbaa !26
  %202 = fcmp ogt float %201, 0.000000e+00
  br i1 %202, label %203, label %205

203:                                              ; preds = %200
  %204 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %204, ptr %17, align 4, !tbaa !9
  store i32 10, ptr %13, align 4
  br label %206

205:                                              ; preds = %200, %188
  store i32 0, ptr %13, align 4
  br label %206

206:                                              ; preds = %205, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  %207 = load i32, ptr %13, align 4
  switch i32 %207, label %212 [
    i32 0, label %208
  ]

208:                                              ; preds = %206
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %18, align 4, !tbaa !9
  %211 = add i32 %210, 1
  store i32 %211, ptr %18, align 4, !tbaa !9
  br label %181, !llvm.loop !29

212:                                              ; preds = %206, %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %213

213:                                              ; preds = %212
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  store ptr null, ptr %20, align 8, !tbaa !5
  %214 = load ptr, ptr %4, align 8, !tbaa !5
  %215 = load ptr, ptr %6, align 8, !tbaa !5
  %216 = load i32, ptr %14, align 4, !tbaa !9
  %217 = load i32, ptr %17, align 4, !tbaa !9
  %218 = call i32 @pomdp_belief_update_cpu(ptr noundef %214, ptr noundef %215, i32 noundef %216, i32 noundef %217, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = load ptr, ptr %20, align 8, !tbaa !5
  %221 = load ptr, ptr %4, align 8, !tbaa !5
  %222 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %221, i32 0, i32 0
  %223 = load i32, ptr %222, align 8, !tbaa !11
  %224 = zext i32 %223 to i64
  %225 = mul i64 %224, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %219, ptr align 4 %220, i64 %225, i1 false)
  %226 = load ptr, ptr %20, align 8, !tbaa !5
  %227 = icmp eq ptr %226, null
  br i1 %227, label %229, label %228

228:                                              ; preds = %213
  call void @_ZdaPv(ptr noundef %226) #11
  br label %229

229:                                              ; preds = %228, %213
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = load i32, ptr %7, align 4, !tbaa !9
  %232 = load ptr, ptr %4, align 8, !tbaa !5
  %233 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %232, i32 0, i32 0
  %234 = load i32, ptr %233, align 8, !tbaa !11
  %235 = mul i32 %231, %234
  %236 = zext i32 %235 to i64
  %237 = getelementptr inbounds float, ptr %230, i64 %236
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = load ptr, ptr %4, align 8, !tbaa !5
  %240 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %239, i32 0, i32 0
  %241 = load i32, ptr %240, align 8, !tbaa !11
  %242 = zext i32 %241 to i64
  %243 = mul i64 %242, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %237, ptr align 4 %238, i64 %243, i1 false)
  %244 = load i32, ptr %7, align 4, !tbaa !9
  %245 = add i32 %244, 1
  store i32 %245, ptr %7, align 4, !tbaa !9
  %246 = load i32, ptr %7, align 4, !tbaa !9
  %247 = load i32, ptr %5, align 4, !tbaa !9
  %248 = icmp uge i32 %246, %247
  br i1 %248, label %249, label %250

249:                                              ; preds = %229
  store i32 7, ptr %13, align 4
  br label %251

250:                                              ; preds = %229
  store i32 0, ptr %13, align 4
  br label %251

251:                                              ; preds = %250, %249
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  %252 = load i32, ptr %13, align 4
  switch i32 %252, label %257 [
    i32 0, label %253
  ]

253:                                              ; preds = %251
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %12, align 4, !tbaa !9
  %256 = add i32 %255, 1
  store i32 %256, ptr %12, align 4, !tbaa !9
  br label %163, !llvm.loop !30

257:                                              ; preds = %251, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %258

258:                                              ; preds = %257
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %135, !llvm.loop !31

259:                                              ; preds = %135
  %260 = load ptr, ptr %4, align 8, !tbaa !5
  %261 = load i32, ptr %5, align 4, !tbaa !9
  %262 = load ptr, ptr %8, align 8, !tbaa !5
  %263 = call i32 @pomdp_add_new_raw_beliefs_cpu(ptr noundef %260, i32 noundef %261, ptr noundef %262)
  %264 = load ptr, ptr %6, align 8, !tbaa !5
  %265 = icmp eq ptr %264, null
  br i1 %265, label %267, label %266

266:                                              ; preds = %259
  call void @_ZdaPv(ptr noundef %264) #11
  br label %267

267:                                              ; preds = %266, %259
  %268 = load ptr, ptr %8, align 8, !tbaa !5
  %269 = icmp eq ptr %268, null
  br i1 %269, label %271, label %270

270:                                              ; preds = %267
  call void @_ZdaPv(ptr noundef %268) #11
  br label %271

271:                                              ; preds = %270, %267
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  br label %272

272:                                              ; preds = %271, %91
  %273 = load i32, ptr %3, align 4
  ret i32 %273
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare void @srand(i32 noundef) #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #4

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

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

declare i32 @pomdp_belief_update_cpu(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #6

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #8

declare i32 @pomdp_add_new_raw_beliefs_cpu(ptr noundef, i32 noundef, ptr noundef) #6

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN4nova9NovaPOMDPE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !10, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 20}
!19 = !{!12, !6, i64 32}
!20 = !{!12, !6, i64 40}
!21 = !{!12, !6, i64 48}
!22 = !{!12, !6, i64 56}
!23 = !{!12, !6, i64 64}
!24 = !{!12, !6, i64 72}
!25 = !{!12, !10, i64 28}
!26 = !{!13, !13, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}
!31 = distinct !{!31, !28}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4nova33pomdp_expand_construct_belief_cpuEPKNS_9NovaPOMDPEjPf(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local range(i32 0, 2) i32 @pomdp_expand_random_cpu(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca float, align 4
  %4 = alloca ptr, align 8
  %5 = icmp eq ptr %0, null
  br i1 %5, label %58, label %6

6:                                                ; preds = %2
  %7 = load i32, ptr %0, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %58, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %58, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %58, label %17

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %58, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load i32, ptr %22, align 8, !tbaa !15
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %58, label %25

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 20
  %27 = load i32, ptr %26, align 4, !tbaa !16
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %58, label %29

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 32
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %32 = icmp eq ptr %31, null
  br i1 %32, label %58, label %33

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  %36 = icmp eq ptr %35, null
  br i1 %36, label %58, label %37

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %0, i64 48
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = icmp eq ptr %39, null
  br i1 %40, label %58, label %41

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %0, i64 56
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = icmp eq ptr %43, null
  br i1 %44, label %58, label %45

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %0, i64 64
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  %48 = icmp eq ptr %47, null
  br i1 %48, label %58, label %49

49:                                               ; preds = %45
  %50 = getelementptr inbounds i8, ptr %0, i64 72
  %51 = load ptr, ptr %50, align 8, !tbaa !22
  %52 = icmp eq ptr %51, null
  br i1 %52, label %58, label %53

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %0, i64 28
  %55 = load i32, ptr %54, align 4, !tbaa !23
  %56 = icmp eq i32 %55, 0
  %57 = icmp eq i32 %1, 0
  %or.cond = or i1 %57, %56
  br i1 %or.cond, label %58, label %61

58:                                               ; preds = %53, %49, %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %6, %2
  %59 = load ptr, ptr @stderr, align 8, !tbaa !24
  %60 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1) #10
  br label %125

61:                                               ; preds = %53
  %62 = tail call i64 @time(ptr noundef null) #11
  %63 = trunc i64 %62 to i32
  tail call void @srand(i32 noundef %63) #11
  %64 = load i32, ptr %0, align 8, !tbaa !5
  %65 = zext i32 %64 to i64
  %66 = shl nuw nsw i64 %65, 2
  %67 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %66) #12
  %68 = mul i32 %64, %1
  %69 = zext i32 %68 to i64
  %70 = shl nuw nsw i64 %69, 2
  %71 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %70) #12
  %.not102 = icmp eq i32 %68, 0
  br i1 %.not102, label %.lr.ph99.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %61
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %71, i8 0, i64 %70, i1 false), !tbaa !25
  br label %.lr.ph99.preheader

.lr.ph99.preheader:                               ; preds = %61, %.lr.ph.preheader
  br label %.lr.ph99

.lr.ph99:                                         ; preds = %.lr.ph99.preheader, %._crit_edge95
  %.07498 = phi i32 [ %.276, %._crit_edge95 ], [ 0, %.lr.ph99.preheader ]
  %72 = call i32 @rand() #11
  %73 = sitofp i32 %72 to float
  %74 = fmul float %73, 0x3E00000000000000
  %75 = load i32, ptr %22, align 8, !tbaa !15
  %76 = uitofp i32 %75 to float
  %77 = fmul float %74, %76
  %78 = fptoui float %77 to i32
  %79 = call noundef i32 @_ZN4nova33pomdp_expand_construct_belief_cpuEPKNS_9NovaPOMDPEjPf(ptr noundef nonnull %0, i32 noundef %78, ptr noundef nonnull %67)
  %80 = call i32 @rand() #11
  %81 = sitofp i32 %80 to float
  %82 = fmul float %81, 0x3E00000000000000
  %83 = load i32, ptr %54, align 4, !tbaa !23
  %84 = add i32 %83, 1
  %85 = uitofp i32 %84 to float
  %86 = fmul float %82, %85
  %87 = fptoui float %86 to i32
  %.not104 = icmp eq i32 %87, 0
  br i1 %.not104, label %._crit_edge95, label %.lr.ph94

.lr.ph94:                                         ; preds = %.lr.ph99, %115
  %.17592 = phi i32 [ %120, %115 ], [ %.07498, %.lr.ph99 ]
  %.07991 = phi i32 [ %121, %115 ], [ 0, %.lr.ph99 ]
  %88 = call i32 @rand() #11
  %89 = sitofp i32 %88 to float
  %90 = fmul float %89, 0x3E00000000000000
  %91 = load i32, ptr %14, align 8, !tbaa !13
  %92 = uitofp i32 %91 to float
  %93 = fmul float %90, %92
  %94 = fptoui float %93 to i32
  %95 = call i32 @rand() #11
  %96 = sitofp i32 %95 to float
  %97 = fmul float %96, 0x3E00000000000000
  %98 = load i32, ptr %18, align 4, !tbaa !14
  %.not105 = icmp eq i32 %98, 0
  br i1 %.not105, label %._crit_edge, label %.lr.ph88

.lr.ph88:                                         ; preds = %.lr.ph94, %104
  %.087 = phi i32 [ %105, %104 ], [ 0, %.lr.ph94 ]
  %.07386 = phi float [ %101, %104 ], [ 0.000000e+00, %.lr.ph94 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #11
  store float 0.000000e+00, ptr %3, align 4, !tbaa !25
  %99 = call noundef i32 @_ZN4nova40pomdp_expand_probability_observation_cpuEPKNS_9NovaPOMDPEPKfjjRf(ptr noundef nonnull %0, ptr noundef nonnull %67, i32 noundef %94, i32 noundef %.087, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %100 = load float, ptr %3, align 4
  %101 = fadd float %.07386, %100
  %102 = fcmp ult float %101, %97
  %103 = fcmp ule float %100, 0.000000e+00
  %or.cond4.not = or i1 %103, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #11
  br i1 %or.cond4.not, label %104, label %._crit_edge

104:                                              ; preds = %.lr.ph88
  %105 = add nuw i32 %.087, 1
  %106 = load i32, ptr %18, align 4, !tbaa !14
  %107 = icmp ult i32 %105, %106
  br i1 %107, label %.lr.ph88, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %.lr.ph88, %104, %.lr.ph94
  %.2 = phi i32 [ 0, %.lr.ph94 ], [ 0, %104 ], [ %.087, %.lr.ph88 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #11
  store ptr null, ptr %4, align 8, !tbaa !24
  %108 = call i32 @pomdp_belief_update_cpu(ptr noundef nonnull %0, ptr noundef nonnull %67, i32 noundef %94, i32 noundef %.2, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %109 = load ptr, ptr %4, align 8, !tbaa !24
  %110 = load i32, ptr %0, align 8, !tbaa !5
  %111 = zext i32 %110 to i64
  %112 = shl nuw nsw i64 %111, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %67, ptr align 4 %109, i64 %112, i1 false)
  %113 = icmp eq ptr %109, null
  br i1 %113, label %115, label %114

114:                                              ; preds = %._crit_edge
  call void @_ZdaPv(ptr noundef nonnull %109) #13
  %.pre = load i32, ptr %0, align 8, !tbaa !5
  %.pre107 = zext i32 %.pre to i64
  %.pre108 = shl nuw nsw i64 %.pre107, 2
  br label %115

115:                                              ; preds = %114, %._crit_edge
  %.pre-phi109 = phi i64 [ %.pre108, %114 ], [ %112, %._crit_edge ]
  %116 = phi i32 [ %.pre, %114 ], [ %110, %._crit_edge ]
  %117 = mul i32 %116, %.17592
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds float, ptr %71, i64 %118
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %119, ptr nonnull align 4 %67, i64 %.pre-phi109, i1 false)
  %120 = add i32 %.17592, 1
  %.not = icmp ult i32 %120, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #11
  %121 = add nuw i32 %.07991, 1
  %122 = icmp ult i32 %121, %87
  %or.cond101 = select i1 %.not, i1 %122, i1 false
  br i1 %or.cond101, label %.lr.ph94, label %._crit_edge95, !llvm.loop !28

._crit_edge95:                                    ; preds = %115, %.lr.ph99
  %.276 = phi i32 [ %.07498, %.lr.ph99 ], [ %120, %115 ]
  %123 = icmp ult i32 %.276, %1
  br i1 %123, label %.lr.ph99, label %._crit_edge100, !llvm.loop !29

._crit_edge100:                                   ; preds = %._crit_edge95
  %124 = call i32 @pomdp_add_new_raw_beliefs_cpu(ptr noundef nonnull %0, i32 noundef %1, ptr noundef nonnull %71)
  call void @_ZdaPv(ptr noundef nonnull %67) #13
  call void @_ZdaPv(ptr noundef nonnull %71) #13
  br label %125

125:                                              ; preds = %._crit_edge100, %58
  %.072 = phi i32 [ 1, %58 ], [ 0, %._crit_edge100 ]
  ret i32 %.072
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #4

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

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

declare i32 @pomdp_belief_update_cpu(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #8

declare i32 @pomdp_add_new_raw_beliefs_cpu(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree 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 #4 = { 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 #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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { cold nounwind }
attributes #11 = { nounwind }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { 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, !7, i64 0}
!6 = !{!"_ZTSN4nova9NovaPOMDPE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !7, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 20}
!17 = !{!6, !11, i64 32}
!18 = !{!6, !11, i64 40}
!19 = !{!6, !11, i64 48}
!20 = !{!6, !11, i64 56}
!21 = !{!6, !11, i64 64}
!22 = !{!6, !11, i64 72}
!23 = !{!6, !7, i64 28}
!24 = !{!11, !11, i64 0}
!25 = !{!10, !10, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = distinct !{!29, !27}


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