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

@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@TIFFFillStrip.module = external hidden constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [44 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

; Function Attrs: nounwind uwtable
define dso_local i32 @TIFFFillStrip(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.2, i64 noundef %28, i64 noundef %30)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

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 %130

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 %130

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 %112

86:                                               ; preds = %68
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.tiff, ptr %87, i32 0, i32 51
  %89 = load ptr, ptr %88, align 8, !tbaa !16
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.tiff, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !21
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.tiff, ptr %95, i32 0, i32 48
  %97 = load i32, ptr %96, align 8, !tbaa !26
  %98 = zext i32 %97 to i64
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.TIFFDirectory, ptr %99, i32 0, i32 34
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = load i32, ptr %5, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %101, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = sub i64 %98, %106
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %89, ptr noundef @TIFFFillStrip.module, ptr noundef @.str.3, ptr noundef %92, i64 noundef %94, i64 noundef %107, i64 noundef %109)
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.tiff, ptr %110, i32 0, i32 14
  store i32 -1, ptr %111, align 8, !tbaa !27
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

112:                                              ; preds = %68
  %113 = load i32, ptr %7, align 4, !tbaa !9
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.tiff, ptr %114, i32 0, i32 44
  store i32 %113, ptr %115, align 8, !tbaa !28
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tiff, ptr %116, i32 0, i32 47
  %118 = load ptr, ptr %117, align 8, !tbaa !29
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.TIFFDirectory, ptr %119, i32 0, i32 34
  %121 = load ptr, ptr %120, align 8, !tbaa !25
  %122 = load i32, ptr %5, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds i8, ptr %118, i64 %126
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.tiff, ptr %128, i32 0, i32 43
  store ptr %127, ptr %129, align 8, !tbaa !24
  br label %197

130:                                              ; preds = %47, %31
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.tiff, ptr %132, i32 0, i32 44
  %134 = load i32, ptr %133, align 8, !tbaa !28
  %135 = icmp sgt i32 %131, %134
  br i1 %135, label %136, label %163

136:                                              ; preds = %130
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.tiff, ptr %137, i32 0, i32 14
  store i32 -1, ptr %138, align 8, !tbaa !27
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.tiff, ptr %139, i32 0, i32 3
  %141 = load i32, ptr %140, align 8, !tbaa !22
  %142 = and i32 %141, 512
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %144, label %153

144:                                              ; preds = %136
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.tiff, ptr %145, i32 0, i32 51
  %147 = load ptr, ptr %146, align 8, !tbaa !16
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.tiff, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !21
  %151 = load i32, ptr %5, align 4, !tbaa !9
  %152 = zext i32 %151 to i64
  call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %147, ptr noundef @TIFFFillStrip.module, ptr noundef @.str.4, ptr noundef %150, i64 noundef %152)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

153:                                              ; preds = %136
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = load i32, ptr %7, align 4, !tbaa !9
  %156 = add i32 %155, 1023
  %157 = udiv i32 %156, 1024
  %158 = mul i32 %157, 1024
  %159 = call i32 @TIFFReadBufferSetup(ptr noundef %154, ptr noundef null, i32 noundef %158)
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %162, label %161

161:                                              ; preds = %153
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

162:                                              ; preds = %153
  br label %163

163:                                              ; preds = %162, %130
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = load i32, ptr %5, align 4, !tbaa !9
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.tiff, ptr %166, i32 0, i32 43
  %168 = load ptr, ptr %167, align 8, !tbaa !24
  %169 = load i32, ptr %7, align 4, !tbaa !9
  %170 = call i32 @TIFFReadRawStrip1(ptr noundef %164, i32 noundef %165, ptr noundef %168, i32 noundef %169, ptr noundef @TIFFFillStrip.module)
  %171 = load i32, ptr %7, align 4, !tbaa !9
  %172 = icmp ne i32 %170, %171
  br i1 %172, label %173, label %174

173:                                              ; preds = %163
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

174:                                              ; preds = %163
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.tiff, ptr %175, i32 0, i32 3
  %177 = load i32, ptr %176, align 8, !tbaa !22
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.TIFFDirectory, ptr %178, i32 0, i32 13
  %180 = load i16, ptr %179, align 2, !tbaa !23
  %181 = zext i16 %180 to i32
  %182 = and i32 %177, %181
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %196, label %184

184:                                              ; preds = %174
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.tiff, ptr %185, i32 0, i32 3
  %187 = load i32, ptr %186, align 8, !tbaa !22
  %188 = and i32 %187, 256
  %189 = icmp eq i32 %188, 0
  br i1 %189, label %190, label %196

190:                                              ; preds = %184
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.tiff, ptr %191, i32 0, i32 43
  %193 = load ptr, ptr %192, align 8, !tbaa !24
  %194 = load i32, ptr %7, align 4, !tbaa !9
  %195 = sext i32 %194 to i64
  call void @TIFFReverseBits(ptr noundef %193, i64 noundef %195)
  br label %196

196:                                              ; preds = %190, %184, %174
  br label %197

197:                                              ; preds = %196, %112
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = load i32, ptr %5, align 4, !tbaa !9
  %200 = call i32 @TIFFStartStrip(ptr noundef %198, i32 noundef %199)
  store i32 %200, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %201

201:                                              ; preds = %197, %173, %161, %144, %86, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %202 = load i32, ptr %3, align 4
  ret i32 %202
}

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

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
declare hidden i32 @TIFFStartStrip(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 352}
!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"

@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@TIFFFillStrip.module = external hidden constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [44 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @TIFFFillStrip(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.2, i64 noundef %13, i64 noundef %5) #2
  br label %90

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 %58, 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 %58, label %24

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

26:                                               ; preds = %24
  %27 = getelementptr inbounds i8, ptr %0, i64 544
  %28 = load ptr, ptr %27, align 8, !tbaa !23
  %.not64 = icmp eq ptr %28, null
  br i1 %.not64, 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 %50

41:                                               ; preds = %30
  %42 = getelementptr inbounds i8, ptr %0, i64 608
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = load ptr, ptr %0, align 8, !tbaa !20
  %45 = zext i32 %39 to i64
  %46 = zext i32 %36 to i64
  %47 = sub nsw i64 %45, %46
  %48 = zext nneg i32 %7 to i64
  tail call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %43, ptr noundef nonnull @TIFFFillStrip.module, ptr noundef nonnull @.str.3, ptr noundef %44, i64 noundef %5, i64 noundef %47, i64 noundef %48) #2
  %49 = getelementptr inbounds i8, ptr %0, i64 352
  store i32 -1, ptr %49, align 8, !tbaa !26
  br label %90

50:                                               ; preds = %30
  %51 = getelementptr inbounds i8, ptr %0, i64 552
  store i32 %7, ptr %51, align 8, !tbaa !27
  %52 = getelementptr inbounds i8, ptr %0, i64 576
  %53 = load ptr, ptr %52, align 8, !tbaa !28
  %54 = load i32, ptr %35, align 4, !tbaa !14
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %53, i64 %55
  %57 = getelementptr inbounds i8, ptr %0, i64 544
  store ptr %56, ptr %57, align 8, !tbaa !23
  br label %88

58:                                               ; preds = %18, %14
  %59 = getelementptr inbounds i8, ptr %0, i64 552
  %60 = load i32, ptr %59, align 8, !tbaa !27
  %61 = icmp sgt i32 %7, %60
  br i1 %61, label %62, label %74

62:                                               ; preds = %58
  %63 = getelementptr inbounds i8, ptr %0, i64 352
  store i32 -1, ptr %63, align 8, !tbaa !26
  %64 = and i32 %16, 512
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %70

66:                                               ; preds = %62
  %67 = getelementptr inbounds i8, ptr %0, i64 608
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = load ptr, ptr %0, align 8, !tbaa !20
  tail call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %68, ptr noundef nonnull @TIFFFillStrip.module, ptr noundef nonnull @.str.4, ptr noundef %69, i64 noundef %5) #2
  br label %90

70:                                               ; preds = %62
  %71 = add nuw i32 %7, 1023
  %72 = and i32 %71, -1024
  %73 = tail call i32 @TIFFReadBufferSetup(ptr noundef nonnull %0, ptr noundef null, i32 noundef %72)
  %.not60 = icmp eq i32 %73, 0
  br i1 %.not60, label %90, label %74

74:                                               ; preds = %70, %58
  %75 = getelementptr inbounds i8, ptr %0, i64 544
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = tail call i32 @TIFFReadRawStrip1(ptr noundef nonnull %0, i32 noundef %1, ptr noundef %76, i32 noundef %7, ptr noundef nonnull @TIFFFillStrip.module)
  %.not61 = icmp eq i32 %77, %7
  br i1 %.not61, label %78, label %90

78:                                               ; preds = %74
  %79 = load i32, ptr %15, align 8, !tbaa !21
  %80 = getelementptr inbounds i8, ptr %0, i64 118
  %81 = load i16, ptr %80, align 2, !tbaa !22
  %82 = or i16 %81, 256
  %83 = zext i16 %82 to i32
  %84 = and i32 %79, %83
  %or.cond66 = icmp eq i32 %84, 0
  br i1 %or.cond66, label %85, label %88

85:                                               ; preds = %78
  %86 = load ptr, ptr %75, align 8, !tbaa !23
  %87 = zext nneg i32 %7 to i64
  tail call void @TIFFReverseBits(ptr noundef %86, i64 noundef %87) #2
  br label %88

88:                                               ; preds = %78, %85, %50
  %89 = tail call i32 @TIFFStartStrip(ptr noundef nonnull %0, i32 noundef %1)
  br label %90

90:                                               ; preds = %74, %70, %88, %66, %41, %9
  %.0 = phi i32 [ 0, %9 ], [ 0, %41 ], [ %89, %88 ], [ 0, %66 ], [ 0, %70 ], [ 0, %74 ]
  ret i32 %.0
}

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

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
declare hidden i32 @TIFFStartStrip(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 352}
!27 = !{!16, !9, i64 552}
!28 = !{!16, !13, i64 576}


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