; LLVM IR from ryansturmer/thinfat32 :: src (thinfat32)

; 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.struct_tfinfo = type { i8, i8, i32, i32, i16, i32, i8, i32, [512 x i8] }
%union.struct_FatFileEntry = type { %struct.struct_FatFile83 }
%struct.struct_FatFile83 = type { [8 x i8], [3 x i8], i8, i8, i8, i16, i16, i16, i16, i16, i16, i16, i32 }
%struct.struct_BPB_struct = type <{ [3 x i8], [8 x i8], i16, i8, i16, i8, i16, i16, i8, i16, i16, i16, i32, i32, %union.anon }>
%union.anon = type { %struct.struct_BPBFAT32_struct }
%struct.struct_BPBFAT32_struct = type <{ i32, i16, i16, i32, i16, i16, [12 x i8], i8, i8, i8, i32, [11 x i8], [8 x i8] }>

@tf_info = external dso_local global %struct.struct_tfinfo, align 4
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fetch(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @tf_init() #1 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %union.struct_FatFileEntry, align 1
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #2
  store i32 -1, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 5), align 4, !tbaa !5
  store i8 0, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 6), align 4, !tbaa !11
  %11 = call i32 @tf_fetch(i32 noundef 0)
  store ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 8), ptr %2, align 8, !tbaa !12
  %12 = load ptr, ptr %2, align 8, !tbaa !12
  %13 = getelementptr inbounds %struct.struct_BPB_struct, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 0
  %15 = load i8, ptr %14, align 1, !tbaa !14
  %16 = zext i8 %15 to i32
  %17 = icmp eq i32 %16, 235
  br i1 %17, label %18, label %25

18:                                               ; preds = %0
  %19 = load ptr, ptr %2, align 8, !tbaa !12
  %20 = getelementptr inbounds %struct.struct_BPB_struct, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds [3 x i8], ptr %20, i64 0, i64 2
  %22 = load i8, ptr %21, align 1, !tbaa !14
  %23 = zext i8 %22 to i32
  %24 = icmp eq i32 %23, 144
  br i1 %24, label %33, label %25

25:                                               ; preds = %18, %0
  %26 = load ptr, ptr %2, align 8, !tbaa !12
  %27 = getelementptr inbounds %struct.struct_BPB_struct, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds [3 x i8], ptr %27, i64 0, i64 0
  %29 = load i8, ptr %28, align 1, !tbaa !14
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 %30, 233
  br i1 %31, label %33, label %32

32:                                               ; preds = %25
  store i32 2, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

33:                                               ; preds = %25, %18
  %34 = load ptr, ptr %2, align 8, !tbaa !12
  %35 = getelementptr inbounds %struct.struct_BPB_struct, ptr %34, i32 0, i32 2
  %36 = load i16, ptr %35, align 1, !tbaa !15
  %37 = zext i16 %36 to i32
  %38 = icmp ne i32 %37, 512
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  store i32 2, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

40:                                               ; preds = %33
  %41 = load ptr, ptr %2, align 8, !tbaa !12
  %42 = getelementptr inbounds %struct.struct_BPB_struct, ptr %41, i32 0, i32 4
  %43 = load i16, ptr %42, align 1, !tbaa !17
  %44 = zext i16 %43 to i32
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %40
  store i32 2, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

47:                                               ; preds = %40
  %48 = load ptr, ptr %2, align 8, !tbaa !12
  %49 = getelementptr inbounds %struct.struct_BPB_struct, ptr %48, i32 0, i32 8
  %50 = load i8, ptr %49, align 1, !tbaa !18
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 240
  br i1 %52, label %53, label %66

53:                                               ; preds = %47
  %54 = load ptr, ptr %2, align 8, !tbaa !12
  %55 = getelementptr inbounds %struct.struct_BPB_struct, ptr %54, i32 0, i32 8
  %56 = load i8, ptr %55, align 1, !tbaa !18
  %57 = zext i8 %56 to i32
  %58 = icmp slt i32 %57, 248
  br i1 %58, label %65, label %59

59:                                               ; preds = %53
  %60 = load ptr, ptr %2, align 8, !tbaa !12
  %61 = getelementptr inbounds %struct.struct_BPB_struct, ptr %60, i32 0, i32 8
  %62 = load i8, ptr %61, align 1, !tbaa !18
  %63 = zext i8 %62 to i32
  %64 = icmp sgt i32 %63, 255
  br i1 %64, label %65, label %66

65:                                               ; preds = %59, %53
  store i32 2, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

66:                                               ; preds = %59, %47
  %67 = load ptr, ptr %2, align 8, !tbaa !12
  %68 = getelementptr inbounds %struct.struct_BPB_struct, ptr %67, i32 0, i32 9
  %69 = load i16, ptr %68, align 1, !tbaa !19
  %70 = zext i16 %69 to i32
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %77

72:                                               ; preds = %66
  %73 = load ptr, ptr %2, align 8, !tbaa !12
  %74 = getelementptr inbounds %struct.struct_BPB_struct, ptr %73, i32 0, i32 9
  %75 = load i16, ptr %74, align 1, !tbaa !19
  %76 = zext i16 %75 to i32
  br label %82

77:                                               ; preds = %66
  %78 = load ptr, ptr %2, align 8, !tbaa !12
  %79 = getelementptr inbounds %struct.struct_BPB_struct, ptr %78, i32 0, i32 14
  %80 = getelementptr inbounds %struct.struct_BPBFAT32_struct, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 1, !tbaa !14
  br label %82

82:                                               ; preds = %77, %72
  %83 = phi i32 [ %76, %72 ], [ %81, %77 ]
  store i32 %83, ptr %3, align 4, !tbaa !20
  %84 = load ptr, ptr %2, align 8, !tbaa !12
  %85 = getelementptr inbounds %struct.struct_BPB_struct, ptr %84, i32 0, i32 6
  %86 = load i16, ptr %85, align 1, !tbaa !21
  %87 = zext i16 %86 to i32
  %88 = mul nsw i32 %87, 32
  %89 = load ptr, ptr %2, align 8, !tbaa !12
  %90 = getelementptr inbounds %struct.struct_BPB_struct, ptr %89, i32 0, i32 2
  %91 = load i16, ptr %90, align 1, !tbaa !15
  %92 = zext i16 %91 to i32
  %93 = sub nsw i32 %92, 1
  %94 = add nsw i32 %88, %93
  %95 = sdiv i32 %94, 512
  store i32 %95, ptr %4, align 4, !tbaa !20
  %96 = load ptr, ptr %2, align 8, !tbaa !12
  %97 = getelementptr inbounds %struct.struct_BPB_struct, ptr %96, i32 0, i32 7
  %98 = load i16, ptr %97, align 1, !tbaa !22
  %99 = zext i16 %98 to i32
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %106

101:                                              ; preds = %82
  %102 = load ptr, ptr %2, align 8, !tbaa !12
  %103 = getelementptr inbounds %struct.struct_BPB_struct, ptr %102, i32 0, i32 7
  %104 = load i16, ptr %103, align 1, !tbaa !22
  %105 = zext i16 %104 to i32
  br label %110

106:                                              ; preds = %82
  %107 = load ptr, ptr %2, align 8, !tbaa !12
  %108 = getelementptr inbounds %struct.struct_BPB_struct, ptr %107, i32 0, i32 13
  %109 = load i32, ptr %108, align 1, !tbaa !23
  br label %110

110:                                              ; preds = %106, %101
  %111 = phi i32 [ %105, %101 ], [ %109, %106 ]
  store i32 %111, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 3), align 4, !tbaa !24
  %112 = load i32, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 3), align 4, !tbaa !24
  %113 = load ptr, ptr %2, align 8, !tbaa !12
  %114 = getelementptr inbounds %struct.struct_BPB_struct, ptr %113, i32 0, i32 4
  %115 = load i16, ptr %114, align 1, !tbaa !17
  %116 = zext i16 %115 to i32
  %117 = load ptr, ptr %2, align 8, !tbaa !12
  %118 = getelementptr inbounds %struct.struct_BPB_struct, ptr %117, i32 0, i32 5
  %119 = load i8, ptr %118, align 1, !tbaa !25
  %120 = zext i8 %119 to i32
  %121 = load i32, ptr %3, align 4, !tbaa !20
  %122 = mul i32 %120, %121
  %123 = add i32 %116, %122
  %124 = load i32, ptr %4, align 4, !tbaa !20
  %125 = add i32 %123, %124
  %126 = sub i32 %112, %125
  store i32 %126, ptr %5, align 4, !tbaa !20
  %127 = load ptr, ptr %2, align 8, !tbaa !12
  %128 = getelementptr inbounds %struct.struct_BPB_struct, ptr %127, i32 0, i32 3
  %129 = load i8, ptr %128, align 1, !tbaa !26
  store i8 %129, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 1), align 1, !tbaa !27
  %130 = load i32, ptr %5, align 4, !tbaa !20
  %131 = load i8, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 1), align 1, !tbaa !27
  %132 = zext i8 %131 to i32
  %133 = udiv i32 %130, %132
  store i32 %133, ptr %6, align 4, !tbaa !20
  %134 = load ptr, ptr %2, align 8, !tbaa !12
  %135 = getelementptr inbounds %struct.struct_BPB_struct, ptr %134, i32 0, i32 4
  %136 = load i16, ptr %135, align 1, !tbaa !17
  store i16 %136, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 4), align 4, !tbaa !28
  %137 = load ptr, ptr %2, align 8, !tbaa !12
  %138 = getelementptr inbounds %struct.struct_BPB_struct, ptr %137, i32 0, i32 4
  %139 = load i16, ptr %138, align 1, !tbaa !17
  %140 = zext i16 %139 to i32
  %141 = load ptr, ptr %2, align 8, !tbaa !12
  %142 = getelementptr inbounds %struct.struct_BPB_struct, ptr %141, i32 0, i32 5
  %143 = load i8, ptr %142, align 1, !tbaa !25
  %144 = zext i8 %143 to i32
  %145 = load i32, ptr %3, align 4, !tbaa !20
  %146 = mul i32 %144, %145
  %147 = add i32 %140, %146
  %148 = load i32, ptr %4, align 4, !tbaa !20
  %149 = add i32 %147, %148
  store i32 %149, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 2), align 4, !tbaa !29
  %150 = load i32, ptr %6, align 4, !tbaa !20
  %151 = icmp ult i32 %150, 65525
  br i1 %151, label %152, label %153

152:                                              ; preds = %110
  store i32 2, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

153:                                              ; preds = %110
  store i8 1, ptr @tf_info, align 4, !tbaa !30
  br label %154

154:                                              ; preds = %153
  store i32 -1, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 7), align 4, !tbaa !31
  store i32 0, ptr %7, align 4, !tbaa !20
  %155 = call ptr @tf_fopen(ptr noundef @.str.3, ptr noundef @.str.4)
  store ptr %155, ptr %8, align 8, !tbaa !12
  br label %156

156:                                              ; preds = %163, %154
  %157 = load i32, ptr %7, align 4, !tbaa !20
  %158 = zext i32 %157 to i64
  %159 = add i64 %158, 32
  %160 = trunc i64 %159 to i32
  store i32 %160, ptr %7, align 4, !tbaa !20
  %161 = load ptr, ptr %8, align 8, !tbaa !12
  %162 = call i32 @tf_fread(ptr noundef %9, i32 noundef 32, ptr noundef %161)
  br label %163

163:                                              ; preds = %156
  %164 = getelementptr inbounds %struct.struct_FatFile83, ptr %9, i32 0, i32 0
  %165 = getelementptr inbounds [8 x i8], ptr %164, i64 0, i64 0
  %166 = load i8, ptr %165, align 1, !tbaa !14
  %167 = zext i8 %166 to i32
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %156, label %169, !llvm.loop !32

169:                                              ; preds = %163
  %170 = load ptr, ptr %8, align 8, !tbaa !12
  %171 = call i32 @tf_fclose(ptr noundef %170)
  %172 = load i32, ptr %7, align 4, !tbaa !20
  store i32 %172, ptr getelementptr inbounds (%struct.struct_tfinfo, ptr @tf_info, i32 0, i32 7), align 4, !tbaa !31
  %173 = load ptr, ptr %8, align 8, !tbaa !12
  %174 = call i32 @tf_fclose(ptr noundef %173)
  %175 = load ptr, ptr %8, align 8, !tbaa !12
  call void @tf_release_handle(ptr noundef %175)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %176

176:                                              ; preds = %169, %152, %65, %46, %39, %32
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #2
  %177 = load i32, ptr %1, align 4
  ret i32 %177
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @tf_fopen(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fread(ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fclose(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @tf_release_handle(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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, !9, i64 16}
!6 = !{!"struct_tfinfo", !7, i64 0, !7, i64 1, !9, i64 4, !9, i64 8, !10, i64 12, !9, i64 16, !7, i64 20, !9, i64 24, !7, i64 28}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!6, !7, i64 20}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !10, i64 11}
!16 = !{!"struct_BPB_struct", !7, i64 0, !7, i64 3, !10, i64 11, !7, i64 13, !10, i64 14, !7, i64 16, !10, i64 17, !10, i64 19, !7, i64 21, !10, i64 22, !10, i64 24, !10, i64 26, !9, i64 28, !9, i64 32, !7, i64 36}
!17 = !{!16, !10, i64 14}
!18 = !{!16, !7, i64 21}
!19 = !{!16, !10, i64 22}
!20 = !{!9, !9, i64 0}
!21 = !{!16, !10, i64 17}
!22 = !{!16, !10, i64 19}
!23 = !{!16, !9, i64 32}
!24 = !{!6, !9, i64 8}
!25 = !{!16, !7, i64 16}
!26 = !{!16, !7, i64 13}
!27 = !{!6, !7, i64 1}
!28 = !{!6, !10, i64 12}
!29 = !{!6, !9, i64 4}
!30 = !{!6, !7, i64 0}
!31 = !{!6, !9, i64 24}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.struct_tfinfo = type { i8, i8, i32, i32, i16, i32, i8, i32, [512 x i8] }
%union.struct_FatFileEntry = type { %struct.struct_FatFile83 }
%struct.struct_FatFile83 = type { [8 x i8], [3 x i8], i8, i8, i8, i16, i16, i16, i16, i16, i16, i16, i32 }

@tf_info = external dso_local local_unnamed_addr global %struct.struct_tfinfo, align 4
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fetch(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @tf_init() local_unnamed_addr #1 {
  %1 = alloca %union.struct_FatFileEntry, align 1
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #2
  store i32 -1, ptr getelementptr inbounds (i8, ptr @tf_info, i64 16), align 4, !tbaa !5
  store i8 0, ptr getelementptr inbounds (i8, ptr @tf_info, i64 20), align 4, !tbaa !11
  %2 = tail call i32 @tf_fetch(i32 noundef 0)
  %3 = load i8, ptr getelementptr inbounds (i8, ptr @tf_info, i64 28), align 4
  %4 = icmp ne i8 %3, -21
  %5 = load i8, ptr getelementptr inbounds (i8, ptr @tf_info, i64 30), align 2
  %6 = icmp ne i8 %5, -112
  %or.cond.not54 = select i1 %4, i1 true, i1 %6
  %7 = icmp ne i8 %3, -23
  %or.cond44.not51 = and i1 %7, %or.cond.not54
  %8 = load i16, ptr getelementptr inbounds (i8, ptr @tf_info, i64 39), align 1
  %.not = icmp ne i16 %8, 512
  %or.cond45.not49 = select i1 %or.cond44.not51, i1 true, i1 %.not
  %9 = load i16, ptr getelementptr inbounds (i8, ptr @tf_info, i64 42), align 2
  %10 = icmp eq i16 %9, 0
  %or.cond47 = select i1 %or.cond45.not49, i1 true, i1 %10
  br i1 %or.cond47, label %47, label %11

11:                                               ; preds = %0
  %12 = load i8, ptr getelementptr inbounds (i8, ptr @tf_info, i64 49), align 1, !tbaa !12
  switch i8 %12, label %47 [
    i8 -1, label %13
    i8 -2, label %13
    i8 -3, label %13
    i8 -4, label %13
    i8 -5, label %13
    i8 -6, label %13
    i8 -7, label %13
    i8 -8, label %13
    i8 -16, label %13
  ]

13:                                               ; preds = %11, %11, %11, %11, %11, %11, %11, %11, %11
  %14 = load i16, ptr getelementptr inbounds (i8, ptr @tf_info, i64 50), align 2, !tbaa !14
  %.not39 = icmp eq i16 %14, 0
  %15 = zext i16 %14 to i32
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @tf_info, i64 64), align 4
  %17 = select i1 %.not39, i32 %16, i32 %15
  %18 = load i16, ptr getelementptr inbounds (i8, ptr @tf_info, i64 45), align 1, !tbaa !15
  %19 = zext i16 %18 to i32
  %20 = shl nuw nsw i32 %19, 5
  %21 = add nuw nsw i32 %20, 511
  %22 = lshr i32 %21, 9
  %23 = load i16, ptr getelementptr inbounds (i8, ptr @tf_info, i64 47), align 1, !tbaa !16
  %.not40 = icmp eq i16 %23, 0
  %24 = zext i16 %23 to i32
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @tf_info, i64 60), align 4
  %26 = select i1 %.not40, i32 %25, i32 %24
  store i32 %26, ptr getelementptr inbounds (i8, ptr @tf_info, i64 8), align 4, !tbaa !17
  %27 = zext i16 %9 to i32
  %28 = load i8, ptr getelementptr inbounds (i8, ptr @tf_info, i64 44), align 4, !tbaa !18
  %29 = zext i8 %28 to i32
  %30 = mul i32 %17, %29
  %31 = add nuw nsw i32 %22, %27
  %32 = add i32 %31, %30
  %33 = sub i32 %26, %32
  %34 = load i8, ptr getelementptr inbounds (i8, ptr @tf_info, i64 41), align 1, !tbaa !19
  store i8 %34, ptr getelementptr inbounds (i8, ptr @tf_info, i64 1), align 1, !tbaa !20
  %35 = zext i8 %34 to i32
  %36 = udiv i32 %33, %35
  store i16 %9, ptr getelementptr inbounds (i8, ptr @tf_info, i64 12), align 4, !tbaa !21
  store i32 %32, ptr getelementptr inbounds (i8, ptr @tf_info, i64 4), align 4, !tbaa !22
  %37 = icmp ult i32 %36, 65525
  br i1 %37, label %47, label %38

38:                                               ; preds = %13
  store i8 1, ptr @tf_info, align 4, !tbaa !23
  store i32 -1, ptr getelementptr inbounds (i8, ptr @tf_info, i64 24), align 4, !tbaa !24
  %39 = tail call ptr @tf_fopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4)
  br label %40

40:                                               ; preds = %40, %38
  %.034 = phi i32 [ 0, %38 ], [ %41, %40 ]
  %41 = add i32 %.034, 32
  %42 = call i32 @tf_fread(ptr noundef nonnull %1, i32 noundef 32, ptr noundef %39)
  %43 = load i8, ptr %1, align 1, !tbaa !25
  %.not41 = icmp eq i8 %43, 0
  br i1 %.not41, label %44, label %40, !llvm.loop !26

44:                                               ; preds = %40
  %45 = call i32 @tf_fclose(ptr noundef %39)
  store i32 %41, ptr getelementptr inbounds (i8, ptr @tf_info, i64 24), align 4, !tbaa !24
  %46 = call i32 @tf_fclose(ptr noundef %39)
  call void @tf_release_handle(ptr noundef %39)
  br label %47

47:                                               ; preds = %11, %13, %0, %44
  %.0 = phi i32 [ 0, %44 ], [ 2, %0 ], [ 2, %13 ], [ 2, %11 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #2
  ret i32 %.0
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fread(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @tf_fclose(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @tf_release_handle(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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, !9, i64 16}
!6 = !{!"struct_tfinfo", !7, i64 0, !7, i64 1, !9, i64 4, !9, i64 8, !10, i64 12, !9, i64 16, !7, i64 20, !9, i64 24, !7, i64 28}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!6, !7, i64 20}
!12 = !{!13, !7, i64 21}
!13 = !{!"struct_BPB_struct", !7, i64 0, !7, i64 3, !10, i64 11, !7, i64 13, !10, i64 14, !7, i64 16, !10, i64 17, !10, i64 19, !7, i64 21, !10, i64 22, !10, i64 24, !10, i64 26, !9, i64 28, !9, i64 32, !7, i64 36}
!14 = !{!13, !10, i64 22}
!15 = !{!13, !10, i64 17}
!16 = !{!13, !10, i64 19}
!17 = !{!6, !9, i64 8}
!18 = !{!13, !7, i64 16}
!19 = !{!13, !7, i64 13}
!20 = !{!6, !7, i64 1}
!21 = !{!6, !10, i64 12}
!22 = !{!6, !9, i64 4}
!23 = !{!6, !7, i64 0}
!24 = !{!6, !9, i64 24}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass