; LLVM IR from Dovyski/opengl-demos :: src/texture-simple-woodbox/bmp.ll (ZN3Bmp4loadEPKc)

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

%class.Bmp = type { i32, i32, i32, i32, i32, ptr, %struct.HEADER, %struct.INFOHEADER }
%struct.HEADER = type { i16, i32, i16, i16, i32 }
%struct.INFOHEADER = type { i32, i32, i32, i16, i16, i32, i32, i32, i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Bmp4loadEPKc(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call noalias ptr @fopen(ptr noundef %9, ptr noundef @.str.1)
  store ptr %10, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %16

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %14)
  store i32 1, ptr %6, align 4
  br label %204

16:                                               ; preds = %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %17)
  %19 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %20 = getelementptr inbounds %struct.HEADER, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call i64 @fread(ptr noundef %20, i64 noundef 2, i64 noundef 1, ptr noundef %21)
  %23 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %24 = getelementptr inbounds %struct.HEADER, ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i64 @fread(ptr noundef %24, i64 noundef 4, i64 noundef 1, ptr noundef %25)
  %27 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %28 = getelementptr inbounds %struct.HEADER, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i64 @fread(ptr noundef %28, i64 noundef 2, i64 noundef 1, ptr noundef %29)
  %31 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %32 = getelementptr inbounds %struct.HEADER, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call i64 @fread(ptr noundef %32, i64 noundef 2, i64 noundef 1, ptr noundef %33)
  %35 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %36 = getelementptr inbounds %struct.HEADER, ptr %35, i32 0, i32 4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = call i64 @fread(ptr noundef %36, i64 noundef 4, i64 noundef 1, ptr noundef %37)
  %39 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %40 = getelementptr inbounds %struct.INFOHEADER, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call i64 @fread(ptr noundef %40, i64 noundef 4, i64 noundef 1, ptr noundef %41)
  %43 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %44 = getelementptr inbounds %struct.INFOHEADER, ptr %43, i32 0, i32 1
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i64 @fread(ptr noundef %44, i64 noundef 4, i64 noundef 1, ptr noundef %45)
  %47 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %48 = getelementptr inbounds %struct.INFOHEADER, ptr %47, i32 0, i32 2
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = call i64 @fread(ptr noundef %48, i64 noundef 4, i64 noundef 1, ptr noundef %49)
  %51 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %52 = getelementptr inbounds %struct.INFOHEADER, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = call i64 @fread(ptr noundef %52, i64 noundef 2, i64 noundef 1, ptr noundef %53)
  %55 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %56 = getelementptr inbounds %struct.INFOHEADER, ptr %55, i32 0, i32 4
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = call i64 @fread(ptr noundef %56, i64 noundef 2, i64 noundef 1, ptr noundef %57)
  %59 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %60 = getelementptr inbounds %struct.INFOHEADER, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i64 @fread(ptr noundef %60, i64 noundef 4, i64 noundef 1, ptr noundef %61)
  %63 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %64 = getelementptr inbounds %struct.INFOHEADER, ptr %63, i32 0, i32 6
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = call i64 @fread(ptr noundef %64, i64 noundef 4, i64 noundef 1, ptr noundef %65)
  %67 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %68 = getelementptr inbounds %struct.INFOHEADER, ptr %67, i32 0, i32 7
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = call i64 @fread(ptr noundef %68, i64 noundef 4, i64 noundef 1, ptr noundef %69)
  %71 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %72 = getelementptr inbounds %struct.INFOHEADER, ptr %71, i32 0, i32 8
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call i64 @fread(ptr noundef %72, i64 noundef 4, i64 noundef 1, ptr noundef %73)
  %75 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %76 = getelementptr inbounds %struct.INFOHEADER, ptr %75, i32 0, i32 9
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = call i64 @fread(ptr noundef %76, i64 noundef 4, i64 noundef 1, ptr noundef %77)
  %79 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %80 = getelementptr inbounds %struct.INFOHEADER, ptr %79, i32 0, i32 10
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call i64 @fread(ptr noundef %80, i64 noundef 4, i64 noundef 1, ptr noundef %81)
  %83 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %84 = getelementptr inbounds %struct.INFOHEADER, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  store i32 %85, ptr %86, align 8, !tbaa !15
  %87 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %88 = getelementptr inbounds %struct.INFOHEADER, ptr %87, i32 0, i32 2
  %89 = load i32, ptr %88, align 8, !tbaa !16
  %90 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 1
  store i32 %89, ptr %90, align 4, !tbaa !17
  %91 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %92 = getelementptr inbounds %struct.INFOHEADER, ptr %91, i32 0, i32 4
  %93 = load i16, ptr %92, align 2, !tbaa !18
  %94 = zext i16 %93 to i32
  %95 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 4
  store i32 %94, ptr %95, align 8, !tbaa !19
  %96 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  %97 = load i32, ptr %96, align 8, !tbaa !15
  %98 = add nsw i32 %97, 1
  %99 = mul nsw i32 3, %98
  %100 = sdiv i32 %99, 4
  %101 = mul nsw i32 %100, 4
  %102 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 3
  store i32 %101, ptr %102, align 4, !tbaa !20
  %103 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 3
  %104 = load i32, ptr %103, align 4, !tbaa !20
  %105 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 1
  %106 = load i32, ptr %105, align 4, !tbaa !17
  %107 = mul nsw i32 %104, %106
  %108 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 2
  store i32 %107, ptr %108, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %109 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 3
  %110 = load i32, ptr %109, align 4, !tbaa !20
  %111 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  %112 = load i32, ptr %111, align 8, !tbaa !15
  %113 = mul nsw i32 3, %112
  %114 = sub nsw i32 %110, %113
  store i32 %114, ptr %7, align 4, !tbaa !22
  %115 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !15
  %117 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !17
  %119 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 4
  %120 = load i32, ptr %119, align 8, !tbaa !19
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %116, i32 noundef %118, i32 noundef %120)
  %122 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 3
  %123 = load i32, ptr %122, align 4, !tbaa !20
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %123)
  %125 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !15
  %127 = mul nsw i32 %126, 3
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %127)
  %129 = load i32, ptr %7, align 4, !tbaa !22
  %130 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %129)
  %131 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 2
  %132 = load i32, ptr %131, align 8, !tbaa !21
  %133 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %134 = getelementptr inbounds %struct.INFOHEADER, ptr %133, i32 0, i32 6
  %135 = load i32, ptr %134, align 4, !tbaa !23
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %132, i32 noundef %135)
  %137 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 6
  %138 = getelementptr inbounds %struct.HEADER, ptr %137, i32 0, i32 0
  %139 = load i16, ptr %138, align 8, !tbaa !24
  %140 = zext i16 %139 to i32
  %141 = icmp ne i32 %140, 19778
  br i1 %141, label %142, label %145

142:                                              ; preds = %16
  %143 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %144 = call i32 @getchar()
  call void @exit(i32 noundef 0) #7
  unreachable

145:                                              ; preds = %16
  %146 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 0
  %147 = load i32, ptr %146, align 8, !tbaa !15
  %148 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !17
  %150 = mul nsw i32 %147, %149
  %151 = mul nsw i32 %150, 3
  %152 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 2
  %153 = load i32, ptr %152, align 8, !tbaa !21
  %154 = icmp ne i32 %151, %153
  br i1 %154, label %155, label %158

155:                                              ; preds = %145
  %156 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %157 = call i32 @getchar()
  br label %158

158:                                              ; preds = %155, %145
  %159 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %160 = getelementptr inbounds %struct.INFOHEADER, ptr %159, i32 0, i32 5
  %161 = load i32, ptr %160, align 8, !tbaa !25
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %166

163:                                              ; preds = %158
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %165 = call i32 @getchar()
  store i32 1, ptr %6, align 4
  br label %203

166:                                              ; preds = %158
  %167 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 4
  %168 = load i32, ptr %167, align 8, !tbaa !19
  %169 = icmp ne i32 %168, 24
  br i1 %169, label %170, label %175

170:                                              ; preds = %166
  %171 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 4
  %172 = load i32, ptr %171, align 8, !tbaa !19
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %172)
  %174 = call i32 @getchar()
  store i32 1, ptr %6, align 4
  br label %203

175:                                              ; preds = %166
  %176 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %177 = getelementptr inbounds %struct.INFOHEADER, ptr %176, i32 0, i32 3
  %178 = load i16, ptr %177, align 4, !tbaa !26
  %179 = zext i16 %178 to i32
  %180 = icmp ne i32 %179, 1
  br i1 %180, label %181, label %188

181:                                              ; preds = %175
  %182 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 7
  %183 = getelementptr inbounds %struct.INFOHEADER, ptr %182, i32 0, i32 3
  %184 = load i16, ptr %183, align 4, !tbaa !26
  %185 = zext i16 %184 to i32
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %185)
  %187 = call i32 @getchar()
  store i32 1, ptr %6, align 4
  br label %203

188:                                              ; preds = %175
  %189 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 2
  %190 = load i32, ptr %189, align 8, !tbaa !21
  %191 = sext i32 %190 to i64
  %192 = call noalias noundef nonnull ptr @_Znam(i64 noundef %191) #8
  %193 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 5
  store ptr %192, ptr %193, align 8, !tbaa !27
  %194 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 5
  %195 = load ptr, ptr %194, align 8, !tbaa !27
  %196 = getelementptr inbounds %class.Bmp, ptr %8, i32 0, i32 2
  %197 = load i32, ptr %196, align 8, !tbaa !21
  %198 = sext i32 %197 to i64
  %199 = load ptr, ptr %5, align 8, !tbaa !5
  %200 = call i64 @fread(ptr noundef %195, i64 noundef 1, i64 noundef %198, ptr noundef %199)
  %201 = load ptr, ptr %5, align 8, !tbaa !5
  %202 = call i32 @fclose(ptr noundef %201)
  store i32 0, ptr %6, align 4
  br label %203

203:                                              ; preds = %188, %181, %170, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %204

204:                                              ; preds = %203, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %205 = load i32, ptr %6, align 4
  switch i32 %205, label %207 [
    i32 0, label %206
    i32 1, label %206
  ]

206:                                              ; preds = %204, %204
  ret void

207:                                              ; preds = %204
  unreachable
}

declare i32 @printf(ptr noundef, ...) #1

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

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

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

declare i32 @fclose(ptr noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 52}
!10 = !{!"_ZTS3Bmp", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !12, i64 32, !14, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS6HEADER", !13, i64 0, !11, i64 4, !13, i64 8, !13, i64 10, !11, i64 12}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTS10INFOHEADER", !11, i64 0, !11, i64 4, !11, i64 8, !13, i64 12, !13, i64 14, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36}
!15 = !{!10, !11, i64 0}
!16 = !{!10, !11, i64 56}
!17 = !{!10, !11, i64 4}
!18 = !{!10, !13, i64 62}
!19 = !{!10, !11, i64 16}
!20 = !{!10, !11, i64 12}
!21 = !{!10, !11, i64 8}
!22 = !{!11, !11, i64 0}
!23 = !{!10, !11, i64 68}
!24 = !{!10, !13, i64 32}
!25 = !{!10, !11, i64 64}
!26 = !{!10, !13, i64 60}
!27 = !{!10, !6, i64 24}


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

@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Bmp4loadEPKc(ptr nocapture noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  %3 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.1)
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %7

5:                                                ; preds = %2
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %1)
  br label %101

7:                                                ; preds = %2
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %1)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = tail call i64 @fread(ptr noundef nonnull %9, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %3)
  %11 = getelementptr inbounds i8, ptr %0, i64 36
  %12 = tail call i64 @fread(ptr noundef nonnull %11, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  %14 = tail call i64 @fread(ptr noundef nonnull %13, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %3)
  %15 = getelementptr inbounds i8, ptr %0, i64 42
  %16 = tail call i64 @fread(ptr noundef nonnull %15, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %3)
  %17 = getelementptr inbounds i8, ptr %0, i64 44
  %18 = tail call i64 @fread(ptr noundef nonnull %17, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %19 = getelementptr inbounds i8, ptr %0, i64 48
  %20 = tail call i64 @fread(ptr noundef nonnull %19, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %21 = getelementptr inbounds i8, ptr %0, i64 52
  %22 = tail call i64 @fread(ptr noundef nonnull %21, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  %24 = tail call i64 @fread(ptr noundef nonnull %23, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %25 = getelementptr inbounds i8, ptr %0, i64 60
  %26 = tail call i64 @fread(ptr noundef nonnull %25, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %3)
  %27 = getelementptr inbounds i8, ptr %0, i64 62
  %28 = tail call i64 @fread(ptr noundef nonnull %27, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %3)
  %29 = getelementptr inbounds i8, ptr %0, i64 64
  %30 = tail call i64 @fread(ptr noundef nonnull %29, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %31 = getelementptr inbounds i8, ptr %0, i64 68
  %32 = tail call i64 @fread(ptr noundef nonnull %31, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %33 = getelementptr inbounds i8, ptr %0, i64 72
  %34 = tail call i64 @fread(ptr noundef nonnull %33, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %35 = getelementptr inbounds i8, ptr %0, i64 76
  %36 = tail call i64 @fread(ptr noundef nonnull %35, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %37 = getelementptr inbounds i8, ptr %0, i64 80
  %38 = tail call i64 @fread(ptr noundef nonnull %37, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %39 = getelementptr inbounds i8, ptr %0, i64 84
  %40 = tail call i64 @fread(ptr noundef nonnull %39, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %3)
  %41 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %41, ptr %0, align 8, !tbaa !14
  %42 = load i32, ptr %23, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %42, ptr %43, align 4, !tbaa !16
  %44 = load i16, ptr %27, align 2, !tbaa !17
  %45 = zext i16 %44 to i32
  %46 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %45, ptr %46, align 8, !tbaa !18
  %47 = mul i32 %41, 3
  %48 = add i32 %47, 3
  %49 = sdiv i32 %48, 4
  %50 = shl nsw i32 %49, 2
  %51 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %50, ptr %51, align 4, !tbaa !19
  %52 = mul nsw i32 %50, %42
  %53 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %52, ptr %53, align 8, !tbaa !20
  %.neg = mul i32 %41, -3
  %54 = add i32 %50, %.neg
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %41, i32 noundef %42, i32 noundef %45)
  %56 = load i32, ptr %51, align 4, !tbaa !19
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %56)
  %58 = load i32, ptr %0, align 8, !tbaa !14
  %59 = mul nsw i32 %58, 3
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %59)
  %61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %54)
  %62 = load i32, ptr %53, align 8, !tbaa !20
  %63 = load i32, ptr %31, align 4, !tbaa !21
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %62, i32 noundef %63)
  %65 = load i16, ptr %9, align 8, !tbaa !22
  %.not = icmp eq i16 %65, 19778
  br i1 %.not, label %69, label %66

66:                                               ; preds = %7
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %68 = tail call i32 @getchar()
  tail call void @exit(i32 noundef 0) #5
  unreachable

69:                                               ; preds = %7
  %70 = load i32, ptr %0, align 8, !tbaa !14
  %71 = load i32, ptr %43, align 4, !tbaa !16
  %72 = mul i32 %70, 3
  %73 = mul i32 %72, %71
  %74 = load i32, ptr %53, align 8, !tbaa !20
  %.not25 = icmp eq i32 %73, %74
  br i1 %.not25, label %78, label %75

75:                                               ; preds = %69
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %77 = tail call i32 @getchar()
  br label %78

78:                                               ; preds = %75, %69
  %79 = load i32, ptr %29, align 8, !tbaa !23
  %.not26 = icmp eq i32 %79, 0
  br i1 %.not26, label %83, label %80

80:                                               ; preds = %78
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %82 = tail call i32 @getchar()
  br label %101

83:                                               ; preds = %78
  %84 = load i32, ptr %46, align 8, !tbaa !18
  %.not27 = icmp eq i32 %84, 24
  br i1 %.not27, label %88, label %85

85:                                               ; preds = %83
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %84)
  %87 = tail call i32 @getchar()
  br label %101

88:                                               ; preds = %83
  %89 = load i16, ptr %25, align 4, !tbaa !24
  %.not28 = icmp eq i16 %89, 1
  br i1 %.not28, label %94, label %90

90:                                               ; preds = %88
  %91 = zext i16 %89 to i32
  %92 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %91)
  %93 = tail call i32 @getchar()
  br label %101

94:                                               ; preds = %88
  %95 = load i32, ptr %53, align 8, !tbaa !20
  %96 = sext i32 %95 to i64
  %97 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %96) #6
  %98 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %97, ptr %98, align 8, !tbaa !25
  %99 = tail call i64 @fread(ptr noundef nonnull %97, i64 noundef 1, i64 noundef %96, ptr noundef nonnull %3)
  %100 = tail call i32 @fclose(ptr noundef nonnull %3)
  br label %101

101:                                              ; preds = %80, %85, %90, %94, %5
  ret void
}

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind }
attributes #6 = { builtin allocsize(0) }

!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 52}
!6 = !{!"_ZTS3Bmp", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !11, i64 32, !13, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS6HEADER", !12, i64 0, !7, i64 4, !12, i64 8, !12, i64 10, !7, i64 12}
!12 = !{!"short", !8, i64 0}
!13 = !{!"_ZTS10INFOHEADER", !7, i64 0, !7, i64 4, !7, i64 8, !12, i64 12, !12, i64 14, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !7, i64 56}
!16 = !{!6, !7, i64 4}
!17 = !{!6, !12, i64 62}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 12}
!20 = !{!6, !7, i64 8}
!21 = !{!6, !7, i64 68}
!22 = !{!6, !12, i64 32}
!23 = !{!6, !7, i64 64}
!24 = !{!6, !12, i64 60}
!25 = !{!6, !10, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass