; LLVM IR from mlcommons/tiny :: benchmark/interface/Middlewares/ST/filex/common/src/fx_file_read.ll (fx_file_read)

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

@_fx_system_date = external global i32, align 4

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

24:                                               ; preds = %4
  store i32 7, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

25:                                               ; preds = %4
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %26, i32 0, i32 16
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  store ptr %28, ptr %18, align 8, !tbaa !5
  %29 = load ptr, ptr %18, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %29, i32 0, i32 77
  %31 = load i64, ptr %30, align 8, !tbaa !17
  %32 = add i64 %31, 1
  store i64 %32, ptr %30, align 8, !tbaa !17
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %33, i32 0, i32 16
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  store ptr %35, ptr %18, align 8, !tbaa !5
  %36 = load ptr, ptr %18, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %36, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !21
  %39 = icmp ne i64 %38, 1296385097
  br i1 %39, label %40, label %41

40:                                               ; preds = %25
  store i32 17, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

41:                                               ; preds = %25
  %42 = load ptr, ptr %18, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %42, i32 0, i32 112
  %44 = call i32 @_tx_mutex_get(ptr noundef %43, i64 noundef 4294967295)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store i32 17, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

47:                                               ; preds = %41
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %49, i32 0, i32 13
  %51 = load i64, ptr %50, align 8, !tbaa !22
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %52, i32 0, i32 14
  %54 = load i64, ptr %53, align 8, !tbaa !23
  %55 = icmp uge i64 %51, %54
  br i1 %55, label %56, label %61

56:                                               ; preds = %48
  %57 = load ptr, ptr %18, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %57, i32 0, i32 112
  %59 = call i32 @_tx_mutex_put(ptr noundef %58)
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %60, align 8, !tbaa !9
  store i32 9, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

61:                                               ; preds = %48
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %62, ptr %14, align 8, !tbaa !5
  %63 = load i64, ptr %8, align 8, !tbaa !9
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %64, i32 0, i32 14
  %66 = load i64, ptr %65, align 8, !tbaa !23
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %67, i32 0, i32 13
  %69 = load i64, ptr %68, align 8, !tbaa !22
  %70 = sub i64 %66, %69
  %71 = icmp ugt i64 %63, %70
  br i1 %71, label %72, label %80

72:                                               ; preds = %61
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %73, i32 0, i32 14
  %75 = load i64, ptr %74, align 8, !tbaa !23
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %76, i32 0, i32 13
  %78 = load i64, ptr %77, align 8, !tbaa !22
  %79 = sub i64 %75, %78
  store i64 %79, ptr %8, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %72, %61
  %81 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %81, ptr %11, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %437, %80
  %83 = load i64, ptr %11, align 8, !tbaa !9
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %85, label %438

85:                                               ; preds = %82
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %86, i32 0, i32 10
  %88 = load i64, ptr %87, align 8, !tbaa !24
  %89 = icmp ne i64 %88, 0
  br i1 %89, label %97, label %90

90:                                               ; preds = %85
  %91 = load i64, ptr %11, align 8, !tbaa !9
  %92 = load ptr, ptr %18, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %92, i32 0, i32 10
  %94 = load i32, ptr %93, align 8, !tbaa !25
  %95 = zext i32 %94 to i64
  %96 = icmp ult i64 %91, %95
  br i1 %96, label %97, label %150

97:                                               ; preds = %90, %85
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %99, i32 0, i32 9
  %101 = load i64, ptr %100, align 8, !tbaa !26
  %102 = load ptr, ptr %18, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !27
  %105 = call i32 @_fx_utility_logical_sector_read(ptr noundef %98, i64 noundef %101, ptr noundef %104, i64 noundef 1, i8 noundef zeroext 4)
  store i32 %105, ptr %10, align 4, !tbaa !28
  %106 = load i32, ptr %10, align 4, !tbaa !28
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %113

108:                                              ; preds = %97
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %109, i32 0, i32 112
  %111 = call i32 @_tx_mutex_put(ptr noundef %110)
  %112 = load i32, ptr %10, align 4, !tbaa !28
  store i32 %112, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

113:                                              ; preds = %97
  %114 = load ptr, ptr %18, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %114, i32 0, i32 10
  %116 = load i32, ptr %115, align 8, !tbaa !25
  %117 = zext i32 %116 to i64
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %118, i32 0, i32 10
  %120 = load i64, ptr %119, align 8, !tbaa !24
  %121 = sub i64 %117, %120
  store i64 %121, ptr %13, align 8, !tbaa !9
  %122 = load i64, ptr %13, align 8, !tbaa !9
  %123 = load i64, ptr %11, align 8, !tbaa !9
  %124 = icmp ugt i64 %122, %123
  br i1 %124, label %125, label %127

125:                                              ; preds = %113
  %126 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %126, ptr %13, align 8, !tbaa !9
  br label %127

127:                                              ; preds = %125, %113
  %128 = load ptr, ptr %18, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %128, i32 0, i32 2
  %130 = load ptr, ptr %129, align 8, !tbaa !27
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %131, i32 0, i32 10
  %133 = load i64, ptr %132, align 8, !tbaa !24
  %134 = getelementptr inbounds i8, ptr %130, i64 %133
  %135 = load ptr, ptr %14, align 8, !tbaa !5
  %136 = load i64, ptr %13, align 8, !tbaa !9
  call void @_fx_utility_memory_copy(ptr noundef %134, ptr noundef %135, i64 noundef %136)
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %137, i32 0, i32 10
  %139 = load i64, ptr %138, align 8, !tbaa !24
  %140 = load i64, ptr %13, align 8, !tbaa !9
  %141 = add i64 %139, %140
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %142, i32 0, i32 10
  store i64 %141, ptr %143, align 8, !tbaa !24
  %144 = load i64, ptr %11, align 8, !tbaa !9
  %145 = load i64, ptr %13, align 8, !tbaa !9
  %146 = sub i64 %144, %145
  store i64 %146, ptr %11, align 8, !tbaa !9
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = load i64, ptr %13, align 8, !tbaa !9
  %149 = getelementptr inbounds i8, ptr %147, i64 %148
  store ptr %149, ptr %14, align 8, !tbaa !5
  br label %343

150:                                              ; preds = %90
  %151 = load i64, ptr %11, align 8, !tbaa !9
  %152 = load ptr, ptr %18, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %152, i32 0, i32 10
  %154 = load i32, ptr %153, align 8, !tbaa !25
  %155 = zext i32 %154 to i64
  %156 = udiv i64 %151, %155
  %157 = trunc i64 %156 to i32
  store i32 %157, ptr %17, align 4, !tbaa !28
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %158, i32 0, i32 8
  %160 = load i64, ptr %159, align 8, !tbaa !29
  store i64 %160, ptr %15, align 8, !tbaa !9
  store i64 %160, ptr %16, align 8, !tbaa !9
  %161 = load ptr, ptr %18, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %161, i32 0, i32 19
  %163 = load i32, ptr %162, align 8, !tbaa !30
  %164 = zext i32 %163 to i64
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %165, i32 0, i32 12
  %167 = load i64, ptr %166, align 8, !tbaa !31
  %168 = sub i64 %164, %167
  store i64 %168, ptr %12, align 8, !tbaa !9
  br label %169

169:                                              ; preds = %207, %150
  %170 = load i64, ptr %12, align 8, !tbaa !9
  %171 = load i32, ptr %17, align 4, !tbaa !28
  %172 = zext i32 %171 to i64
  %173 = icmp ult i64 %170, %172
  br i1 %173, label %174, label %214

174:                                              ; preds = %169
  %175 = load ptr, ptr %18, align 8, !tbaa !5
  %176 = load i64, ptr %15, align 8, !tbaa !9
  %177 = call i32 @_fx_utility_FAT_entry_read(ptr noundef %175, i64 noundef %176, ptr noundef %16)
  store i32 %177, ptr %10, align 4, !tbaa !28
  %178 = load i32, ptr %10, align 4, !tbaa !28
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %189, label %180

180:                                              ; preds = %174
  %181 = load i64, ptr %16, align 8, !tbaa !9
  %182 = icmp ult i64 %181, 2
  br i1 %182, label %189, label %183

183:                                              ; preds = %180
  %184 = load i64, ptr %16, align 8, !tbaa !9
  %185 = load ptr, ptr %18, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %185, i32 0, i32 126
  %187 = load i64, ptr %186, align 8, !tbaa !32
  %188 = icmp ugt i64 %184, %187
  br i1 %188, label %189, label %198

189:                                              ; preds = %183, %180, %174
  %190 = load ptr, ptr %18, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %190, i32 0, i32 112
  %192 = call i32 @_tx_mutex_put(ptr noundef %191)
  %193 = load i32, ptr %10, align 4, !tbaa !28
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %195, label %197

195:                                              ; preds = %189
  %196 = load i32, ptr %10, align 4, !tbaa !28
  store i32 %196, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

197:                                              ; preds = %189
  store i32 8, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

198:                                              ; preds = %183
  %199 = load i64, ptr %16, align 8, !tbaa !9
  %200 = load i64, ptr %15, align 8, !tbaa !9
  %201 = add i64 %200, 1
  %202 = icmp ne i64 %199, %201
  br i1 %202, label %203, label %204

203:                                              ; preds = %198
  br label %214

204:                                              ; preds = %198
  %205 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %205, ptr %15, align 8, !tbaa !9
  br label %206

206:                                              ; preds = %204
  br label %207

207:                                              ; preds = %206
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %208, i32 0, i32 19
  %210 = load i32, ptr %209, align 8, !tbaa !30
  %211 = zext i32 %210 to i64
  %212 = load i64, ptr %12, align 8, !tbaa !9
  %213 = add i64 %212, %211
  store i64 %213, ptr %12, align 8, !tbaa !9
  br label %169, !llvm.loop !33

214:                                              ; preds = %203, %169
  %215 = load i64, ptr %12, align 8, !tbaa !9
  %216 = load i32, ptr %17, align 4, !tbaa !28
  %217 = zext i32 %216 to i64
  %218 = icmp ult i64 %215, %217
  br i1 %218, label %219, label %222

219:                                              ; preds = %214
  %220 = load i64, ptr %12, align 8, !tbaa !9
  %221 = trunc i64 %220 to i32
  store i32 %221, ptr %17, align 4, !tbaa !28
  br label %222

222:                                              ; preds = %219, %214
  %223 = load i32, ptr %17, align 4, !tbaa !28
  %224 = icmp eq i32 %223, 1
  br i1 %224, label %225, label %250

225:                                              ; preds = %222
  %226 = load ptr, ptr %18, align 8, !tbaa !5
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %227, i32 0, i32 9
  %229 = load i64, ptr %228, align 8, !tbaa !26
  %230 = load ptr, ptr %18, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %230, i32 0, i32 2
  %232 = load ptr, ptr %231, align 8, !tbaa !27
  %233 = call i32 @_fx_utility_logical_sector_read(ptr noundef %226, i64 noundef %229, ptr noundef %232, i64 noundef 1, i8 noundef zeroext 4)
  store i32 %233, ptr %10, align 4, !tbaa !28
  %234 = load i32, ptr %10, align 4, !tbaa !28
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %236, label %241

236:                                              ; preds = %225
  %237 = load ptr, ptr %18, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %237, i32 0, i32 112
  %239 = call i32 @_tx_mutex_put(ptr noundef %238)
  %240 = load i32, ptr %10, align 4, !tbaa !28
  store i32 %240, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

241:                                              ; preds = %225
  %242 = load ptr, ptr %18, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %242, i32 0, i32 2
  %244 = load ptr, ptr %243, align 8, !tbaa !27
  %245 = load ptr, ptr %14, align 8, !tbaa !5
  %246 = load ptr, ptr %18, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %246, i32 0, i32 10
  %248 = load i32, ptr %247, align 8, !tbaa !25
  %249 = zext i32 %248 to i64
  call void @_fx_utility_memory_copy(ptr noundef %244, ptr noundef %245, i64 noundef %249)
  br label %274

250:                                              ; preds = %222
  %251 = load ptr, ptr %6, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %251, i32 0, i32 21
  %253 = load i64, ptr %252, align 8, !tbaa !35
  %254 = load ptr, ptr %18, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %254, i32 0, i32 125
  store i64 %253, ptr %255, align 8, !tbaa !36
  %256 = load ptr, ptr %18, align 8, !tbaa !5
  %257 = load ptr, ptr %6, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %257, i32 0, i32 9
  %259 = load i64, ptr %258, align 8, !tbaa !26
  %260 = load ptr, ptr %14, align 8, !tbaa !5
  %261 = load i32, ptr %17, align 4, !tbaa !28
  %262 = zext i32 %261 to i64
  %263 = call i32 @_fx_utility_logical_sector_read(ptr noundef %256, i64 noundef %259, ptr noundef %260, i64 noundef %262, i8 noundef zeroext 4)
  store i32 %263, ptr %10, align 4, !tbaa !28
  %264 = load ptr, ptr %18, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %264, i32 0, i32 125
  store i64 0, ptr %265, align 8, !tbaa !36
  %266 = load i32, ptr %10, align 4, !tbaa !28
  %267 = icmp ne i32 %266, 0
  br i1 %267, label %268, label %273

268:                                              ; preds = %250
  %269 = load ptr, ptr %18, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %269, i32 0, i32 112
  %271 = call i32 @_tx_mutex_put(ptr noundef %270)
  %272 = load i32, ptr %10, align 4, !tbaa !28
  store i32 %272, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

273:                                              ; preds = %250
  br label %274

274:                                              ; preds = %273, %241
  %275 = load ptr, ptr %6, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %275, i32 0, i32 9
  %277 = load i64, ptr %276, align 8, !tbaa !26
  %278 = load i32, ptr %17, align 4, !tbaa !28
  %279 = sub i32 %278, 1
  %280 = zext i32 %279 to i64
  %281 = add i64 %277, %280
  %282 = load ptr, ptr %6, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %282, i32 0, i32 9
  store i64 %281, ptr %283, align 8, !tbaa !26
  %284 = load ptr, ptr %6, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %284, i32 0, i32 11
  %286 = load i64, ptr %285, align 8, !tbaa !37
  %287 = load ptr, ptr %6, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %287, i32 0, i32 12
  %289 = load i64, ptr %288, align 8, !tbaa !31
  %290 = load i32, ptr %17, align 4, !tbaa !28
  %291 = sub i32 %290, 1
  %292 = zext i32 %291 to i64
  %293 = add i64 %289, %292
  %294 = load ptr, ptr %18, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %294, i32 0, i32 19
  %296 = load i32, ptr %295, align 8, !tbaa !30
  %297 = zext i32 %296 to i64
  %298 = udiv i64 %293, %297
  %299 = add i64 %286, %298
  %300 = load ptr, ptr %6, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %300, i32 0, i32 11
  store i64 %299, ptr %301, align 8, !tbaa !37
  %302 = load ptr, ptr %6, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %302, i32 0, i32 12
  %304 = load i64, ptr %303, align 8, !tbaa !31
  %305 = load i32, ptr %17, align 4, !tbaa !28
  %306 = sub i32 %305, 1
  %307 = zext i32 %306 to i64
  %308 = add i64 %304, %307
  %309 = load ptr, ptr %18, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %309, i32 0, i32 19
  %311 = load i32, ptr %310, align 8, !tbaa !30
  %312 = zext i32 %311 to i64
  %313 = urem i64 %308, %312
  %314 = load ptr, ptr %6, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %314, i32 0, i32 12
  store i64 %313, ptr %315, align 8, !tbaa !31
  %316 = load ptr, ptr %18, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %316, i32 0, i32 10
  %318 = load i32, ptr %317, align 8, !tbaa !25
  %319 = zext i32 %318 to i64
  %320 = load ptr, ptr %6, align 8, !tbaa !5
  %321 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %320, i32 0, i32 10
  store i64 %319, ptr %321, align 8, !tbaa !24
  %322 = load i64, ptr %15, align 8, !tbaa !9
  %323 = load ptr, ptr %6, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %323, i32 0, i32 8
  store i64 %322, ptr %324, align 8, !tbaa !29
  %325 = load i64, ptr %11, align 8, !tbaa !9
  %326 = load ptr, ptr %18, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %326, i32 0, i32 10
  %328 = load i32, ptr %327, align 8, !tbaa !25
  %329 = zext i32 %328 to i64
  %330 = load i32, ptr %17, align 4, !tbaa !28
  %331 = zext i32 %330 to i64
  %332 = mul i64 %329, %331
  %333 = sub i64 %325, %332
  store i64 %333, ptr %11, align 8, !tbaa !9
  %334 = load ptr, ptr %14, align 8, !tbaa !5
  %335 = load ptr, ptr %18, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %335, i32 0, i32 10
  %337 = load i32, ptr %336, align 8, !tbaa !25
  %338 = zext i32 %337 to i64
  %339 = load i32, ptr %17, align 4, !tbaa !28
  %340 = zext i32 %339 to i64
  %341 = mul i64 %338, %340
  %342 = getelementptr inbounds i8, ptr %334, i64 %341
  store ptr %342, ptr %14, align 8, !tbaa !5
  br label %343

343:                                              ; preds = %274, %127
  %344 = load ptr, ptr %6, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %344, i32 0, i32 10
  %346 = load i64, ptr %345, align 8, !tbaa !24
  %347 = load ptr, ptr %18, align 8, !tbaa !5
  %348 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %347, i32 0, i32 10
  %349 = load i32, ptr %348, align 8, !tbaa !25
  %350 = zext i32 %349 to i64
  %351 = icmp uge i64 %346, %350
  br i1 %351, label %352, label %437

352:                                              ; preds = %343
  %353 = load i64, ptr %11, align 8, !tbaa !9
  %354 = icmp eq i64 %353, 0
  br i1 %354, label %355, label %366

355:                                              ; preds = %352
  %356 = load ptr, ptr %6, align 8, !tbaa !5
  %357 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %356, i32 0, i32 13
  %358 = load i64, ptr %357, align 8, !tbaa !22
  %359 = load i64, ptr %8, align 8, !tbaa !9
  %360 = add i64 %358, %359
  %361 = load ptr, ptr %6, align 8, !tbaa !5
  %362 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %361, i32 0, i32 15
  %363 = load i64, ptr %362, align 8, !tbaa !38
  %364 = icmp uge i64 %360, %363
  br i1 %364, label %365, label %366

365:                                              ; preds = %355
  br label %438

366:                                              ; preds = %355, %352
  %367 = load ptr, ptr %6, align 8, !tbaa !5
  %368 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %367, i32 0, i32 12
  %369 = load i64, ptr %368, align 8, !tbaa !31
  %370 = add i64 %369, 1
  store i64 %370, ptr %368, align 8, !tbaa !31
  %371 = load ptr, ptr %6, align 8, !tbaa !5
  %372 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %371, i32 0, i32 12
  %373 = load i64, ptr %372, align 8, !tbaa !31
  %374 = load ptr, ptr %18, align 8, !tbaa !5
  %375 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %374, i32 0, i32 19
  %376 = load i32, ptr %375, align 8, !tbaa !30
  %377 = zext i32 %376 to i64
  %378 = icmp uge i64 %373, %377
  br i1 %378, label %379, label %429

379:                                              ; preds = %366
  %380 = load ptr, ptr %18, align 8, !tbaa !5
  %381 = load ptr, ptr %6, align 8, !tbaa !5
  %382 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %381, i32 0, i32 8
  %383 = load i64, ptr %382, align 8, !tbaa !29
  %384 = call i32 @_fx_utility_FAT_entry_read(ptr noundef %380, i64 noundef %383, ptr noundef %16)
  store i32 %384, ptr %10, align 4, !tbaa !28
  %385 = load i32, ptr %10, align 4, !tbaa !28
  %386 = icmp ne i32 %385, 0
  br i1 %386, label %396, label %387

387:                                              ; preds = %379
  %388 = load i64, ptr %16, align 8, !tbaa !9
  %389 = icmp ult i64 %388, 2
  br i1 %389, label %396, label %390

390:                                              ; preds = %387
  %391 = load i64, ptr %16, align 8, !tbaa !9
  %392 = load ptr, ptr %18, align 8, !tbaa !5
  %393 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %392, i32 0, i32 126
  %394 = load i64, ptr %393, align 8, !tbaa !32
  %395 = icmp ugt i64 %391, %394
  br i1 %395, label %396, label %405

396:                                              ; preds = %390, %387, %379
  %397 = load ptr, ptr %18, 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 i32, ptr %10, align 4, !tbaa !28
  %401 = icmp ne i32 %400, 0
  br i1 %401, label %402, label %404

402:                                              ; preds = %396
  %403 = load i32, ptr %10, align 4, !tbaa !28
  store i32 %403, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

404:                                              ; preds = %396
  store i32 8, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

405:                                              ; preds = %390
  %406 = load i64, ptr %16, align 8, !tbaa !9
  %407 = load ptr, ptr %6, align 8, !tbaa !5
  %408 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %407, i32 0, i32 8
  store i64 %406, ptr %408, align 8, !tbaa !29
  %409 = load ptr, ptr %6, align 8, !tbaa !5
  %410 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %409, i32 0, i32 11
  %411 = load i64, ptr %410, align 8, !tbaa !37
  %412 = add i64 %411, 1
  store i64 %412, ptr %410, align 8, !tbaa !37
  %413 = load ptr, ptr %18, align 8, !tbaa !5
  %414 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %413, i32 0, i32 18
  %415 = load i32, ptr %414, align 4, !tbaa !39
  %416 = zext i32 %415 to i64
  %417 = load i64, ptr %16, align 8, !tbaa !9
  %418 = sub i64 %417, 2
  %419 = load ptr, ptr %18, align 8, !tbaa !5
  %420 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %419, i32 0, i32 19
  %421 = load i32, ptr %420, align 8, !tbaa !30
  %422 = zext i32 %421 to i64
  %423 = mul i64 %418, %422
  %424 = add i64 %416, %423
  %425 = load ptr, ptr %6, align 8, !tbaa !5
  %426 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %425, i32 0, i32 9
  store i64 %424, ptr %426, align 8, !tbaa !26
  %427 = load ptr, ptr %6, align 8, !tbaa !5
  %428 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %427, i32 0, i32 12
  store i64 0, ptr %428, align 8, !tbaa !31
  br label %434

429:                                              ; preds = %366
  %430 = load ptr, ptr %6, align 8, !tbaa !5
  %431 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %430, i32 0, i32 9
  %432 = load i64, ptr %431, align 8, !tbaa !26
  %433 = add i64 %432, 1
  store i64 %433, ptr %431, align 8, !tbaa !26
  br label %434

434:                                              ; preds = %429, %405
  %435 = load ptr, ptr %6, align 8, !tbaa !5
  %436 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %435, i32 0, i32 10
  store i64 0, ptr %436, align 8, !tbaa !24
  br label %437

437:                                              ; preds = %434, %343
  br label %82, !llvm.loop !40

438:                                              ; preds = %365, %82
  %439 = load ptr, ptr %6, align 8, !tbaa !5
  %440 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %439, i32 0, i32 13
  %441 = load i64, ptr %440, align 8, !tbaa !22
  %442 = load i64, ptr %8, align 8, !tbaa !9
  %443 = add i64 %441, %442
  %444 = load ptr, ptr %6, align 8, !tbaa !5
  %445 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %444, i32 0, i32 13
  store i64 %443, ptr %445, align 8, !tbaa !22
  %446 = load i64, ptr %8, align 8, !tbaa !9
  %447 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %446, ptr %447, align 8, !tbaa !9
  %448 = load i32, ptr @_fx_system_date, align 4, !tbaa !28
  %449 = load ptr, ptr %6, align 8, !tbaa !5
  %450 = getelementptr inbounds %struct.FX_FILE_STRUCT, ptr %449, i32 0, i32 19
  %451 = getelementptr inbounds %struct.FX_DIR_ENTRY_STRUCT, ptr %450, i32 0, i32 9
  store i32 %448, ptr %451, align 4, !tbaa !41
  %452 = load ptr, ptr %18, align 8, !tbaa !5
  %453 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %452, i32 0, i32 112
  %454 = call i32 @_tx_mutex_put(ptr noundef %453)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %455

455:                                              ; preds = %438, %404, %402, %268, %236, %197, %195, %108, %56, %46, %40, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  %456 = load i32, ptr %5, align 4
  ret i32 %456
}

; 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_logical_sector_read(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i8 noundef zeroext) #2

declare void @_fx_utility_memory_copy(ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @_fx_utility_FAT_entry_read(ptr noundef, i64 noundef, ptr 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", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"FX_FILE_STRUCT", !10, i64 0, !6, i64 8, !10, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !13, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !14, i64 152, !7, i64 288, !10, i64 544, !6, i64 552}
!13 = !{!"long 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, !10, i64 56, !13, i64 64, !13, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !13, i64 112, !10, i64 120, !13, i64 128}
!15 = !{!"int", !7, i64 0}
!16 = !{!12, !6, i64 128}
!17 = !{!18, !10, i64 544}
!18 = !{!"FX_MEDIA_STRUCT", !10, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !15, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !15, i64 80, !15, i64 84, !15, i64 88, !13, i64 96, !10, 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, !10, i64 152, !15, i64 160, !10, i64 168, !10, i64 176, !15, i64 184, !10, i64 192, !10, i64 200, !6, i64 208, !15, i64 216, !15, i64 220, !6, i64 224, !10, i64 232, !10, i64 240, !10, 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, !10, i64 320, !6, i64 328, !6, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !10, i64 672, !10, i64 680, !10, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !10, i64 768, !10, i64 776, !10, i64 784, !10, i64 792, !10, i64 800, !10, i64 808, !10, 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, !10, i64 2880, !7, i64 2888, !7, i64 3912, !10, i64 12104, !10, i64 12112, !10, i64 12120, !10, i64 12128, !7, i64 12136}
!19 = !{!"TX_MUTEX_STRUCT", !10, 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, !10, i64 648}
!21 = !{!18, !10, i64 0}
!22 = !{!12, !13, i64 104}
!23 = !{!12, !13, i64 112}
!24 = !{!12, !10, i64 80}
!25 = !{!18, !15, i64 80}
!26 = !{!12, !13, i64 72}
!27 = !{!18, !6, i64 16}
!28 = !{!15, !15, i64 0}
!29 = !{!12, !10, i64 64}
!30 = !{!18, !15, i64 128}
!31 = !{!12, !10, i64 96}
!32 = !{!18, !10, i64 12120}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!12, !10, i64 544}
!36 = !{!18, !10, i64 12112}
!37 = !{!12, !10, i64 88}
!38 = !{!12, !13, i64 120}
!39 = !{!18, !15, i64 124}
!40 = distinct !{!40, !34}
!41 = !{!12, !15, i64 196}


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

@_fx_system_date = external local_unnamed_addr global i32, align 4

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

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %9, i64 544
  %11 = load i64, ptr %10, align 8, !tbaa !15
  %12 = add i64 %11, 1
  store i64 %12, ptr %10, align 8, !tbaa !15
  %13 = load i64, ptr %9, align 8, !tbaa !19
  %.not160 = icmp eq i64 %13, 1296385097
  br i1 %.not160, label %14, label %163

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %9, i64 824
  %16 = tail call i32 @_tx_mutex_get(ptr noundef nonnull %15, i64 noundef 4294967295) #4
  %.not161 = icmp eq i32 %16, 0
  br i1 %.not161, label %17, label %163

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  %19 = load i64, ptr %18, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 112
  %21 = load i64, ptr %20, align 8, !tbaa !21
  %.not162 = icmp ult i64 %19, %21
  br i1 %.not162, label %24, label %22

22:                                               ; preds = %17
  %23 = tail call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  store i64 0, ptr %3, align 8, !tbaa !22
  br label %163

24:                                               ; preds = %17
  %25 = sub i64 %21, %19
  %spec.select = tail call i64 @llvm.umin.i64(i64 %25, i64 %2)
  %.not163189 = icmp eq i64 %spec.select, 0
  br i1 %.not163189, label %._crit_edge194, label %.lr.ph193

.lr.ph193:                                        ; preds = %24
  %26 = getelementptr inbounds i8, ptr %0, i64 80
  %27 = getelementptr inbounds i8, ptr %9, i64 80
  %28 = getelementptr inbounds i8, ptr %0, i64 64
  %29 = getelementptr inbounds i8, ptr %9, i64 128
  %30 = getelementptr inbounds i8, ptr %0, i64 96
  %31 = getelementptr inbounds i8, ptr %9, i64 12120
  %32 = getelementptr inbounds i8, ptr %0, i64 544
  %33 = getelementptr inbounds i8, ptr %9, i64 12112
  %34 = getelementptr inbounds i8, ptr %0, i64 72
  %35 = getelementptr inbounds i8, ptr %9, i64 16
  %36 = getelementptr inbounds i8, ptr %0, i64 88
  %37 = getelementptr inbounds i8, ptr %0, i64 120
  %38 = getelementptr inbounds i8, ptr %9, i64 124
  %.pre = load i64, ptr %26, align 8, !tbaa !23
  br label %39

39:                                               ; preds = %.lr.ph193, %156
  %40 = phi i64 [ %.pre, %.lr.ph193 ], [ %157, %156 ]
  %.0140191 = phi ptr [ %1, %.lr.ph193 ], [ %.1218, %156 ]
  %.0143190 = phi i64 [ %spec.select, %.lr.ph193 ], [ %.1144220, %156 ]
  %.not164 = icmp eq i64 %40, 0
  br i1 %.not164, label %41, label %45

41:                                               ; preds = %39
  %42 = load i32, ptr %27, align 8, !tbaa !24
  %43 = zext i32 %42 to i64
  %44 = icmp ult i64 %.0143190, %43
  br i1 %44, label %45, label %51

45:                                               ; preds = %41, %39
  %46 = load i64, ptr %34, align 8, !tbaa !25
  %47 = load ptr, ptr %35, align 8, !tbaa !26
  %48 = call i32 @_fx_utility_logical_sector_read(ptr noundef nonnull %9, i64 noundef %46, ptr noundef %47, i64 noundef 1, i8 noundef zeroext 4) #4
  %.not168 = icmp eq i32 %48, 0
  br i1 %.not168, label %110, label %49

49:                                               ; preds = %45
  %50 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

51:                                               ; preds = %41
  %52 = udiv i64 %.0143190, %43
  %53 = load i64, ptr %28, align 8, !tbaa !27
  store i64 %53, ptr %5, align 8, !tbaa !22
  %54 = load i32, ptr %29, align 8, !tbaa !28
  %55 = zext i32 %54 to i64
  %56 = load i64, ptr %30, align 8, !tbaa !29
  %57 = sub i64 %55, %56
  %58 = and i64 %52, 4294967295
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %51, %72
  %.0139184 = phi i64 [ %62, %72 ], [ %53, %51 ]
  %.0142183 = phi i64 [ %75, %72 ], [ %57, %51 ]
  %60 = call i32 @_fx_utility_FAT_entry_read(ptr noundef nonnull %9, i64 noundef %.0139184, ptr noundef nonnull %5) #4
  %.fr = freeze i32 %60
  %61 = icmp ne i32 %.fr, 0
  %62 = load i64, ptr %5, align 8
  %63 = icmp ult i64 %62, 2
  %or.cond = select i1 %61, i1 true, i1 %63
  br i1 %or.cond, label %68, label %64

64:                                               ; preds = %.lr.ph
  %65 = load i64, ptr %31, align 8, !tbaa !30
  %66 = icmp ugt i64 %62, %65
  br i1 %66, label %.thread, label %70

.thread:                                          ; preds = %64
  %67 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

68:                                               ; preds = %.lr.ph
  %69 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  %spec.select239 = select i1 %61, i32 %.fr, i32 8
  br label %163

70:                                               ; preds = %64
  %71 = add i64 %.0139184, 1
  %.not165 = icmp eq i64 %62, %71
  br i1 %.not165, label %72, label %._crit_edge

72:                                               ; preds = %70
  %73 = load i32, ptr %29, align 8, !tbaa !28
  %74 = zext i32 %73 to i64
  %75 = add nuw nsw i64 %.0142183, %74
  %76 = icmp ult i64 %75, %58
  br i1 %76, label %.lr.ph, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %72, %70, %51
  %.0139.lcssa = phi i64 [ %53, %51 ], [ %.0139184, %70 ], [ %62, %72 ]
  %spec.select174 = phi i64 [ %52, %51 ], [ %.0142183, %70 ], [ %52, %72 ]
  %77 = and i64 %spec.select174, 4294967295
  %78 = icmp eq i64 %77, 1
  br i1 %78, label %79, label %89

79:                                               ; preds = %._crit_edge
  %80 = load i64, ptr %34, align 8, !tbaa !25
  %81 = load ptr, ptr %35, align 8, !tbaa !26
  %82 = call i32 @_fx_utility_logical_sector_read(ptr noundef nonnull %9, i64 noundef %80, ptr noundef %81, i64 noundef 1, i8 noundef zeroext 4) #4
  %.not167 = icmp eq i32 %82, 0
  br i1 %.not167, label %85, label %83

83:                                               ; preds = %79
  %84 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

85:                                               ; preds = %79
  %86 = load ptr, ptr %35, align 8, !tbaa !26
  %87 = load i32, ptr %27, align 8, !tbaa !24
  %88 = zext i32 %87 to i64
  call void @_fx_utility_memory_copy(ptr noundef %86, ptr noundef %.0140191, i64 noundef %88) #4
  br label %.thread211

89:                                               ; preds = %._crit_edge
  %90 = load i64, ptr %32, align 8, !tbaa !33
  store i64 %90, ptr %33, align 8, !tbaa !34
  %91 = load i64, ptr %34, align 8, !tbaa !25
  %92 = call i32 @_fx_utility_logical_sector_read(ptr noundef nonnull %9, i64 noundef %91, ptr noundef %.0140191, i64 noundef %77, i8 noundef zeroext 4) #4
  store i64 0, ptr %33, align 8, !tbaa !34
  %.not166 = icmp eq i32 %92, 0
  br i1 %.not166, label %.thread211, label %93

93:                                               ; preds = %89
  %94 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

.thread211:                                       ; preds = %85, %89
  %95 = load i64, ptr %34, align 8, !tbaa !25
  %96 = add i64 %spec.select174, 4294967295
  %97 = and i64 %96, 4294967295
  %98 = add i64 %95, %97
  store i64 %98, ptr %34, align 8, !tbaa !25
  %99 = load i64, ptr %36, align 8, !tbaa !35
  %100 = load i64, ptr %30, align 8, !tbaa !29
  %101 = add i64 %100, %97
  %102 = load i32, ptr %29, align 8, !tbaa !28
  %103 = zext i32 %102 to i64
  %104 = udiv i64 %101, %103
  %105 = add i64 %104, %99
  store i64 %105, ptr %36, align 8, !tbaa !35
  %106 = urem i64 %101, %103
  store i64 %106, ptr %30, align 8, !tbaa !29
  %107 = load i32, ptr %27, align 8, !tbaa !24
  %108 = zext i32 %107 to i64
  store i64 %108, ptr %26, align 8, !tbaa !23
  store i64 %.0139.lcssa, ptr %28, align 8, !tbaa !27
  %109 = mul nuw i64 %77, %108
  %.1214 = getelementptr inbounds i8, ptr %.0140191, i64 %109
  %.1144215 = sub i64 %.0143190, %109
  br label %119

110:                                              ; preds = %45
  %111 = load i32, ptr %27, align 8, !tbaa !24
  %112 = zext i32 %111 to i64
  %113 = load i64, ptr %26, align 8, !tbaa !23
  %114 = sub i64 %112, %113
  %spec.select173 = call i64 @llvm.umin.i64(i64 %114, i64 %.0143190)
  %115 = load ptr, ptr %35, align 8, !tbaa !26
  %116 = getelementptr inbounds i8, ptr %115, i64 %113
  call void @_fx_utility_memory_copy(ptr noundef %116, ptr noundef %.0140191, i64 noundef %spec.select173) #4
  %117 = load i64, ptr %26, align 8, !tbaa !23
  %118 = add i64 %117, %spec.select173
  store i64 %118, ptr %26, align 8, !tbaa !23
  %.pre204 = load i32, ptr %27, align 8, !tbaa !24
  %.pre207 = zext i32 %.pre204 to i64
  %.1 = getelementptr inbounds i8, ptr %.0140191, i64 %spec.select173
  %.1144 = sub i64 %.0143190, %spec.select173
  %.not170 = icmp ult i64 %118, %.pre207
  br i1 %.not170, label %156, label %119

119:                                              ; preds = %.thread211, %110
  %.1144219 = phi i64 [ %.1144215, %.thread211 ], [ %.1144, %110 ]
  %.1217 = phi ptr [ %.1214, %.thread211 ], [ %.1, %110 ]
  %120 = icmp eq i64 %.1144219, 0
  br i1 %120, label %121, label %125

121:                                              ; preds = %119
  %122 = load i64, ptr %18, align 8, !tbaa !20
  %123 = add i64 %122, %spec.select
  %124 = load i64, ptr %37, align 8, !tbaa !36
  %.not171 = icmp ult i64 %123, %124
  br i1 %.not171, label %125, label %._crit_edge194

125:                                              ; preds = %121, %119
  %126 = load i64, ptr %30, align 8, !tbaa !29
  %127 = add i64 %126, 1
  store i64 %127, ptr %30, align 8, !tbaa !29
  %128 = load i32, ptr %29, align 8, !tbaa !28
  %129 = zext i32 %128 to i64
  %.not172 = icmp ult i64 %127, %129
  br i1 %.not172, label %152, label %130

130:                                              ; preds = %125
  %131 = load i64, ptr %28, align 8, !tbaa !27
  %132 = call i32 @_fx_utility_FAT_entry_read(ptr noundef nonnull %9, i64 noundef %131, ptr noundef nonnull %5) #4
  %.fr241 = freeze i32 %132
  %133 = icmp ne i32 %.fr241, 0
  %134 = load i64, ptr %5, align 8
  %135 = icmp ult i64 %134, 2
  %or.cond3 = select i1 %133, i1 true, i1 %135
  br i1 %or.cond3, label %140, label %136

136:                                              ; preds = %130
  %137 = load i64, ptr %31, align 8, !tbaa !30
  %138 = icmp ugt i64 %134, %137
  br i1 %138, label %.thread222, label %142

.thread222:                                       ; preds = %136
  %139 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

140:                                              ; preds = %130
  %141 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  %spec.select240 = select i1 %133, i32 %.fr241, i32 8
  br label %163

142:                                              ; preds = %136
  store i64 %134, ptr %28, align 8, !tbaa !27
  %143 = load i64, ptr %36, align 8, !tbaa !35
  %144 = add i64 %143, 1
  store i64 %144, ptr %36, align 8, !tbaa !35
  %145 = load i32, ptr %38, align 4, !tbaa !37
  %146 = zext i32 %145 to i64
  %147 = add i64 %134, -2
  %148 = load i32, ptr %29, align 8, !tbaa !28
  %149 = zext i32 %148 to i64
  %150 = mul i64 %147, %149
  %151 = add i64 %150, %146
  store i64 %151, ptr %34, align 8, !tbaa !25
  store i64 0, ptr %30, align 8, !tbaa !29
  br label %155

152:                                              ; preds = %125
  %153 = load i64, ptr %34, align 8, !tbaa !25
  %154 = add i64 %153, 1
  store i64 %154, ptr %34, align 8, !tbaa !25
  br label %155

155:                                              ; preds = %152, %142
  store i64 0, ptr %26, align 8, !tbaa !23
  br label %156

156:                                              ; preds = %155, %110
  %.1144220 = phi i64 [ %.1144219, %155 ], [ %.1144, %110 ]
  %.1218 = phi ptr [ %.1217, %155 ], [ %.1, %110 ]
  %157 = phi i64 [ 0, %155 ], [ %118, %110 ]
  %.not163 = icmp eq i64 %.1144220, 0
  br i1 %.not163, label %.._crit_edge194.loopexit_crit_edge, label %39, !llvm.loop !38

.._crit_edge194.loopexit_crit_edge:               ; preds = %156
  %.pre205.pre = load i64, ptr %18, align 8, !tbaa !20
  br label %._crit_edge194

._crit_edge194:                                   ; preds = %121, %.._crit_edge194.loopexit_crit_edge, %24
  %158 = phi i64 [ %19, %24 ], [ %.pre205.pre, %.._crit_edge194.loopexit_crit_edge ], [ %122, %121 ]
  %159 = add i64 %158, %spec.select
  store i64 %159, ptr %18, align 8, !tbaa !20
  store i64 %spec.select, ptr %3, align 8, !tbaa !22
  %160 = load i32, ptr @_fx_system_date, align 4, !tbaa !39
  %161 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 %160, ptr %161, align 4, !tbaa !40
  %162 = call i32 @_tx_mutex_put(ptr noundef nonnull %15) #4
  br label %163

163:                                              ; preds = %140, %68, %.thread222, %.thread, %14, %7, %4, %._crit_edge194, %93, %83, %49, %22
  %.0145 = phi i32 [ 9, %22 ], [ %48, %49 ], [ 0, %._crit_edge194 ], [ %82, %83 ], [ %92, %93 ], [ 7, %4 ], [ 17, %7 ], [ 17, %14 ], [ 8, %.thread ], [ 8, %.thread222 ], [ %spec.select239, %68 ], [ %spec.select240, %140 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret i32 %.0145
}

; 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_logical_sector_read(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #2

declare void @_fx_utility_memory_copy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @_fx_utility_FAT_entry_read(ptr noundef, i64 noundef, ptr 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.umin.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 544}
!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 = !{!16, !7, i64 0}
!20 = !{!6, !11, i64 104}
!21 = !{!6, !11, i64 112}
!22 = !{!7, !7, i64 0}
!23 = !{!6, !7, i64 80}
!24 = !{!16, !13, i64 80}
!25 = !{!6, !11, i64 72}
!26 = !{!16, !10, i64 16}
!27 = !{!6, !7, i64 64}
!28 = !{!16, !13, i64 128}
!29 = !{!6, !7, i64 96}
!30 = !{!16, !7, i64 12120}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!6, !7, i64 544}
!34 = !{!16, !7, i64 12112}
!35 = !{!6, !7, i64 88}
!36 = !{!6, !11, i64 120}
!37 = !{!16, !13, i64 124}
!38 = distinct !{!38, !32}
!39 = !{!13, !13, i64 0}
!40 = !{!6, !13, i64 196}


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