; LLVM IR from pmwkaa/monotone :: monotone/engine/storage (storage_mgr)

; 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.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }
%struct.Source = type { %struct.Uuid, %struct.Str, %struct.Str, %struct.Str, i8, i8, i8, i64, i64, %struct.Str, i64, %struct.Str, %struct.Str }
%struct.Uuid = type { i64, i64 }
%struct.Str = type { ptr, ptr, i8 }
%struct.Storage = type { %struct.List, i32, i32, i64, i64, ptr, ptr, %struct.List }
%struct.List = type { ptr, ptr }
%struct.Part = type { %struct.Id, i32, i64, i64, i8, ptr, %struct.Memtable, %struct.Memtable, %struct.File, %struct.Index, %struct.Buf, ptr, ptr, ptr, %struct.List }
%struct.Id = type { i64, i64 }
%struct.Memtable = type { ptr, %struct.Rbtree, i32, i32, i32, i64, i64, i64, %struct.List, i32, %struct.Heap }
%struct.Rbtree = type { ptr }
%struct.Heap = type { ptr, ptr, i32, ptr }
%struct.File = type { i32, i64, %struct.Str, %struct.List }
%struct.Index = type <{ i32, i32, i32, i32, %struct.Id, i32, i32, i64, i64, i64, i64, i32, i64, i64, i64, i32, i64, i8, i8, [4 x i32] }>
%struct.Buf = type { ptr, ptr, ptr }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@__func__.storage_mgr_alter = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [62 x i8], align 1

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @source_set_uuid(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @storage_mgr_find(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint noreturn nounwind uwtable
declare hidden void @error_throw_as(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @str_size(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @str_of(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @storage_mgr_mkdir(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @storage_mgr_save(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cloud_detach(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @storage_mgr_alter(ptr noundef %0, ptr noundef %1, i32 noundef %2, i1 noundef zeroext %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %18 = zext i1 %3 to i8
  store i8 %18, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Source, ptr %20, i32 0, i32 1
  %22 = call ptr @storage_mgr_find(ptr noundef %19, ptr noundef %21)
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %40, label %25

25:                                               ; preds = %4
  %26 = load i8, ptr %8, align 1, !tbaa !11, !range !13, !noundef !14
  %27 = trunc i8 %26 to i1
  br i1 %27, label %39, label %28

28:                                               ; preds = %25
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %30 = getelementptr inbounds %struct.Runtime, ptr %29, i32 0, i32 1
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %32 = getelementptr inbounds %struct.Runtime, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Source, ptr %33, i32 0, i32 1
  %35 = call i32 @str_size(ptr noundef %34)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Source, ptr %36, i32 0, i32 1
  %38 = call ptr @str_of(ptr noundef %37)
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %30, ptr noundef %32, ptr noundef @.str.1, ptr noundef @__func__.storage_mgr_alter, i32 noundef 253, ptr noundef @.str.4, i32 noundef %35, ptr noundef %38) #6
  unreachable

39:                                               ; preds = %25
  store i32 1, ptr %10, align 4
  br label %235

40:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Storage, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 8, !tbaa !15
  %44 = icmp eq i32 %43, 0
  %45 = zext i1 %44 to i8
  store i8 %45, ptr %11, align 1, !tbaa !11
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = and i32 %46, 64
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %64

49:                                               ; preds = %40
  %50 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %51 = trunc i8 %50 to i1
  br i1 %51, label %63, label %52

52:                                               ; preds = %49
  %53 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %54 = getelementptr inbounds %struct.Runtime, ptr %53, i32 0, i32 1
  %55 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %56 = getelementptr inbounds %struct.Runtime, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.Source, ptr %57, i32 0, i32 1
  %59 = call i32 @str_size(ptr noundef %58)
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Source, ptr %60, i32 0, i32 1
  %62 = call ptr @str_of(ptr noundef %61)
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %54, ptr noundef %56, ptr noundef @.str.1, ptr noundef @__func__.storage_mgr_alter, i32 noundef 262, ptr noundef @.str.8, i32 noundef %59, ptr noundef %62) #6
  unreachable

63:                                               ; preds = %49
  br label %64

64:                                               ; preds = %63, %40
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = and i32 %65, 4
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %89

68:                                               ; preds = %64
  %69 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %70 = trunc i8 %69 to i1
  br i1 %70, label %82, label %71

71:                                               ; preds = %68
  %72 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %73 = getelementptr inbounds %struct.Runtime, ptr %72, i32 0, i32 1
  %74 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %75 = getelementptr inbounds %struct.Runtime, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.Source, ptr %76, i32 0, i32 1
  %78 = call i32 @str_size(ptr noundef %77)
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Source, ptr %79, i32 0, i32 1
  %81 = call ptr @str_of(ptr noundef %80)
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %73, ptr noundef %75, ptr noundef @.str.1, ptr noundef @__func__.storage_mgr_alter, i32 noundef 269, ptr noundef @.str.8, i32 noundef %78, ptr noundef %81) #6
  unreachable

82:                                               ; preds = %68
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.Storage, ptr %84, i32 0, i32 6
  %86 = load ptr, ptr %85, align 8, !tbaa !19
  %87 = getelementptr inbounds %struct.Source, ptr %86, i32 0, i32 0
  call void @source_set_uuid(ptr noundef %83, ptr noundef %87)
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  call void @storage_mgr_mkdir(ptr noundef %88)
  br label %89

89:                                               ; preds = %82, %64
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = and i32 %90, 2048
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %97, label %93

93:                                               ; preds = %89
  %94 = load i32, ptr %7, align 4, !tbaa !9
  %95 = and i32 %94, 4096
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %112

97:                                               ; preds = %93, %89
  %98 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %99 = trunc i8 %98 to i1
  br i1 %99, label %111, label %100

100:                                              ; preds = %97
  %101 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %102 = getelementptr inbounds %struct.Runtime, ptr %101, i32 0, i32 1
  %103 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %104 = getelementptr inbounds %struct.Runtime, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.Source, ptr %105, i32 0, i32 1
  %107 = call i32 @str_size(ptr noundef %106)
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.Source, ptr %108, i32 0, i32 1
  %110 = call ptr @str_of(ptr noundef %109)
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %102, ptr noundef %104, ptr noundef @.str.1, ptr noundef @__func__.storage_mgr_alter, i32 noundef 280, ptr noundef @.str.8, i32 noundef %107, ptr noundef %110) #6
  unreachable

111:                                              ; preds = %97
  br label %112

112:                                              ; preds = %111, %93
  %113 = load i32, ptr %7, align 4, !tbaa !9
  %114 = and i32 %113, 8
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %161

116:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.Storage, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds %struct.List, ptr %118, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8, !tbaa !20
  store ptr %120, ptr %12, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %144, %116
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.Storage, ptr %123, i32 0, i32 0
  %125 = icmp ne ptr %122, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %121
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %148

127:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %128 = load ptr, ptr %12, align 8, !tbaa !5
  %129 = getelementptr inbounds i8, ptr %128, i64 -520
  store ptr %129, ptr %13, align 8, !tbaa !5
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = call zeroext i1 @part_has(ptr noundef %130, i32 noundef 8)
  br i1 %131, label %132, label %143

132:                                              ; preds = %127
  %133 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %134 = getelementptr inbounds %struct.Runtime, ptr %133, i32 0, i32 1
  %135 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %136 = getelementptr inbounds %struct.Runtime, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.Source, ptr %137, i32 0, i32 1
  %139 = call i32 @str_size(ptr noundef %138)
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.Source, ptr %140, i32 0, i32 1
  %142 = call ptr @str_of(ptr noundef %141)
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %134, ptr noundef %136, ptr noundef @.str.1, ptr noundef @__func__.storage_mgr_alter, i32 noundef 293, ptr noundef @.str.9, i32 noundef %139, ptr noundef %142) #6
  unreachable

143:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %144

144:                                              ; preds = %143
  %145 = load ptr, ptr %12, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.List, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %146, align 8, !tbaa !21
  store ptr %147, ptr %12, align 8, !tbaa !5
  br label %121, !llvm.loop !22

148:                                              ; preds = %126
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.Storage, ptr %149, i32 0, i32 5
  %151 = load ptr, ptr %150, align 8, !tbaa !24
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %160

153:                                              ; preds = %148
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.Storage, ptr %154, i32 0, i32 5
  %156 = load ptr, ptr %155, align 8, !tbaa !24
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.Storage, ptr %157, i32 0, i32 6
  %159 = load ptr, ptr %158, align 8, !tbaa !19
  call void @cloud_detach(ptr noundef %156, ptr noundef %159)
  br label %160

160:                                              ; preds = %153, %148
  br label %161

161:                                              ; preds = %160, %112
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.Storage, ptr %162, i32 0, i32 6
  %164 = load ptr, ptr %163, align 8, !tbaa !19
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = load i32, ptr %7, align 4, !tbaa !9
  call void @source_alter(ptr noundef %164, ptr noundef %165, i32 noundef %166)
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  call void @storage_mgr_save(ptr noundef %167)
  %168 = load i32, ptr %7, align 4, !tbaa !9
  %169 = and i32 %168, 8
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %234

171:                                              ; preds = %161
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.Storage, ptr %172, i32 0, i32 5
  %174 = load ptr, ptr %173, align 8, !tbaa !24
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %182

176:                                              ; preds = %171
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.Storage, ptr %177, i32 0, i32 5
  %179 = load ptr, ptr %178, align 8, !tbaa !24
  call void @cloud_unref(ptr noundef %179)
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.Storage, ptr %180, i32 0, i32 5
  store ptr null, ptr %181, align 8, !tbaa !24
  br label %182

182:                                              ; preds = %176, %171
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.Storage, ptr %183, i32 0, i32 0
  %185 = getelementptr inbounds %struct.List, ptr %184, i32 0, i32 0
  %186 = load ptr, ptr %185, align 8, !tbaa !20
  store ptr %186, ptr %14, align 8, !tbaa !5
  br label %187

187:                                              ; preds = %198, %182
  %188 = load ptr, ptr %14, align 8, !tbaa !5
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.Storage, ptr %189, i32 0, i32 0
  %191 = icmp ne ptr %188, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %187
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %202

193:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %194 = load ptr, ptr %14, align 8, !tbaa !5
  %195 = getelementptr inbounds i8, ptr %194, i64 -520
  store ptr %195, ptr %15, align 8, !tbaa !5
  %196 = load ptr, ptr %15, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.Part, ptr %196, i32 0, i32 11
  store ptr null, ptr %197, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %198

198:                                              ; preds = %193
  %199 = load ptr, ptr %14, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.List, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !21
  store ptr %201, ptr %14, align 8, !tbaa !5
  br label %187, !llvm.loop !35

202:                                              ; preds = %192
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = load ptr, ptr %9, align 8, !tbaa !5
  call void @storage_set_cloud(ptr noundef %203, ptr noundef %204, i1 noundef zeroext true)
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.Storage, ptr %205, i32 0, i32 5
  %207 = load ptr, ptr %206, align 8, !tbaa !24
  %208 = icmp ne ptr %207, null
  br i1 %208, label %209, label %233

209:                                              ; preds = %202
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %210 = load ptr, ptr %9, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.Storage, ptr %210, i32 0, i32 0
  %212 = getelementptr inbounds %struct.List, ptr %211, i32 0, i32 0
  %213 = load ptr, ptr %212, align 8, !tbaa !20
  store ptr %213, ptr %16, align 8, !tbaa !5
  br label %214

214:                                              ; preds = %228, %209
  %215 = load ptr, ptr %16, align 8, !tbaa !5
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.Storage, ptr %216, i32 0, i32 0
  %218 = icmp ne ptr %215, %217
  br i1 %218, label %220, label %219

219:                                              ; preds = %214
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %232

220:                                              ; preds = %214
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %221 = load ptr, ptr %16, align 8, !tbaa !5
  %222 = getelementptr inbounds i8, ptr %221, i64 -520
  store ptr %222, ptr %17, align 8, !tbaa !5
  %223 = load ptr, ptr %9, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.Storage, ptr %223, i32 0, i32 5
  %225 = load ptr, ptr %224, align 8, !tbaa !24
  %226 = load ptr, ptr %17, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.Part, ptr %226, i32 0, i32 11
  store ptr %225, ptr %227, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %228

228:                                              ; preds = %220
  %229 = load ptr, ptr %16, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.List, ptr %229, i32 0, i32 0
  %231 = load ptr, ptr %230, align 8, !tbaa !21
  store ptr %231, ptr %16, align 8, !tbaa !5
  br label %214, !llvm.loop !36

232:                                              ; preds = %219
  br label %233

233:                                              ; preds = %232, %202
  br label %234

234:                                              ; preds = %233, %161
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  store i32 0, ptr %10, align 4
  br label %235

235:                                              ; preds = %234, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %236 = load i32, ptr %10, align 4
  switch i32 %236, label %238 [
    i32 0, label %237
    i32 1, label %237
  ]

237:                                              ; preds = %235, %235
  ret void

238:                                              ; preds = %235
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @part_has(ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @source_alter(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cloud_unref(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @storage_set_cloud(ptr noundef, ptr noundef, i1 noundef zeroext) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { inlinehint noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 16}
!16 = !{!"Storage", !17, i64 0, !10, i64 16, !10, i64 20, !18, i64 24, !18, i64 32, !6, i64 40, !6, i64 48, !17, i64 56}
!17 = !{!"List", !6, i64 0, !6, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!16, !6, i64 48}
!20 = !{!16, !6, i64 0}
!21 = !{!17, !6, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!16, !6, i64 40}
!25 = !{!26, !6, i64 496}
!26 = !{!"Part", !27, i64 0, !10, i64 16, !18, i64 24, !18, i64 32, !12, i64 40, !6, i64 48, !28, i64 56, !28, i64 168, !31, i64 280, !33, i64 336, !34, i64 472, !6, i64 496, !6, i64 504, !6, i64 512, !17, i64 520}
!27 = !{!"Id", !18, i64 0, !18, i64 8}
!28 = !{!"Memtable", !6, i64 0, !29, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !18, i64 32, !18, i64 40, !18, i64 48, !17, i64 56, !10, i64 72, !30, i64 80}
!29 = !{!"Rbtree", !6, i64 0}
!30 = !{!"Heap", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!31 = !{!"File", !10, i64 0, !18, i64 8, !32, i64 16, !17, i64 40}
!32 = !{!"Str", !6, i64 0, !6, i64 8, !12, i64 16}
!33 = !{!"Index", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !27, i64 16, !10, i64 32, !10, i64 36, !18, i64 40, !18, i64 48, !18, i64 56, !18, i64 64, !10, i64 72, !18, i64 76, !18, i64 84, !18, i64 92, !10, i64 100, !18, i64 104, !7, i64 112, !7, i64 113, !7, i64 114}
!34 = !{!"Buf", !6, i64 0, !6, i64 8, !6, i64 16}
!35 = distinct !{!35, !23}
!36 = distinct !{!36, !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"

%struct.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@__func__.storage_mgr_alter = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @source_set_uuid(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @storage_mgr_find(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint noreturn nounwind uwtable
declare hidden void @error_throw_as(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @str_size(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @str_of(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @storage_mgr_mkdir(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @storage_mgr_save(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cloud_detach(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @storage_mgr_alter(ptr noundef %0, ptr noundef %1, i32 noundef %2, i1 noundef zeroext %3) local_unnamed_addr #2 {
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %6 = tail call ptr @storage_mgr_find(ptr noundef %0, ptr noundef nonnull %5)
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %13

7:                                                ; preds = %4
  br i1 %3, label %.loopexit, label %8

8:                                                ; preds = %7
  %9 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = tail call i32 @str_size(ptr noundef nonnull %5)
  %12 = tail call ptr @str_of(ptr noundef nonnull %5)
  tail call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %10, ptr noundef nonnull %9, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.storage_mgr_alter, i32 noundef 253, ptr noundef nonnull @.str.4, i32 noundef %11, ptr noundef %12) #4
  unreachable

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %6, i64 16
  %15 = load i32, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i32 %15, 0
  %17 = and i32 %2, 64
  %.not63 = icmp eq i32 %17, 0
  %brmerge = select i1 %.not63, i1 true, i1 %16
  br i1 %brmerge, label %23, label %18

18:                                               ; preds = %13
  %19 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = tail call i32 @str_size(ptr noundef nonnull %5)
  %22 = tail call ptr @str_of(ptr noundef nonnull %5)
  tail call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %20, ptr noundef nonnull %19, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.storage_mgr_alter, i32 noundef 262, ptr noundef nonnull @.str.8, i32 noundef %21, ptr noundef %22) #4
  unreachable

23:                                               ; preds = %13
  %24 = and i32 %2, 4
  %.not64 = icmp eq i32 %24, 0
  br i1 %.not64, label %33, label %25

25:                                               ; preds = %23
  br i1 %16, label %.thread, label %26

26:                                               ; preds = %25
  %27 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = tail call i32 @str_size(ptr noundef nonnull %5)
  %30 = tail call ptr @str_of(ptr noundef nonnull %5)
  tail call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %28, ptr noundef nonnull %27, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.storage_mgr_alter, i32 noundef 269, ptr noundef nonnull @.str.8, i32 noundef %29, ptr noundef %30) #4
  unreachable

.thread:                                          ; preds = %25
  %31 = getelementptr inbounds i8, ptr %6, i64 48
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  tail call void @source_set_uuid(ptr noundef %1, ptr noundef %32)
  tail call void @storage_mgr_mkdir(ptr noundef %1)
  br label %40

33:                                               ; preds = %23
  %34 = and i32 %2, 6144
  %or.cond = icmp eq i32 %34, 0
  %brmerge74 = select i1 %or.cond, i1 true, i1 %16
  br i1 %brmerge74, label %40, label %35

35:                                               ; preds = %33
  %36 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = tail call i32 @str_size(ptr noundef nonnull %5)
  %39 = tail call ptr @str_of(ptr noundef nonnull %5)
  tail call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %37, ptr noundef nonnull %36, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.storage_mgr_alter, i32 noundef 280, ptr noundef nonnull @.str.8, i32 noundef %38, ptr noundef %39) #4
  unreachable

40:                                               ; preds = %.thread, %33
  %41 = and i32 %2, 8
  %.not67 = icmp eq i32 %41, 0
  br i1 %.not67, label %.critedge, label %.preheader79

.preheader79:                                     ; preds = %40, %45
  %.058.in = phi ptr [ %.058, %45 ], [ %6, %40 ]
  %.058 = load ptr, ptr %.058.in, align 8, !tbaa !14
  %.not68 = icmp eq ptr %.058, %6
  br i1 %.not68, label %42, label %45

42:                                               ; preds = %.preheader79
  %43 = getelementptr inbounds i8, ptr %6, i64 40
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %.not69 = icmp eq ptr %44, null
  br i1 %.not69, label %56, label %53

45:                                               ; preds = %.preheader79
  %46 = getelementptr inbounds i8, ptr %.058, i64 -520
  %47 = tail call zeroext i1 @part_has(ptr noundef nonnull %46, i32 noundef 8)
  br i1 %47, label %48, label %.preheader79, !llvm.loop !16

48:                                               ; preds = %45
  %49 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = tail call i32 @str_size(ptr noundef nonnull %5)
  %52 = tail call ptr @str_of(ptr noundef nonnull %5)
  tail call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %50, ptr noundef nonnull %49, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.storage_mgr_alter, i32 noundef 293, ptr noundef nonnull @.str.9, i32 noundef %51, ptr noundef %52) #4
  unreachable

53:                                               ; preds = %42
  %54 = getelementptr inbounds i8, ptr %6, i64 48
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  tail call void @cloud_detach(ptr noundef nonnull %44, ptr noundef %55)
  br label %56

56:                                               ; preds = %42, %53
  %57 = getelementptr inbounds i8, ptr %6, i64 48
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  tail call void @source_alter(ptr noundef %58, ptr noundef %1, i32 noundef %2)
  tail call void @storage_mgr_save(ptr noundef %0)
  %59 = load ptr, ptr %43, align 8, !tbaa !15
  %.not70 = icmp eq ptr %59, null
  br i1 %.not70, label %61, label %60

60:                                               ; preds = %56
  tail call void @cloud_unref(ptr noundef nonnull %59)
  store ptr null, ptr %43, align 8, !tbaa !15
  br label %61

61:                                               ; preds = %60, %56
  %.05980 = load ptr, ptr %6, align 8, !tbaa !14
  %.not7181 = icmp eq ptr %.05980, %6
  br i1 %.not7181, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %61
  tail call void @storage_set_cloud(ptr noundef %0, ptr noundef nonnull %6, i1 noundef zeroext true)
  %62 = load ptr, ptr %43, align 8, !tbaa !15
  %.not72 = icmp eq ptr %62, null
  br i1 %.not72, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %.083 = load ptr, ptr %6, align 8, !tbaa !14
  %.not7384 = icmp eq ptr %.083, %6
  br i1 %.not7384, label %.loopexit, label %.lr.ph86

.lr.ph:                                           ; preds = %61, %.lr.ph
  %.05982 = phi ptr [ %.059, %.lr.ph ], [ %.05980, %61 ]
  %63 = getelementptr inbounds i8, ptr %.05982, i64 -24
  store ptr null, ptr %63, align 8, !tbaa !18
  %.059 = load ptr, ptr %.05982, align 8, !tbaa !14
  %.not71 = icmp eq ptr %.059, %6
  br i1 %.not71, label %._crit_edge, label %.lr.ph, !llvm.loop !29

.lr.ph86:                                         ; preds = %.preheader, %.lr.ph86
  %.085 = phi ptr [ %.0, %.lr.ph86 ], [ %.083, %.preheader ]
  %64 = getelementptr inbounds i8, ptr %.085, i64 -24
  store ptr %62, ptr %64, align 8, !tbaa !18
  %.0 = load ptr, ptr %.085, align 8, !tbaa !14
  %.not73 = icmp eq ptr %.0, %6
  br i1 %.not73, label %.loopexit, label %.lr.ph86, !llvm.loop !30

.critedge:                                        ; preds = %40
  %65 = getelementptr inbounds i8, ptr %6, i64 48
  %66 = load ptr, ptr %65, align 8, !tbaa !13
  tail call void @source_alter(ptr noundef %66, ptr noundef %1, i32 noundef %2)
  tail call void @storage_mgr_save(ptr noundef %0)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph86, %.preheader, %._crit_edge, %.critedge, %7
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @part_has(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @source_alter(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cloud_unref(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @storage_set_cloud(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { inlinehint 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 #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint noreturn 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 = { noreturn }

!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, !11, i64 16}
!6 = !{!"Storage", !7, i64 0, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 32, !8, i64 40, !8, i64 48, !7, i64 56}
!7 = !{!"List", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!6, !8, i64 48}
!14 = !{!7, !8, i64 0}
!15 = !{!6, !8, i64 40}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !8, i64 496}
!19 = !{!"Part", !20, i64 0, !11, i64 16, !12, i64 24, !12, i64 32, !21, i64 40, !8, i64 48, !22, i64 56, !22, i64 168, !25, i64 280, !27, i64 336, !28, i64 472, !8, i64 496, !8, i64 504, !8, i64 512, !7, i64 520}
!20 = !{!"Id", !12, i64 0, !12, i64 8}
!21 = !{!"_Bool", !9, i64 0}
!22 = !{!"Memtable", !8, i64 0, !23, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !7, i64 56, !11, i64 72, !24, i64 80}
!23 = !{!"Rbtree", !8, i64 0}
!24 = !{!"Heap", !8, i64 0, !8, i64 8, !11, i64 16, !8, i64 24}
!25 = !{!"File", !11, i64 0, !12, i64 8, !26, i64 16, !7, i64 40}
!26 = !{!"Str", !8, i64 0, !8, i64 8, !21, i64 16}
!27 = !{!"Index", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !20, i64 16, !11, i64 32, !11, i64 36, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !11, i64 72, !12, i64 76, !12, i64 84, !12, i64 92, !11, i64 100, !12, i64 104, !9, i64 112, !9, i64 113, !9, i64 114}
!28 = !{!"Buf", !8, i64 0, !8, i64 8, !8, i64 16}
!29 = distinct !{!29, !17}
!30 = distinct !{!30, !17}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass