; LLVM IR from mkazhdan/DMG :: Util/TIFF (tif_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.tiff = type { ptr, i32, i32, i32, i32, i32, ptr, i16, %struct.TIFFDirectory, %struct.TIFFHeader, ptr, ptr, i32, i16, i32, i32, i32, i16, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, %struct.TIFFTagMethods, ptr }
%struct.TIFFDirectory = type { [4 x i64], i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, i16, i16, i32, i16, i16, double, double, float, float, i16, i16, float, float, [2 x i16], [3 x ptr], [2 x i16], i16, ptr, i32, i32, ptr, ptr, i32, i16, ptr, [2 x i16], i16, [3 x ptr], i32, ptr, i32, ptr }
%struct.TIFFHeader = type { i16, i16, i32 }
%struct.TIFFTagMethods = type { ptr, ptr, ptr }

@TIFFFillTile.module = external hidden constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 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

declare void @TIFFErrorExt(ptr noundef, ptr noundef, ptr noundef, ...) #1

declare void @_TIFFfree(ptr noundef) #1

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

declare void @TIFFReverseBits(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @TIFFFillTile(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tiff, ptr %9, i32 0, i32 8
  store ptr %10, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.TIFFDirectory, ptr %11, i32 0, i32 35
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds i32, ptr %13, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %17, ptr %7, align 4, !tbaa !9
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = icmp sle i32 %18, 0
  br i1 %19, label %20, label %31

20:                                               ; preds = %2
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.tiff, ptr %21, i32 0, i32 51
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.tiff, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %23, ptr noundef %26, ptr noundef @.str.7, i64 noundef %28, i64 noundef %30)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

31:                                               ; preds = %2
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.tiff, ptr %32, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !22
  %35 = and i32 %34, 2048
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %107

37:                                               ; preds = %31
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tiff, ptr %38, i32 0, i32 3
  %40 = load i32, ptr %39, align 8, !tbaa !22
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.TIFFDirectory, ptr %41, i32 0, i32 13
  %43 = load i16, ptr %42, align 2, !tbaa !23
  %44 = zext i16 %43 to i32
  %45 = and i32 %40, %44
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %53, label %47

47:                                               ; preds = %37
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.tiff, ptr %48, i32 0, i32 3
  %50 = load i32, ptr %49, align 8, !tbaa !22
  %51 = and i32 %50, 256
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %107

53:                                               ; preds = %47, %37
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.tiff, ptr %54, i32 0, i32 3
  %56 = load i32, ptr %55, align 8, !tbaa !22
  %57 = and i32 %56, 512
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %68

59:                                               ; preds = %53
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.tiff, ptr %60, i32 0, i32 43
  %62 = load ptr, ptr %61, align 8, !tbaa !24
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %68

64:                                               ; preds = %59
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.tiff, ptr %65, i32 0, i32 43
  %67 = load ptr, ptr %66, align 8, !tbaa !24
  call void @_TIFFfree(ptr noundef %67)
  br label %68

68:                                               ; preds = %64, %59, %53
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.tiff, ptr %69, i32 0, i32 3
  %71 = load i32, ptr %70, align 8, !tbaa !22
  %72 = and i32 %71, -513
  store i32 %72, ptr %70, align 8, !tbaa !22
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.TIFFDirectory, ptr %73, i32 0, i32 34
  %75 = load ptr, ptr %74, align 8, !tbaa !25
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds i32, ptr %75, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = add i32 %79, %80
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.tiff, ptr %82, i32 0, i32 48
  %84 = load i32, ptr %83, align 8, !tbaa !26
  %85 = icmp ugt i32 %81, %84
  br i1 %85, label %86, label %89

86:                                               ; preds = %68
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.tiff, ptr %87, i32 0, i32 20
  store i32 -1, ptr %88, align 8, !tbaa !27
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

89:                                               ; preds = %68
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.tiff, ptr %91, i32 0, i32 44
  store i32 %90, ptr %92, align 8, !tbaa !28
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.tiff, ptr %93, i32 0, i32 47
  %95 = load ptr, ptr %94, align 8, !tbaa !29
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TIFFDirectory, ptr %96, i32 0, i32 34
  %98 = load ptr, ptr %97, align 8, !tbaa !25
  %99 = load i32, ptr %5, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %98, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds i8, ptr %95, i64 %103
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.tiff, ptr %105, i32 0, i32 43
  store ptr %104, ptr %106, align 8, !tbaa !24
  br label %174

107:                                              ; preds = %47, %31
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.tiff, ptr %109, i32 0, i32 44
  %111 = load i32, ptr %110, align 8, !tbaa !28
  %112 = icmp sgt i32 %108, %111
  br i1 %112, label %113, label %140

113:                                              ; preds = %107
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.tiff, ptr %114, i32 0, i32 20
  store i32 -1, ptr %115, align 8, !tbaa !27
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tiff, ptr %116, i32 0, i32 3
  %118 = load i32, ptr %117, align 8, !tbaa !22
  %119 = and i32 %118, 512
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %130

121:                                              ; preds = %113
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.tiff, ptr %122, i32 0, i32 51
  %124 = load ptr, ptr %123, align 8, !tbaa !16
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.tiff, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !21
  %128 = load i32, ptr %5, align 4, !tbaa !9
  %129 = zext i32 %128 to i64
  call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %124, ptr noundef @TIFFFillTile.module, ptr noundef @.str.8, ptr noundef %127, i64 noundef %129)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

130:                                              ; preds = %113
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load i32, ptr %7, align 4, !tbaa !9
  %133 = add i32 %132, 1023
  %134 = udiv i32 %133, 1024
  %135 = mul i32 %134, 1024
  %136 = call i32 @TIFFReadBufferSetup(ptr noundef %131, ptr noundef null, i32 noundef %135)
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %139, label %138

138:                                              ; preds = %130
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

139:                                              ; preds = %130
  br label %140

140:                                              ; preds = %139, %107
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = load i32, ptr %5, align 4, !tbaa !9
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.tiff, ptr %143, i32 0, i32 43
  %145 = load ptr, ptr %144, align 8, !tbaa !24
  %146 = load i32, ptr %7, align 4, !tbaa !9
  %147 = call i32 @TIFFReadRawTile1(ptr noundef %141, i32 noundef %142, ptr noundef %145, i32 noundef %146, ptr noundef @TIFFFillTile.module)
  %148 = load i32, ptr %7, align 4, !tbaa !9
  %149 = icmp ne i32 %147, %148
  br i1 %149, label %150, label %151

150:                                              ; preds = %140
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

151:                                              ; preds = %140
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.tiff, ptr %152, i32 0, i32 3
  %154 = load i32, ptr %153, align 8, !tbaa !22
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.TIFFDirectory, ptr %155, i32 0, i32 13
  %157 = load i16, ptr %156, align 2, !tbaa !23
  %158 = zext i16 %157 to i32
  %159 = and i32 %154, %158
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %173, label %161

161:                                              ; preds = %151
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.tiff, ptr %162, i32 0, i32 3
  %164 = load i32, ptr %163, align 8, !tbaa !22
  %165 = and i32 %164, 256
  %166 = icmp eq i32 %165, 0
  br i1 %166, label %167, label %173

167:                                              ; preds = %161
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.tiff, ptr %168, i32 0, i32 43
  %170 = load ptr, ptr %169, align 8, !tbaa !24
  %171 = load i32, ptr %7, align 4, !tbaa !9
  %172 = sext i32 %171 to i64
  call void @TIFFReverseBits(ptr noundef %170, i64 noundef %172)
  br label %173

173:                                              ; preds = %167, %161, %151
  br label %174

174:                                              ; preds = %173, %89
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = load i32, ptr %5, align 4, !tbaa !9
  %177 = call i32 @TIFFStartTile(ptr noundef %175, i32 noundef %176)
  store i32 %177, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %178

178:                                              ; preds = %174, %150, %138, %121, %86, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %179 = load i32, ptr %3, align 4
  ret i32 %179
}

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 184}
!12 = !{!"", !7, i64 0, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 60, !13, i64 62, !13, i64 64, !13, i64 66, !13, i64 68, !13, i64 70, !13, i64 72, !13, i64 74, !10, i64 76, !13, i64 80, !13, i64 82, !14, i64 88, !14, i64 96, !15, i64 104, !15, i64 108, !13, i64 112, !13, i64 114, !15, i64 116, !15, i64 120, !7, i64 124, !7, i64 128, !7, i64 152, !13, i64 156, !6, i64 160, !10, i64 168, !10, i64 172, !6, i64 176, !6, i64 184, !10, i64 192, !13, i64 196, !6, i64 200, !7, i64 208, !13, i64 212, !7, i64 216, !10, i64 240, !6, i64 248, !10, i64 256, !6, i64 264}
!13 = !{!"short", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!17, !6, i64 608}
!17 = !{!"tiff", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 32, !13, i64 40, !12, i64 48, !18, i64 320, !6, i64 328, !6, i64 336, !10, i64 344, !13, i64 348, !10, i64 352, !10, i64 356, !10, i64 360, !13, i64 364, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !10, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !10, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !10, i64 536, !10, i64 540, !6, i64 544, !10, i64 552, !6, i64 560, !10, i64 568, !6, i64 576, !10, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !6, i64 640, !6, i64 648, !6, i64 656, !6, i64 664, !19, i64 672, !6, i64 680, !20, i64 688, !6, i64 712}
!18 = !{!"", !13, i64 0, !13, i64 2, !10, i64 4}
!19 = !{!"long", !7, i64 0}
!20 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!17, !6, i64 0}
!22 = !{!17, !10, i64 16}
!23 = !{!12, !13, i64 70}
!24 = !{!17, !6, i64 544}
!25 = !{!12, !6, i64 176}
!26 = !{!17, !10, i64 584}
!27 = !{!17, !10, i64 376}
!28 = !{!17, !10, i64 552}
!29 = !{!17, !6, i64 576}


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

@TIFFFillTile.module = external hidden constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 x i8], align 1

declare void @TIFFErrorExt(ptr noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

declare void @_TIFFfree(ptr noundef) local_unnamed_addr #0

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

declare void @TIFFReverseBits(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @TIFFFillTile(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 232
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = zext i32 %1 to i64
  %6 = getelementptr inbounds i32, ptr %4, i64 %5
  %7 = load i32, ptr %6, align 4, !tbaa !14
  %8 = icmp slt i32 %7, 1
  br i1 %8, label %9, label %14

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 608
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = load ptr, ptr %0, align 8, !tbaa !20
  %13 = sext i32 %7 to i64
  tail call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %11, ptr noundef %12, ptr noundef nonnull @.str.7, i64 noundef %13, i64 noundef %5) #2
  br label %83

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i32, ptr %15, align 8, !tbaa !21
  %17 = and i32 %16, 2048
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %51, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 118
  %20 = load i16, ptr %19, align 2, !tbaa !22
  %21 = or i16 %20, 256
  %22 = zext i16 %21 to i32
  %23 = and i32 %16, %22
  %or.cond = icmp eq i32 %23, 0
  br i1 %or.cond, label %51, label %24

24:                                               ; preds = %18
  %25 = and i32 %16, 512
  %.not55 = icmp eq i32 %25, 0
  br i1 %.not55, label %30, label %26

26:                                               ; preds = %24
  %27 = getelementptr inbounds i8, ptr %0, i64 544
  %28 = load ptr, ptr %27, align 8, !tbaa !23
  %.not56 = icmp eq ptr %28, null
  br i1 %.not56, label %30, label %29

29:                                               ; preds = %26
  tail call void @_TIFFfree(ptr noundef nonnull %28) #2
  %.pre = load i32, ptr %15, align 8, !tbaa !21
  br label %30

30:                                               ; preds = %29, %26, %24
  %31 = phi i32 [ %.pre, %29 ], [ %16, %26 ], [ %16, %24 ]
  %32 = and i32 %31, -513
  store i32 %32, ptr %15, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %0, i64 224
  %34 = load ptr, ptr %33, align 8, !tbaa !24
  %35 = getelementptr inbounds i32, ptr %34, i64 %5
  %36 = load i32, ptr %35, align 4, !tbaa !14
  %37 = add i32 %36, %7
  %38 = getelementptr inbounds i8, ptr %0, i64 584
  %39 = load i32, ptr %38, align 8, !tbaa !25
  %40 = icmp ugt i32 %37, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %30
  %42 = getelementptr inbounds i8, ptr %0, i64 376
  store i32 -1, ptr %42, align 8, !tbaa !26
  br label %83

43:                                               ; preds = %30
  %44 = getelementptr inbounds i8, ptr %0, i64 552
  store i32 %7, ptr %44, align 8, !tbaa !27
  %45 = getelementptr inbounds i8, ptr %0, i64 576
  %46 = load ptr, ptr %45, align 8, !tbaa !28
  %47 = load i32, ptr %35, align 4, !tbaa !14
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %46, i64 %48
  %50 = getelementptr inbounds i8, ptr %0, i64 544
  store ptr %49, ptr %50, align 8, !tbaa !23
  br label %81

51:                                               ; preds = %18, %14
  %52 = getelementptr inbounds i8, ptr %0, i64 552
  %53 = load i32, ptr %52, align 8, !tbaa !27
  %54 = icmp sgt i32 %7, %53
  br i1 %54, label %55, label %67

55:                                               ; preds = %51
  %56 = getelementptr inbounds i8, ptr %0, i64 376
  store i32 -1, ptr %56, align 8, !tbaa !26
  %57 = and i32 %16, 512
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %63

59:                                               ; preds = %55
  %60 = getelementptr inbounds i8, ptr %0, i64 608
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = load ptr, ptr %0, align 8, !tbaa !20
  tail call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %61, ptr noundef nonnull @TIFFFillTile.module, ptr noundef nonnull @.str.8, ptr noundef %62, i64 noundef %5) #2
  br label %83

63:                                               ; preds = %55
  %64 = add nuw i32 %7, 1023
  %65 = and i32 %64, -1024
  %66 = tail call i32 @TIFFReadBufferSetup(ptr noundef nonnull %0, ptr noundef null, i32 noundef %65)
  %.not52 = icmp eq i32 %66, 0
  br i1 %.not52, label %83, label %67

67:                                               ; preds = %63, %51
  %68 = getelementptr inbounds i8, ptr %0, i64 544
  %69 = load ptr, ptr %68, align 8, !tbaa !23
  %70 = tail call i32 @TIFFReadRawTile1(ptr noundef nonnull %0, i32 noundef %1, ptr noundef %69, i32 noundef %7, ptr noundef nonnull @TIFFFillTile.module)
  %.not53 = icmp eq i32 %70, %7
  br i1 %.not53, label %71, label %83

71:                                               ; preds = %67
  %72 = load i32, ptr %15, align 8, !tbaa !21
  %73 = getelementptr inbounds i8, ptr %0, i64 118
  %74 = load i16, ptr %73, align 2, !tbaa !22
  %75 = or i16 %74, 256
  %76 = zext i16 %75 to i32
  %77 = and i32 %72, %76
  %or.cond58 = icmp eq i32 %77, 0
  br i1 %or.cond58, label %78, label %81

78:                                               ; preds = %71
  %79 = load ptr, ptr %68, align 8, !tbaa !23
  %80 = zext nneg i32 %7 to i64
  tail call void @TIFFReverseBits(ptr noundef %79, i64 noundef %80) #2
  br label %81

81:                                               ; preds = %71, %78, %43
  %82 = tail call i32 @TIFFStartTile(ptr noundef nonnull %0, i32 noundef %1)
  br label %83

83:                                               ; preds = %67, %63, %81, %59, %41, %9
  %.0 = phi i32 [ 0, %9 ], [ 0, %41 ], [ %82, %81 ], [ 0, %59 ], [ 0, %63 ], [ 0, %67 ]
  ret i32 %.0
}

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

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

attributes #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 = { 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, !13, i64 184}
!6 = !{!"", !7, i64 0, !9, i64 32, !9, i64 36, !9, i64 40, !9, i64 44, !9, i64 48, !9, i64 52, !9, i64 56, !10, i64 60, !10, i64 62, !10, i64 64, !10, i64 66, !10, i64 68, !10, i64 70, !10, i64 72, !10, i64 74, !9, i64 76, !10, i64 80, !10, i64 82, !11, i64 88, !11, i64 96, !12, i64 104, !12, i64 108, !10, i64 112, !10, i64 114, !12, i64 116, !12, i64 120, !7, i64 124, !7, i64 128, !7, i64 152, !10, i64 156, !13, i64 160, !9, i64 168, !9, i64 172, !13, i64 176, !13, i64 184, !9, i64 192, !10, i64 196, !13, i64 200, !7, i64 208, !10, i64 212, !7, i64 216, !9, i64 240, !13, i64 248, !9, i64 256, !13, i64 264}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!"double", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!9, !9, i64 0}
!15 = !{!16, !13, i64 608}
!16 = !{!"tiff", !13, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !9, i64 24, !13, i64 32, !10, i64 40, !6, i64 48, !17, i64 320, !13, i64 328, !13, i64 336, !9, i64 344, !10, i64 348, !9, i64 352, !9, i64 356, !9, i64 360, !10, i64 364, !9, i64 368, !9, i64 372, !9, i64 376, !9, i64 380, !9, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !9, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456, !13, i64 464, !13, i64 472, !13, i64 480, !13, i64 488, !13, i64 496, !13, i64 504, !13, i64 512, !13, i64 520, !13, i64 528, !9, i64 536, !9, i64 540, !13, i64 544, !9, i64 552, !13, i64 560, !9, i64 568, !13, i64 576, !9, i64 584, !13, i64 592, !13, i64 600, !13, i64 608, !13, i64 616, !13, i64 624, !13, i64 632, !13, i64 640, !13, i64 648, !13, i64 656, !13, i64 664, !18, i64 672, !13, i64 680, !19, i64 688, !13, i64 712}
!17 = !{!"", !10, i64 0, !10, i64 2, !9, i64 4}
!18 = !{!"long", !7, i64 0}
!19 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16}
!20 = !{!16, !13, i64 0}
!21 = !{!16, !9, i64 16}
!22 = !{!6, !10, i64 70}
!23 = !{!16, !13, i64 544}
!24 = !{!6, !13, i64 176}
!25 = !{!16, !9, i64 584}
!26 = !{!16, !9, i64 376}
!27 = !{!16, !9, i64 552}
!28 = !{!16, !13, i64 576}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass