; LLVM IR from mlcommons/tiny :: benchmark/interface/Middlewares/ST/filex/common/src/fx_file_extended_best_effo_761d959b (allocate)

; 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.FX_FILE_STRUCT = type { i64, ptr, i64, i8, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, %struct.FX_DIR_ENTRY_STRUCT, [256 x i8], i64, ptr }
%struct.FX_DIR_ENTRY_STRUCT = type { ptr, [13 x i8], i32, i32, i8, i8, i8, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.FX_MEDIA_STRUCT = type { i64, ptr, ptr, i64, i32, i64, ptr, ptr, i64, i64, i32, i32, i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i64, i64, i32, i64, i64, ptr, i32, i32, ptr, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i64, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.TX_MUTEX_STRUCT, i32, %struct.FX_DIR_ENTRY_STRUCT, %struct.FX_DIR_ENTRY_STRUCT, [256 x i8], [256 x i8], %struct.FX_PATH_STRUCT, [16 x %struct.FX_FAT_CACHE_ENTRY_STRUCT], [128 x i8], i64, [1024 x i8], [256 x %struct.FX_CACHED_SECTOR_STRUCT], i64, i64, i64, i64, i8 }
%struct.TX_MUTEX_STRUCT = type { i64, ptr, i32, ptr, i32, i32, ptr, i32, ptr, ptr, i32, ptr, ptr }
%struct.FX_PATH_STRUCT = type { %struct.FX_DIR_ENTRY_STRUCT, [256 x i8], [256 x i8], i64 }
%struct.FX_FAT_CACHE_ENTRY_STRUCT = type { i64, i64, i64 }
%struct.FX_CACHED_SECTOR_STRUCT = type { ptr, i64, i8, i8, i8, i8, ptr }

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

23:                                               ; preds = %3
  store i32 7, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

24:                                               ; preds = %3
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %25, i32 0, i32 16
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  store ptr %27, ptr %17, align 8, !tbaa !5
  %28 = load ptr, ptr %17, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %28, i32 0, i32 72
  %30 = load i64, ptr %29, align 8, !tbaa !17
  %31 = add i64 %30, 1
  store i64 %31, ptr %29, align 8, !tbaa !17
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %32, i32 0, i32 2
  %34 = load i64, ptr %33, align 8, !tbaa !21
  %35 = icmp ne i64 %34, 1
  br i1 %35, label %36, label %37

36:                                               ; preds = %24
  store i32 6, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

37:                                               ; preds = %24
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 0, ptr %41, align 8, !tbaa !9
  store i32 0, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

42:                                               ; preds = %37
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %43, i32 0, i32 16
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  store ptr %45, ptr %17, align 8, !tbaa !5
  %46 = load ptr, ptr %17, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %46, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !22
  %49 = icmp ne i64 %48, 1296385097
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  store i32 17, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

51:                                               ; preds = %42
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %52, i32 0, i32 112
  %54 = call i32 @_tx_mutex_get(ptr noundef %53, i64 noundef 4294967295)
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %51
  store i32 17, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

57:                                               ; preds = %51
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %59, i32 0, i32 40
  %61 = load i32, ptr %60, align 8, !tbaa !23
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %67

63:                                               ; preds = %58
  %64 = load ptr, ptr %17, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %64, i32 0, i32 112
  %66 = call i32 @_tx_mutex_put(ptr noundef %65)
  store i32 35, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

67:                                               ; preds = %58
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %68, i32 0, i32 10
  %70 = load i32, ptr %69, align 8, !tbaa !24
  %71 = zext i32 %70 to i64
  %72 = load ptr, ptr %17, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %72, i32 0, i32 19
  %74 = load i32, ptr %73, align 8, !tbaa !25
  %75 = zext i32 %74 to i64
  %76 = mul i64 %71, %75
  store i64 %76, ptr %11, align 8, !tbaa !26
  %77 = load i64, ptr %11, align 8, !tbaa !26
  %78 = icmp eq i64 %77, 0
  br i1 %78, label %79, label %83

79:                                               ; preds = %67
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %80, i32 0, i32 112
  %82 = call i32 @_tx_mutex_put(ptr noundef %81)
  store i32 2, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

83:                                               ; preds = %67
  %84 = load i64, ptr %6, align 8, !tbaa !9
  %85 = load i64, ptr %11, align 8, !tbaa !26
  %86 = add i64 %84, %85
  %87 = sub i64 %86, 1
  %88 = load i64, ptr %11, align 8, !tbaa !26
  %89 = udiv i64 %87, %88
  store i64 %89, ptr %15, align 8, !tbaa !26
  %90 = load i64, ptr %15, align 8, !tbaa !26
  %91 = icmp eq i64 %90, 0
  br i1 %91, label %92, label %96

92:                                               ; preds = %83
  %93 = load ptr, ptr %17, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %93, i32 0, i32 112
  %95 = call i32 @_tx_mutex_put(ptr noundef %94)
  store i32 10, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

96:                                               ; preds = %83
  %97 = load ptr, ptr %17, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %97, i32 0, i32 29
  %99 = load i64, ptr %98, align 8, !tbaa !27
  %100 = icmp ne i64 %99, 0
  br i1 %100, label %106, label %101

101:                                              ; preds = %96
  %102 = load ptr, ptr %17, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %102, i32 0, i32 112
  %104 = call i32 @_tx_mutex_put(ptr noundef %103)
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 0, ptr %105, align 8, !tbaa !9
  store i32 10, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

106:                                              ; preds = %96
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %107, i32 0, i32 15
  %109 = load i64, ptr %108, align 8, !tbaa !28
  %110 = load i64, ptr %15, align 8, !tbaa !26
  %111 = load i64, ptr %11, align 8, !tbaa !26
  %112 = mul i64 %110, %111
  %113 = add i64 %109, %112
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %114, i32 0, i32 15
  %116 = load i64, ptr %115, align 8, !tbaa !28
  %117 = icmp ult i64 %113, %116
  br i1 %117, label %127, label %118

118:                                              ; preds = %106
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %119, i32 0, i32 15
  %121 = load i64, ptr %120, align 8, !tbaa !28
  %122 = load i64, ptr %15, align 8, !tbaa !26
  %123 = load i64, ptr %11, align 8, !tbaa !26
  %124 = mul i64 %122, %123
  %125 = add i64 %121, %124
  %126 = icmp ugt i64 %125, 4294967295
  br i1 %126, label %127, label %131

127:                                              ; preds = %118, %106
  %128 = load ptr, ptr %17, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %128, i32 0, i32 112
  %130 = call i32 @_tx_mutex_put(ptr noundef %129)
  store i32 10, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

131:                                              ; preds = %118
  store i32 0, ptr %10, align 4, !tbaa !29
  store i64 2, ptr %12, align 8, !tbaa !26
  store i64 0, ptr %16, align 8, !tbaa !26
  %132 = load i64, ptr %12, align 8, !tbaa !26
  store i64 %132, ptr %13, align 8, !tbaa !26
  br label %133

133:                                              ; preds = %193, %131
  %134 = load i64, ptr %12, align 8, !tbaa !26
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %135, i32 0, i32 14
  %137 = load i64, ptr %136, align 8, !tbaa !30
  %138 = add i64 %137, 2
  %139 = icmp ult i64 %134, %138
  br i1 %139, label %140, label %194

140:                                              ; preds = %133
  store i64 0, ptr %9, align 8, !tbaa !26
  br label %141

141:                                              ; preds = %174, %140
  %142 = load ptr, ptr %17, align 8, !tbaa !5
  %143 = load i64, ptr %12, align 8, !tbaa !26
  %144 = load i64, ptr %9, align 8, !tbaa !26
  %145 = add i64 %143, %144
  %146 = call i32 @_fx_utility_FAT_entry_read(ptr noundef %142, i64 noundef %145, ptr noundef %14)
  store i32 %146, ptr %8, align 4, !tbaa !29
  %147 = load i32, ptr %8, align 4, !tbaa !29
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %149, label %154

149:                                              ; preds = %141
  %150 = load ptr, ptr %17, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %150, i32 0, i32 112
  %152 = call i32 @_tx_mutex_put(ptr noundef %151)
  %153 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %153, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

154:                                              ; preds = %141
  %155 = load i64, ptr %14, align 8, !tbaa !26
  %156 = icmp ne i64 %155, 0
  br i1 %156, label %157, label %158

157:                                              ; preds = %154
  br label %176

158:                                              ; preds = %154
  %159 = load i64, ptr %9, align 8, !tbaa !26
  %160 = add i64 %159, 1
  store i64 %160, ptr %9, align 8, !tbaa !26
  br label %161

161:                                              ; preds = %158
  %162 = load i64, ptr %9, align 8, !tbaa !26
  %163 = load i64, ptr %15, align 8, !tbaa !26
  %164 = icmp ult i64 %162, %163
  br i1 %164, label %165, label %174

165:                                              ; preds = %161
  %166 = load i64, ptr %12, align 8, !tbaa !26
  %167 = load i64, ptr %9, align 8, !tbaa !26
  %168 = add i64 %166, %167
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %169, i32 0, i32 14
  %171 = load i64, ptr %170, align 8, !tbaa !30
  %172 = add i64 %171, 2
  %173 = icmp ult i64 %168, %172
  br label %174

174:                                              ; preds = %165, %161
  %175 = phi i1 [ false, %161 ], [ %173, %165 ]
  br i1 %175, label %141, label %176, !llvm.loop !31

176:                                              ; preds = %174, %157
  %177 = load i64, ptr %9, align 8, !tbaa !26
  %178 = load i64, ptr %16, align 8, !tbaa !26
  %179 = icmp ugt i64 %177, %178
  br i1 %179, label %180, label %183

180:                                              ; preds = %176
  %181 = load i64, ptr %9, align 8, !tbaa !26
  store i64 %181, ptr %16, align 8, !tbaa !26
  %182 = load i64, ptr %12, align 8, !tbaa !26
  store i64 %182, ptr %13, align 8, !tbaa !26
  br label %183

183:                                              ; preds = %180, %176
  %184 = load i64, ptr %9, align 8, !tbaa !26
  %185 = load i64, ptr %15, align 8, !tbaa !26
  %186 = icmp uge i64 %184, %185
  br i1 %186, label %187, label %188

187:                                              ; preds = %183
  store i32 1, ptr %10, align 4, !tbaa !29
  br label %194

188:                                              ; preds = %183
  %189 = load i64, ptr %12, align 8, !tbaa !26
  %190 = load i64, ptr %9, align 8, !tbaa !26
  %191 = add i64 %189, %190
  %192 = add i64 %191, 1
  store i64 %192, ptr %12, align 8, !tbaa !26
  br label %193

193:                                              ; preds = %188
  br label %133, !llvm.loop !33

194:                                              ; preds = %187, %133
  %195 = load i64, ptr %16, align 8, !tbaa !26
  %196 = icmp ne i64 %195, 0
  br i1 %196, label %197, label %200

197:                                              ; preds = %194
  %198 = load i64, ptr %13, align 8, !tbaa !26
  store i64 %198, ptr %12, align 8, !tbaa !26
  %199 = load i64, ptr %16, align 8, !tbaa !26
  store i64 %199, ptr %15, align 8, !tbaa !26
  store i32 1, ptr %10, align 4, !tbaa !29
  br label %200

200:                                              ; preds = %197, %194
  %201 = load i32, ptr %10, align 4, !tbaa !29
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %396

203:                                              ; preds = %200
  store i64 0, ptr %9, align 8, !tbaa !26
  br label %204

204:                                              ; preds = %227, %203
  %205 = load i64, ptr %9, align 8, !tbaa !26
  %206 = load i64, ptr %15, align 8, !tbaa !26
  %207 = sub i64 %206, 1
  %208 = icmp ult i64 %205, %207
  br i1 %208, label %209, label %230

209:                                              ; preds = %204
  %210 = load ptr, ptr %17, align 8, !tbaa !5
  %211 = load i64, ptr %12, align 8, !tbaa !26
  %212 = load i64, ptr %9, align 8, !tbaa !26
  %213 = add i64 %211, %212
  %214 = load i64, ptr %12, align 8, !tbaa !26
  %215 = load i64, ptr %9, align 8, !tbaa !26
  %216 = add i64 %214, %215
  %217 = add i64 %216, 1
  %218 = call i32 @_fx_utility_FAT_entry_write(ptr noundef %210, i64 noundef %213, i64 noundef %217)
  store i32 %218, ptr %8, align 4, !tbaa !29
  %219 = load i32, ptr %8, align 4, !tbaa !29
  %220 = icmp ne i32 %219, 0
  br i1 %220, label %221, label %226

221:                                              ; preds = %209
  %222 = load ptr, ptr %17, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %222, i32 0, i32 112
  %224 = call i32 @_tx_mutex_put(ptr noundef %223)
  %225 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %225, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

226:                                              ; preds = %209
  br label %227

227:                                              ; preds = %226
  %228 = load i64, ptr %9, align 8, !tbaa !26
  %229 = add i64 %228, 1
  store i64 %229, ptr %9, align 8, !tbaa !26
  br label %204, !llvm.loop !34

230:                                              ; preds = %204
  %231 = load ptr, ptr %17, align 8, !tbaa !5
  %232 = load i64, ptr %12, align 8, !tbaa !26
  %233 = load i64, ptr %15, align 8, !tbaa !26
  %234 = add i64 %232, %233
  %235 = sub i64 %234, 1
  %236 = load ptr, ptr %17, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %236, i32 0, i32 127
  %238 = load i64, ptr %237, align 8, !tbaa !35
  %239 = call i32 @_fx_utility_FAT_entry_write(ptr noundef %231, i64 noundef %235, i64 noundef %238)
  store i32 %239, ptr %8, align 4, !tbaa !29
  %240 = load i32, ptr %8, align 4, !tbaa !29
  %241 = icmp ne i32 %240, 0
  br i1 %241, label %242, label %247

242:                                              ; preds = %230
  %243 = load ptr, ptr %17, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %243, i32 0, i32 112
  %245 = call i32 @_tx_mutex_put(ptr noundef %244)
  %246 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %246, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

247:                                              ; preds = %230
  %248 = load ptr, ptr %5, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %248, i32 0, i32 4
  %250 = load i64, ptr %249, align 8, !tbaa !36
  %251 = icmp ne i64 %250, 0
  br i1 %251, label %252, label %312

252:                                              ; preds = %247
  %253 = load ptr, ptr %17, align 8, !tbaa !5
  %254 = load ptr, ptr %5, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %254, i32 0, i32 7
  %256 = load i64, ptr %255, align 8, !tbaa !37
  %257 = load i64, ptr %12, align 8, !tbaa !26
  %258 = call i32 @_fx_utility_FAT_entry_write(ptr noundef %253, i64 noundef %256, i64 noundef %257)
  store i32 %258, ptr %8, align 4, !tbaa !29
  %259 = load i32, ptr %8, align 4, !tbaa !29
  %260 = icmp ne i32 %259, 0
  br i1 %260, label %261, label %266

261:                                              ; preds = %252
  %262 = load ptr, ptr %17, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %262, i32 0, i32 112
  %264 = call i32 @_tx_mutex_put(ptr noundef %263)
  %265 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %265, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

266:                                              ; preds = %252
  %267 = load ptr, ptr %5, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %267, i32 0, i32 12
  %269 = load i64, ptr %268, align 8, !tbaa !38
  %270 = load ptr, ptr %17, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %270, i32 0, i32 19
  %272 = load i32, ptr %271, align 8, !tbaa !25
  %273 = sub i32 %272, 1
  %274 = zext i32 %273 to i64
  %275 = icmp uge i64 %269, %274
  br i1 %275, label %276, label %311

276:                                              ; preds = %266
  %277 = load ptr, ptr %5, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %277, i32 0, i32 10
  %279 = load i64, ptr %278, align 8, !tbaa !39
  %280 = load ptr, ptr %17, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %280, i32 0, i32 10
  %282 = load i32, ptr %281, align 8, !tbaa !24
  %283 = zext i32 %282 to i64
  %284 = icmp uge i64 %279, %283
  br i1 %284, label %285, label %311

285:                                              ; preds = %276
  %286 = load i64, ptr %12, align 8, !tbaa !26
  %287 = load ptr, ptr %5, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %287, i32 0, i32 8
  store i64 %286, ptr %288, align 8, !tbaa !40
  %289 = load ptr, ptr %5, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %289, i32 0, i32 11
  %291 = load i64, ptr %290, align 8, !tbaa !41
  %292 = add i64 %291, 1
  store i64 %292, ptr %290, align 8, !tbaa !41
  %293 = load ptr, ptr %5, align 8, !tbaa !5
  %294 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %293, i32 0, i32 12
  store i64 0, ptr %294, align 8, !tbaa !38
  %295 = load ptr, ptr %17, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %295, i32 0, i32 18
  %297 = load i32, ptr %296, align 4, !tbaa !42
  %298 = zext i32 %297 to i64
  %299 = load i64, ptr %12, align 8, !tbaa !26
  %300 = sub i64 %299, 2
  %301 = load ptr, ptr %17, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %301, i32 0, i32 19
  %303 = load i32, ptr %302, align 8, !tbaa !25
  %304 = zext i32 %303 to i64
  %305 = mul i64 %300, %304
  %306 = add i64 %298, %305
  %307 = load ptr, ptr %5, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %307, i32 0, i32 9
  store i64 %306, ptr %308, align 8, !tbaa !43
  %309 = load ptr, ptr %5, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %309, i32 0, i32 10
  store i64 0, ptr %310, align 8, !tbaa !39
  br label %311

311:                                              ; preds = %285, %276, %266
  br label %350

312:                                              ; preds = %247
  %313 = load i64, ptr %12, align 8, !tbaa !26
  %314 = load ptr, ptr %5, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %314, i32 0, i32 5
  store i64 %313, ptr %315, align 8, !tbaa !44
  %316 = load ptr, ptr %5, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %316, i32 0, i32 5
  %318 = load i64, ptr %317, align 8, !tbaa !44
  %319 = load ptr, ptr %5, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %319, i32 0, i32 8
  store i64 %318, ptr %320, align 8, !tbaa !40
  %321 = load ptr, ptr %5, align 8, !tbaa !5
  %322 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %321, i32 0, i32 11
  store i64 0, ptr %322, align 8, !tbaa !41
  %323 = load ptr, ptr %17, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %323, i32 0, i32 18
  %325 = load i32, ptr %324, align 4, !tbaa !42
  %326 = zext i32 %325 to i64
  %327 = load ptr, ptr %5, align 8, !tbaa !5
  %328 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %327, i32 0, i32 5
  %329 = load i64, ptr %328, align 8, !tbaa !44
  %330 = sub i64 %329, 2
  %331 = load ptr, ptr %17, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %331, i32 0, i32 19
  %333 = load i32, ptr %332, align 8, !tbaa !25
  %334 = zext i32 %333 to i64
  %335 = mul i64 %330, %334
  %336 = add i64 %326, %335
  %337 = load ptr, ptr %5, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %337, i32 0, i32 9
  store i64 %336, ptr %338, align 8, !tbaa !43
  %339 = load ptr, ptr %5, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %339, i32 0, i32 10
  store i64 0, ptr %340, align 8, !tbaa !39
  %341 = load ptr, ptr %5, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %341, i32 0, i32 13
  store i64 0, ptr %342, align 8, !tbaa !45
  %343 = load i64, ptr %15, align 8, !tbaa !26
  %344 = load ptr, ptr %5, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %344, i32 0, i32 6
  store i64 %343, ptr %345, align 8, !tbaa !46
  %346 = load i64, ptr %12, align 8, !tbaa !26
  %347 = load ptr, ptr %5, align 8, !tbaa !5
  %348 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %347, i32 0, i32 19
  %349 = getelementptr inbounds %struct.FX_DIR_ENTRY_STRUCT, ptr %348, i32 0, i32 12
  store i64 %346, ptr %349, align 8, !tbaa !47
  br label %350

350:                                              ; preds = %312, %311
  %351 = load i64, ptr %12, align 8, !tbaa !26
  %352 = load i64, ptr %15, align 8, !tbaa !26
  %353 = add i64 %351, %352
  %354 = sub i64 %353, 1
  %355 = load ptr, ptr %5, align 8, !tbaa !5
  %356 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %355, i32 0, i32 7
  store i64 %354, ptr %356, align 8, !tbaa !37
  %357 = load ptr, ptr %5, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %357, i32 0, i32 15
  %359 = load i64, ptr %358, align 8, !tbaa !28
  %360 = load i64, ptr %11, align 8, !tbaa !26
  %361 = load i64, ptr %15, align 8, !tbaa !26
  %362 = mul i64 %360, %361
  %363 = add i64 %359, %362
  %364 = load ptr, ptr %5, align 8, !tbaa !5
  %365 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %364, i32 0, i32 15
  store i64 %363, ptr %365, align 8, !tbaa !28
  %366 = load ptr, ptr %5, align 8, !tbaa !5
  %367 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %366, i32 0, i32 4
  %368 = load i64, ptr %367, align 8, !tbaa !36
  %369 = load i64, ptr %15, align 8, !tbaa !26
  %370 = add i64 %368, %369
  %371 = load ptr, ptr %5, align 8, !tbaa !5
  %372 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %371, i32 0, i32 4
  store i64 %370, ptr %372, align 8, !tbaa !36
  %373 = load ptr, ptr %17, align 8, !tbaa !5
  %374 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %373, i32 0, i32 29
  %375 = load i64, ptr %374, align 8, !tbaa !27
  %376 = load i64, ptr %15, align 8, !tbaa !26
  %377 = sub i64 %375, %376
  %378 = load ptr, ptr %17, align 8, !tbaa !5
  %379 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %378, i32 0, i32 29
  store i64 %377, ptr %379, align 8, !tbaa !27
  %380 = load i64, ptr %15, align 8, !tbaa !26
  %381 = load i64, ptr %11, align 8, !tbaa !26
  %382 = mul i64 %380, %381
  %383 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 %382, ptr %383, align 8, !tbaa !9
  %384 = load ptr, ptr %17, align 8, !tbaa !5
  %385 = load ptr, ptr %5, align 8, !tbaa !5
  %386 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %385, i32 0, i32 19
  %387 = call i32 @_fx_directory_entry_write(ptr noundef %384, ptr noundef %386)
  store i32 %387, ptr %8, align 4, !tbaa !29
  %388 = load i32, ptr %8, align 4, !tbaa !29
  %389 = icmp ne i32 %388, 0
  br i1 %389, label %390, label %395

390:                                              ; preds = %350
  %391 = load ptr, ptr %17, align 8, !tbaa !5
  %392 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %391, i32 0, i32 112
  %393 = call i32 @_tx_mutex_put(ptr noundef %392)
  %394 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %394, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

395:                                              ; preds = %350
  br label %401

396:                                              ; preds = %200
  %397 = load ptr, ptr %17, align 8, !tbaa !5
  %398 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %397, i32 0, i32 112
  %399 = call i32 @_tx_mutex_put(ptr noundef %398)
  %400 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 0, ptr %400, align 8, !tbaa !9
  store i32 10, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

401:                                              ; preds = %395
  %402 = load ptr, ptr %17, align 8, !tbaa !5
  %403 = load ptr, ptr %17, align 8, !tbaa !5
  %404 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %403, i32 0, i32 20
  %405 = load i32, ptr %404, align 4, !tbaa !48
  %406 = zext i32 %405 to i64
  %407 = call i32 @_fx_utility_logical_sector_flush(ptr noundef %402, i64 noundef 1, i64 noundef %406, i32 noundef 0)
  store i32 %407, ptr %8, align 4, !tbaa !29
  %408 = load ptr, ptr %17, align 8, !tbaa !5
  %409 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %408, i32 0, i32 112
  %410 = call i32 @_tx_mutex_put(ptr noundef %409)
  %411 = load i32, ptr %8, align 4, !tbaa !29
  store i32 %411, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %412

412:                                              ; preds = %401, %396, %390, %261, %242, %221, %149, %127, %101, %92, %79, %63, %56, %50, %40, %36, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %413 = load i32, ptr %4, align 4
  ret i32 %413
}

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

declare i32 @_tx_mutex_get(ptr noundef, i64 noundef) #2

declare i32 @_tx_mutex_put(ptr noundef) #2

declare i32 @_fx_utility_FAT_entry_read(ptr noundef, i64 noundef, ptr noundef) #2

declare i32 @_fx_utility_FAT_entry_write(ptr noundef, i64 noundef, i64 noundef) #2

declare i32 @_fx_directory_entry_write(ptr noundef, ptr noundef) #2

declare i32 @_fx_utility_logical_sector_flush(ptr noundef, i64 noundef, i64 noundef, i32 noundef) #2

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

attributes #0 = { 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 = { "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 }

!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 = !{!"long long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"FX_FILE_STRUCT", !13, i64 0, !6, i64 8, !13, i64 16, !7, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !10, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !14, i64 152, !7, i64 288, !13, i64 544, !6, i64 552}
!13 = !{!"long", !7, i64 0}
!14 = !{!"FX_DIR_ENTRY_STRUCT", !6, i64 0, !7, i64 8, !15, i64 24, !15, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !13, i64 56, !10, i64 64, !10, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !10, i64 112, !13, i64 120, !10, i64 128}
!15 = !{!"int", !7, i64 0}
!16 = !{!12, !6, i64 128}
!17 = !{!18, !13, i64 504}
!18 = !{!"FX_MEDIA_STRUCT", !13, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !15, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !13, i64 72, !15, i64 80, !15, i64 84, !15, i64 88, !10, i64 96, !13, i64 104, !15, i64 112, !15, i64 116, !15, i64 120, !15, i64 124, !15, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !13, i64 152, !15, i64 160, !13, i64 168, !13, i64 176, !15, i64 184, !13, i64 192, !13, i64 200, !6, i64 208, !15, i64 216, !15, i64 220, !6, i64 224, !13, i64 232, !13, i64 240, !13, i64 248, !15, i64 256, !15, i64 260, !15, i64 264, !15, i64 268, !15, i64 272, !15, i64 276, !15, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !13, i64 320, !6, i64 328, !6, i64 336, !13, i64 344, !13, i64 352, !13, i64 360, !13, i64 368, !13, i64 376, !13, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !13, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456, !13, i64 464, !13, i64 472, !13, i64 480, !13, i64 488, !13, i64 496, !13, i64 504, !13, i64 512, !13, i64 520, !13, i64 528, !13, i64 536, !13, i64 544, !13, i64 552, !13, i64 560, !13, i64 568, !13, i64 576, !13, i64 584, !13, i64 592, !13, i64 600, !13, i64 608, !13, i64 616, !13, i64 624, !13, i64 632, !13, i64 640, !13, i64 648, !13, i64 656, !13, i64 664, !13, i64 672, !13, i64 680, !13, i64 688, !13, i64 696, !13, i64 704, !13, i64 712, !13, i64 720, !13, i64 728, !13, i64 736, !13, i64 744, !13, i64 752, !13, i64 760, !13, i64 768, !13, i64 776, !13, i64 784, !13, i64 792, !13, i64 800, !13, i64 808, !13, i64 816, !19, i64 824, !15, i64 920, !14, i64 928, !14, i64 1064, !7, i64 1200, !7, i64 1456, !20, i64 1712, !7, i64 2368, !7, i64 2752, !13, i64 2880, !7, i64 2888, !7, i64 3912, !13, i64 12104, !13, i64 12112, !13, i64 12120, !13, i64 12128, !7, i64 12136}
!19 = !{!"TX_MUTEX_STRUCT", !13, i64 0, !6, i64 8, !15, i64 16, !6, i64 24, !15, i64 32, !15, i64 36, !6, i64 40, !15, i64 48, !6, i64 56, !6, i64 64, !15, i64 72, !6, i64 80, !6, i64 88}
!20 = !{!"FX_PATH_STRUCT", !14, i64 0, !7, i64 136, !7, i64 392, !13, i64 648}
!21 = !{!12, !13, i64 16}
!22 = !{!18, !13, i64 0}
!23 = !{!18, !15, i64 264}
!24 = !{!18, !15, i64 80}
!25 = !{!18, !15, i64 128}
!26 = !{!13, !13, i64 0}
!27 = !{!18, !13, i64 192}
!28 = !{!12, !10, i64 120}
!29 = !{!15, !15, i64 0}
!30 = !{!18, !13, i64 104}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}
!34 = distinct !{!34, !32}
!35 = !{!18, !13, i64 12128}
!36 = !{!12, !13, i64 32}
!37 = !{!12, !13, i64 56}
!38 = !{!12, !13, i64 96}
!39 = !{!12, !13, i64 80}
!40 = !{!12, !13, i64 64}
!41 = !{!12, !13, i64 88}
!42 = !{!18, !15, i64 124}
!43 = !{!12, !10, i64 72}
!44 = !{!12, !13, i64 40}
!45 = !{!12, !10, i64 104}
!46 = !{!12, !13, i64 48}
!47 = !{!12, !13, i64 208}
!48 = !{!18, !15, i64 132}


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

; Function Attrs: nounwind uwtable
define dso_local i32 @_fx_file_extended_best_effort_allocate(ptr noundef %0, i64 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = load i64, ptr %0, align 8, !tbaa !5
  %.not = icmp eq i64 %5, 1179208773
  br i1 %.not, label %6, label %169

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %8, i64 504
  %10 = load i64, ptr %9, align 8, !tbaa !15
  %11 = add i64 %10, 1
  store i64 %11, ptr %9, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load i64, ptr %12, align 8, !tbaa !19
  %.not161 = icmp eq i64 %13, 1
  br i1 %.not161, label %14, label %169

14:                                               ; preds = %6
  %15 = icmp eq i64 %1, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %14
  store i64 0, ptr %2, align 8, !tbaa !20
  br label %169

17:                                               ; preds = %14
  %18 = load i64, ptr %8, align 8, !tbaa !21
  %.not162 = icmp eq i64 %18, 1296385097
  br i1 %.not162, label %19, label %169

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %8, i64 824
  %21 = tail call i32 @_tx_mutex_get(ptr noundef nonnull %20, i64 noundef 4294967295) #4
  %.not163 = icmp eq i32 %21, 0
  br i1 %.not163, label %22, label %169

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %8, i64 264
  %24 = load i32, ptr %23, align 8, !tbaa !22
  %.not164 = icmp eq i32 %24, 0
  br i1 %.not164, label %27, label %25

25:                                               ; preds = %22
  %26 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

27:                                               ; preds = %22
  %28 = getelementptr inbounds i8, ptr %8, i64 80
  %29 = load i32, ptr %28, align 8, !tbaa !23
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %8, i64 128
  %32 = load i32, ptr %31, align 8, !tbaa !24
  %33 = zext i32 %32 to i64
  %34 = mul nuw i64 %33, %30
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %27
  %37 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

38:                                               ; preds = %27
  %39 = add i64 %1, -1
  %40 = add i64 %39, %34
  %41 = udiv i64 %40, %34
  %42 = icmp ugt i64 %34, %40
  br i1 %42, label %43, label %45

43:                                               ; preds = %38
  %44 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

45:                                               ; preds = %38
  %46 = getelementptr inbounds i8, ptr %8, i64 192
  %47 = load i64, ptr %46, align 8, !tbaa !25
  %.not165 = icmp eq i64 %47, 0
  br i1 %.not165, label %48, label %50

48:                                               ; preds = %45
  %49 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  store i64 0, ptr %2, align 8, !tbaa !20
  br label %169

50:                                               ; preds = %45
  %51 = getelementptr inbounds i8, ptr %0, i64 120
  %52 = load i64, ptr %51, align 8, !tbaa !26
  %53 = mul i64 %41, %34
  %54 = add i64 %52, %53
  %55 = icmp ult i64 %54, %52
  %56 = icmp ugt i64 %54, 4294967295
  %or.cond = or i1 %55, %56
  br i1 %or.cond, label %61, label %.preheader181

.preheader181:                                    ; preds = %50
  %57 = getelementptr inbounds i8, ptr %8, i64 104
  %58 = load i64, ptr %57, align 8, !tbaa !27
  %59 = add i64 %58, 2
  %60 = icmp ult i64 %59, 3
  br i1 %60, label %.critedge._crit_edge, label %.preheader180

61:                                               ; preds = %50
  %62 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

.preheader180:                                    ; preds = %.preheader181, %79
  %.0189 = phi i64 [ %spec.select178, %79 ], [ 0, %.preheader181 ]
  %.0139188 = phi i64 [ %spec.select, %79 ], [ 2, %.preheader181 ]
  %.0142187 = phi i64 [ %81, %79 ], [ 2, %.preheader181 ]
  br label %63

63:                                               ; preds = %.preheader180, %73
  %.0147 = phi i64 [ %71, %73 ], [ 0, %.preheader180 ]
  %64 = add i64 %.0147, %.0142187
  %65 = call i32 @_fx_utility_FAT_entry_read(ptr noundef nonnull %8, i64 noundef %64, ptr noundef nonnull %4) #4
  %.not166 = icmp eq i32 %65, 0
  br i1 %.not166, label %68, label %66

66:                                               ; preds = %63
  %67 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

68:                                               ; preds = %63
  %69 = load i64, ptr %4, align 8, !tbaa !28
  %.not167 = icmp eq i64 %69, 0
  br i1 %.not167, label %70, label %.critedge

70:                                               ; preds = %68
  %71 = add nuw i64 %.0147, 1
  %72 = icmp ult i64 %71, %41
  br i1 %72, label %73, label %.critedge

73:                                               ; preds = %70
  %74 = add i64 %71, %.0142187
  %75 = load i64, ptr %57, align 8, !tbaa !27
  %76 = add i64 %75, 2
  %77 = icmp ult i64 %74, %76
  br i1 %77, label %63, label %.critedge, !llvm.loop !29

.critedge:                                        ; preds = %70, %68, %73
  %.1148 = phi i64 [ %.0147, %68 ], [ %71, %73 ], [ %71, %70 ]
  %78 = icmp ugt i64 %.1148, %.0189
  %spec.select = select i1 %78, i64 %.0142187, i64 %.0139188
  %spec.select178 = call i64 @llvm.umax.i64(i64 %.1148, i64 %.0189)
  %.not168 = icmp ult i64 %.1148, %41
  br i1 %.not168, label %79, label %.critedge._crit_edge.thread

.critedge._crit_edge.thread:                      ; preds = %.critedge
  %.not169208 = icmp eq i64 %spec.select178, 0
  %.1143209 = select i1 %.not169208, i64 %.0142187, i64 %spec.select
  %.0138210 = select i1 %.not169208, i64 %41, i64 %spec.select178
  br label %.preheader

79:                                               ; preds = %.critedge
  %80 = add i64 %.0142187, 1
  %81 = add i64 %80, %.1148
  %82 = load i64, ptr %57, align 8, !tbaa !27
  %83 = add i64 %82, 2
  %.not203 = icmp ult i64 %81, %83
  br i1 %.not203, label %.preheader180, label %.critedge._crit_edge, !llvm.loop !31

.critedge._crit_edge:                             ; preds = %79, %.preheader181
  %.0142.lcssa = phi i64 [ 2, %.preheader181 ], [ %81, %79 ]
  %.2141 = phi i64 [ 2, %.preheader181 ], [ %spec.select, %79 ]
  %.2 = phi i64 [ 0, %.preheader181 ], [ %spec.select178, %79 ]
  %.not169 = icmp eq i64 %.2, 0
  %.1143 = select i1 %.not169, i64 %.0142.lcssa, i64 %.2141
  %.0138 = select i1 %.not169, i64 %41, i64 %.2
  br i1 %.not169, label %161, label %.preheader

.preheader:                                       ; preds = %.critedge._crit_edge.thread, %.critedge._crit_edge
  %.0138213 = phi i64 [ %.0138210, %.critedge._crit_edge.thread ], [ %.0138, %.critedge._crit_edge ]
  %.1143212 = phi i64 [ %.1143209, %.critedge._crit_edge.thread ], [ %.1143, %.critedge._crit_edge ]
  %84 = add i64 %.0138213, -1
  %.not199 = icmp eq i64 %84, 0
  br i1 %.not199, label %._crit_edge198, label %.lr.ph

85:                                               ; preds = %.lr.ph
  %86 = add nuw i64 %.2149197, 1
  %exitcond.not = icmp eq i64 %86, %84
  br i1 %exitcond.not, label %._crit_edge198, label %.lr.ph, !llvm.loop !32

.lr.ph:                                           ; preds = %.preheader, %85
  %.2149197 = phi i64 [ %86, %85 ], [ 0, %.preheader ]
  %87 = add i64 %.2149197, %.1143212
  %88 = add i64 %87, 1
  %89 = call i32 @_fx_utility_FAT_entry_write(ptr noundef nonnull %8, i64 noundef %87, i64 noundef %88) #4
  %.not177 = icmp eq i32 %89, 0
  br i1 %.not177, label %85, label %90

90:                                               ; preds = %.lr.ph
  %91 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

._crit_edge198:                                   ; preds = %85, %.preheader
  %92 = add i64 %84, %.1143212
  %93 = getelementptr inbounds i8, ptr %8, i64 12128
  %94 = load i64, ptr %93, align 8, !tbaa !33
  %95 = call i32 @_fx_utility_FAT_entry_write(ptr noundef nonnull %8, i64 noundef %92, i64 noundef %94) #4
  %.not171 = icmp eq i32 %95, 0
  br i1 %.not171, label %98, label %96

96:                                               ; preds = %._crit_edge198
  %97 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

98:                                               ; preds = %._crit_edge198
  %99 = getelementptr inbounds i8, ptr %0, i64 32
  %100 = load i64, ptr %99, align 8, !tbaa !34
  %.not172 = icmp eq i64 %100, 0
  br i1 %.not172, label %131, label %101

101:                                              ; preds = %98
  %102 = getelementptr inbounds i8, ptr %0, i64 56
  %103 = load i64, ptr %102, align 8, !tbaa !35
  %104 = call i32 @_fx_utility_FAT_entry_write(ptr noundef nonnull %8, i64 noundef %103, i64 noundef %.1143212) #4
  %.not173 = icmp eq i32 %104, 0
  br i1 %.not173, label %107, label %105

105:                                              ; preds = %101
  %106 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

107:                                              ; preds = %101
  %108 = getelementptr inbounds i8, ptr %0, i64 96
  %109 = load i64, ptr %108, align 8, !tbaa !36
  %110 = load i32, ptr %31, align 8, !tbaa !24
  %111 = add i32 %110, -1
  %112 = zext i32 %111 to i64
  %.not174 = icmp ult i64 %109, %112
  br i1 %.not174, label %148, label %113

113:                                              ; preds = %107
  %114 = getelementptr inbounds i8, ptr %0, i64 80
  %115 = load i64, ptr %114, align 8, !tbaa !37
  %116 = load i32, ptr %28, align 8, !tbaa !23
  %117 = zext i32 %116 to i64
  %.not175 = icmp ult i64 %115, %117
  br i1 %.not175, label %148, label %118

118:                                              ; preds = %113
  %119 = getelementptr inbounds i8, ptr %0, i64 64
  store i64 %.1143212, ptr %119, align 8, !tbaa !38
  %120 = getelementptr inbounds i8, ptr %0, i64 88
  %121 = load i64, ptr %120, align 8, !tbaa !39
  %122 = add i64 %121, 1
  store i64 %122, ptr %120, align 8, !tbaa !39
  store i64 0, ptr %108, align 8, !tbaa !36
  %123 = getelementptr inbounds i8, ptr %8, i64 124
  %124 = load i32, ptr %123, align 4, !tbaa !40
  %125 = zext i32 %124 to i64
  %126 = add i64 %.1143212, -2
  %127 = zext i32 %110 to i64
  %128 = mul i64 %126, %127
  %129 = add i64 %128, %125
  %130 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %129, ptr %130, align 8, !tbaa !41
  store i64 0, ptr %114, align 8, !tbaa !37
  br label %148

131:                                              ; preds = %98
  %132 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %.1143212, ptr %132, align 8, !tbaa !42
  %133 = getelementptr inbounds i8, ptr %0, i64 64
  store i64 %.1143212, ptr %133, align 8, !tbaa !38
  %134 = getelementptr inbounds i8, ptr %0, i64 88
  store i64 0, ptr %134, align 8, !tbaa !39
  %135 = getelementptr inbounds i8, ptr %8, i64 124
  %136 = load i32, ptr %135, align 4, !tbaa !40
  %137 = zext i32 %136 to i64
  %138 = add i64 %.1143212, -2
  %139 = load i32, ptr %31, align 8, !tbaa !24
  %140 = zext i32 %139 to i64
  %141 = mul i64 %138, %140
  %142 = add i64 %141, %137
  %143 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %142, ptr %143, align 8, !tbaa !41
  %144 = getelementptr inbounds i8, ptr %0, i64 80
  store i64 0, ptr %144, align 8, !tbaa !37
  %145 = getelementptr inbounds i8, ptr %0, i64 104
  store i64 0, ptr %145, align 8, !tbaa !43
  %146 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 %.0138213, ptr %146, align 8, !tbaa !44
  %147 = getelementptr inbounds i8, ptr %0, i64 208
  store i64 %.1143212, ptr %147, align 8, !tbaa !45
  br label %148

148:                                              ; preds = %107, %113, %118, %131
  %149 = getelementptr inbounds i8, ptr %0, i64 56
  store i64 %92, ptr %149, align 8, !tbaa !35
  %150 = load i64, ptr %51, align 8, !tbaa !26
  %151 = mul i64 %.0138213, %34
  %152 = add i64 %150, %151
  store i64 %152, ptr %51, align 8, !tbaa !26
  %153 = load i64, ptr %99, align 8, !tbaa !34
  %154 = add i64 %153, %.0138213
  store i64 %154, ptr %99, align 8, !tbaa !34
  %155 = load i64, ptr %46, align 8, !tbaa !25
  %156 = sub i64 %155, %.0138213
  store i64 %156, ptr %46, align 8, !tbaa !25
  store i64 %151, ptr %2, align 8, !tbaa !20
  %157 = getelementptr inbounds i8, ptr %0, i64 152
  %158 = call i32 @_fx_directory_entry_write(ptr noundef nonnull %8, ptr noundef nonnull %157) #4
  %.not176 = icmp eq i32 %158, 0
  br i1 %.not176, label %163, label %159

159:                                              ; preds = %148
  %160 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

161:                                              ; preds = %.critedge._crit_edge
  %162 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  store i64 0, ptr %2, align 8, !tbaa !20
  br label %169

163:                                              ; preds = %148
  %164 = getelementptr inbounds i8, ptr %8, i64 132
  %165 = load i32, ptr %164, align 4, !tbaa !46
  %166 = zext i32 %165 to i64
  %167 = call i32 @_fx_utility_logical_sector_flush(ptr noundef nonnull %8, i64 noundef 1, i64 noundef %166, i32 noundef 0) #4
  %168 = call i32 @_tx_mutex_put(ptr noundef nonnull %20) #4
  br label %169

169:                                              ; preds = %19, %17, %6, %3, %163, %161, %159, %105, %96, %90, %66, %61, %48, %43, %36, %25, %16
  %.0144 = phi i32 [ 0, %16 ], [ 35, %25 ], [ 2, %36 ], [ 10, %43 ], [ 10, %61 ], [ %65, %66 ], [ %89, %90 ], [ %95, %96 ], [ %104, %105 ], [ %158, %159 ], [ %167, %163 ], [ 10, %161 ], [ 10, %48 ], [ 7, %3 ], [ 6, %6 ], [ 17, %17 ], [ 17, %19 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 %.0144
}

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

declare i32 @_tx_mutex_get(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @_tx_mutex_put(ptr noundef) local_unnamed_addr #2

declare i32 @_fx_utility_FAT_entry_read(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @_fx_utility_FAT_entry_write(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

declare i32 @_fx_directory_entry_write(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @_fx_utility_logical_sector_flush(ptr noundef, i64 noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #3

attributes #0 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"FX_FILE_STRUCT", !7, i64 0, !10, i64 8, !7, i64 16, !8, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !11, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !12, i64 152, !8, i64 288, !7, i64 544, !10, i64 552}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long long", !8, i64 0}
!12 = !{!"FX_DIR_ENTRY_STRUCT", !10, i64 0, !8, i64 8, !13, i64 24, !13, i64 28, !8, i64 32, !8, i64 33, !8, i64 34, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !7, i64 56, !11, i64 64, !11, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !11, i64 112, !7, i64 120, !11, i64 128}
!13 = !{!"int", !8, i64 0}
!14 = !{!6, !10, i64 128}
!15 = !{!16, !7, i64 504}
!16 = !{!"FX_MEDIA_STRUCT", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !13, i64 32, !7, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 72, !13, i64 80, !13, i64 84, !13, i64 88, !11, i64 96, !7, i64 104, !13, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !7, i64 152, !13, i64 160, !7, i64 168, !7, i64 176, !13, i64 184, !7, i64 192, !7, i64 200, !10, i64 208, !13, i64 216, !13, i64 220, !10, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !13, i64 256, !13, i64 260, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !13, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !7, i64 320, !10, i64 328, !10, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !7, i64 448, !7, i64 456, !7, i64 464, !7, i64 472, !7, i64 480, !7, i64 488, !7, i64 496, !7, i64 504, !7, i64 512, !7, i64 520, !7, i64 528, !7, i64 536, !7, i64 544, !7, i64 552, !7, i64 560, !7, i64 568, !7, i64 576, !7, i64 584, !7, i64 592, !7, i64 600, !7, i64 608, !7, i64 616, !7, i64 624, !7, i64 632, !7, i64 640, !7, i64 648, !7, i64 656, !7, i64 664, !7, i64 672, !7, i64 680, !7, i64 688, !7, i64 696, !7, i64 704, !7, i64 712, !7, i64 720, !7, i64 728, !7, i64 736, !7, i64 744, !7, i64 752, !7, i64 760, !7, i64 768, !7, i64 776, !7, i64 784, !7, i64 792, !7, i64 800, !7, i64 808, !7, i64 816, !17, i64 824, !13, i64 920, !12, i64 928, !12, i64 1064, !8, i64 1200, !8, i64 1456, !18, i64 1712, !8, i64 2368, !8, i64 2752, !7, i64 2880, !8, i64 2888, !8, i64 3912, !7, i64 12104, !7, i64 12112, !7, i64 12120, !7, i64 12128, !8, i64 12136}
!17 = !{!"TX_MUTEX_STRUCT", !7, i64 0, !10, i64 8, !13, i64 16, !10, i64 24, !13, i64 32, !13, i64 36, !10, i64 40, !13, i64 48, !10, i64 56, !10, i64 64, !13, i64 72, !10, i64 80, !10, i64 88}
!18 = !{!"FX_PATH_STRUCT", !12, i64 0, !8, i64 136, !8, i64 392, !7, i64 648}
!19 = !{!6, !7, i64 16}
!20 = !{!11, !11, i64 0}
!21 = !{!16, !7, i64 0}
!22 = !{!16, !13, i64 264}
!23 = !{!16, !13, i64 80}
!24 = !{!16, !13, i64 128}
!25 = !{!16, !7, i64 192}
!26 = !{!6, !11, i64 120}
!27 = !{!16, !7, i64 104}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}
!32 = distinct !{!32, !30}
!33 = !{!16, !7, i64 12128}
!34 = !{!6, !7, i64 32}
!35 = !{!6, !7, i64 56}
!36 = !{!6, !7, i64 96}
!37 = !{!6, !7, i64 80}
!38 = !{!6, !7, i64 64}
!39 = !{!6, !7, i64 88}
!40 = !{!16, !13, i64 124}
!41 = !{!6, !11, i64 72}
!42 = !{!6, !7, i64 40}
!43 = !{!6, !11, i64 104}
!44 = !{!6, !7, i64 48}
!45 = !{!6, !7, i64 208}
!46 = !{!16, !13, i64 132}


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