; LLVM IR from mkazhdan/DMG :: Util/TIFF (tif_write)

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

@TIFFWriteEncodedStrip.module = external hidden constant [22 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [56 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: nounwind uwtable
declare dso_local i32 @TIFFWriteCheck(ptr noundef, i32 noundef, ptr noundef) #1

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

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

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

; 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
define dso_local i32 @TIFFWriteEncodedStrip(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i16, align 2
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.tiff, ptr %13, i32 0, i32 8
  store ptr %14, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tiff, ptr %15, i32 0, i32 3
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = and i32 %17, 64
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %25, label %20

20:                                               ; preds = %4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call i32 @TIFFWriteCheck(ptr noundef %21, i32 noundef 0, ptr noundef @TIFFWriteEncodedStrip.module)
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

25:                                               ; preds = %20, %4
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.TIFFDirectory, ptr %27, i32 0, i32 33
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = icmp uge i32 %26, %29
  br i1 %30, label %31, label %64

31:                                               ; preds = %25
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.TIFFDirectory, ptr %32, i32 0, i32 24
  %34 = load i16, ptr %33, align 2, !tbaa !21
  %35 = zext i16 %34 to i32
  %36 = icmp eq i32 %35, 2
  br i1 %36, label %37, label %44

37:                                               ; preds = %31
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tiff, ptr %38, i32 0, i32 51
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tiff, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !23
  call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %40, ptr noundef %43, ptr noundef @.str.2)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

44:                                               ; preds = %31
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call i32 @TIFFGrowStrips(ptr noundef %45, i32 noundef 1, ptr noundef @TIFFWriteEncodedStrip.module)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

49:                                               ; preds = %44
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.TIFFDirectory, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !24
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.TIFFDirectory, ptr %53, i32 0, i32 16
  %55 = load i32, ptr %54, align 4, !tbaa !25
  %56 = sub i32 %55, 1
  %57 = add i32 %52, %56
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.TIFFDirectory, ptr %58, i32 0, i32 16
  %60 = load i32, ptr %59, align 4, !tbaa !25
  %61 = udiv i32 %57, %60
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.TIFFDirectory, ptr %62, i32 0, i32 32
  store i32 %61, ptr %63, align 8, !tbaa !26
  br label %64

64:                                               ; preds = %49, %25
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.tiff, ptr %65, i32 0, i32 3
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = and i32 %67, 16
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %75

70:                                               ; preds = %64
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.tiff, ptr %71, i32 0, i32 43
  %73 = load ptr, ptr %72, align 8, !tbaa !27
  %74 = icmp ne ptr %73, null
  br i1 %74, label %80, label %75

75:                                               ; preds = %70, %64
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = call i32 @TIFFWriteBufferSetup(ptr noundef %76, ptr noundef null, i32 noundef -1)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

80:                                               ; preds = %75, %70
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.tiff, ptr %82, i32 0, i32 14
  store i32 %81, ptr %83, align 8, !tbaa !28
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.TIFFDirectory, ptr %85, i32 0, i32 32
  %87 = load i32, ptr %86, align 8, !tbaa !26
  %88 = urem i32 %84, %87
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.TIFFDirectory, ptr %89, i32 0, i32 16
  %91 = load i32, ptr %90, align 4, !tbaa !25
  %92 = mul i32 %88, %91
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.tiff, ptr %93, i32 0, i32 12
  store i32 %92, ptr %94, align 8, !tbaa !29
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.tiff, ptr %95, i32 0, i32 3
  %97 = load i32, ptr %96, align 8, !tbaa !11
  %98 = and i32 %97, 32
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %113

100:                                              ; preds = %80
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.tiff, ptr %101, i32 0, i32 25
  %103 = load ptr, ptr %102, align 8, !tbaa !30
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = call i32 %103(ptr noundef %104)
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %108, label %107

107:                                              ; preds = %100
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

108:                                              ; preds = %100
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.tiff, ptr %109, i32 0, i32 3
  %111 = load i32, ptr %110, align 8, !tbaa !11
  %112 = or i32 %111, 32
  store i32 %112, ptr %110, align 8, !tbaa !11
  br label %113

113:                                              ; preds = %108, %80
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.tiff, ptr %114, i32 0, i32 46
  store i32 0, ptr %115, align 8, !tbaa !31
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tiff, ptr %116, i32 0, i32 43
  %118 = load ptr, ptr %117, align 8, !tbaa !27
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.tiff, ptr %119, i32 0, i32 45
  store ptr %118, ptr %120, align 8, !tbaa !32
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TIFFDirectory, ptr %121, i32 0, i32 35
  %123 = load ptr, ptr %122, align 8, !tbaa !33
  %124 = load i32, ptr %7, align 4, !tbaa !9
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds i32, ptr %123, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = icmp ugt i32 %127, 0
  br i1 %128, label %129, label %138

129:                                              ; preds = %113
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.TIFFDirectory, ptr %130, i32 0, i32 35
  %132 = load ptr, ptr %131, align 8, !tbaa !33
  %133 = load i32, ptr %7, align 4, !tbaa !9
  %134 = zext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr %132, i64 %134
  store i32 0, ptr %135, align 4, !tbaa !9
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.tiff, ptr %136, i32 0, i32 15
  store i32 0, ptr %137, align 4, !tbaa !34
  br label %138

138:                                              ; preds = %129, %113
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.tiff, ptr %139, i32 0, i32 3
  %141 = load i32, ptr %140, align 8, !tbaa !11
  %142 = and i32 %141, -4097
  store i32 %142, ptr %140, align 8, !tbaa !11
  %143 = load i32, ptr %7, align 4, !tbaa !9
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.TIFFDirectory, ptr %144, i32 0, i32 32
  %146 = load i32, ptr %145, align 8, !tbaa !26
  %147 = udiv i32 %143, %146
  %148 = trunc i32 %147 to i16
  store i16 %148, ptr %11, align 2, !tbaa !35
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.tiff, ptr %149, i32 0, i32 27
  %151 = load ptr, ptr %150, align 8, !tbaa !36
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load i16, ptr %11, align 2, !tbaa !35
  %154 = call i32 %151(ptr noundef %152, i16 noundef zeroext %153)
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %157, label %156

156:                                              ; preds = %138
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

157:                                              ; preds = %138
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.tiff, ptr %158, i32 0, i32 57
  %160 = load ptr, ptr %159, align 8, !tbaa !37
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = load ptr, ptr %8, align 8, !tbaa !5
  %163 = load i32, ptr %9, align 4, !tbaa !9
  call void %160(ptr noundef %161, ptr noundef %162, i32 noundef %163)
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.tiff, ptr %164, i32 0, i32 32
  %166 = load ptr, ptr %165, align 8, !tbaa !38
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = load ptr, ptr %8, align 8, !tbaa !5
  %169 = load i32, ptr %9, align 4, !tbaa !9
  %170 = load i16, ptr %11, align 2, !tbaa !35
  %171 = call i32 %166(ptr noundef %167, ptr noundef %168, i32 noundef %169, i16 noundef zeroext %170)
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %174, label %173

173:                                              ; preds = %157
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

174:                                              ; preds = %157
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.tiff, ptr %175, i32 0, i32 28
  %177 = load ptr, ptr %176, align 8, !tbaa !39
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = call i32 %177(ptr noundef %178)
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %182, label %181

181:                                              ; preds = %174
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

182:                                              ; preds = %174
  %183 = load ptr, ptr %6, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.tiff, ptr %183, i32 0, i32 3
  %185 = load i32, ptr %184, align 8, !tbaa !11
  %186 = load ptr, ptr %10, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.TIFFDirectory, ptr %186, i32 0, i32 13
  %188 = load i16, ptr %187, align 2, !tbaa !40
  %189 = zext i16 %188 to i32
  %190 = and i32 %185, %189
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %206, label %192

192:                                              ; preds = %182
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.tiff, ptr %193, i32 0, i32 3
  %195 = load i32, ptr %194, align 8, !tbaa !11
  %196 = and i32 %195, 256
  %197 = icmp eq i32 %196, 0
  br i1 %197, label %198, label %206

198:                                              ; preds = %192
  %199 = load ptr, ptr %6, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.tiff, ptr %199, i32 0, i32 43
  %201 = load ptr, ptr %200, align 8, !tbaa !27
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.tiff, ptr %202, i32 0, i32 46
  %204 = load i32, ptr %203, align 8, !tbaa !31
  %205 = sext i32 %204 to i64
  call void @TIFFReverseBits(ptr noundef %201, i64 noundef %205)
  br label %206

206:                                              ; preds = %198, %192, %182
  %207 = load ptr, ptr %6, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.tiff, ptr %207, i32 0, i32 46
  %209 = load i32, ptr %208, align 8, !tbaa !31
  %210 = icmp sgt i32 %209, 0
  br i1 %210, label %211, label %223

211:                                              ; preds = %206
  %212 = load ptr, ptr %6, align 8, !tbaa !5
  %213 = load i32, ptr %7, align 4, !tbaa !9
  %214 = load ptr, ptr %6, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.tiff, ptr %214, i32 0, i32 43
  %216 = load ptr, ptr %215, align 8, !tbaa !27
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.tiff, ptr %217, i32 0, i32 46
  %219 = load i32, ptr %218, align 8, !tbaa !31
  %220 = call i32 @TIFFAppendToStrip(ptr noundef %212, i32 noundef %213, ptr noundef %216, i32 noundef %219)
  %221 = icmp ne i32 %220, 0
  br i1 %221, label %223, label %222

222:                                              ; preds = %211
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

223:                                              ; preds = %211, %206
  %224 = load ptr, ptr %6, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.tiff, ptr %224, i32 0, i32 46
  store i32 0, ptr %225, align 8, !tbaa !31
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.tiff, ptr %226, i32 0, i32 43
  %228 = load ptr, ptr %227, align 8, !tbaa !27
  %229 = load ptr, ptr %6, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.tiff, ptr %229, i32 0, i32 45
  store ptr %228, ptr %230, align 8, !tbaa !32
  %231 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %231, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %232

232:                                              ; preds = %223, %222, %181, %173, %156, %107, %79, %48, %37, %24
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %233 = load i32, ptr %5, align 4
  ret i32 %233
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @TIFFAppendToStrip(ptr noundef, i32 noundef, ptr noundef, i32 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 = { "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, !10, i64 16}
!12 = !{!"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, !14, i64 48, !17, 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, !18, i64 672, !6, i64 680, !19, i64 688, !6, i64 712}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !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, !15, i64 88, !15, i64 96, !16, i64 104, !16, i64 108, !13, i64 112, !13, i64 114, !16, i64 116, !16, 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}
!15 = !{!"double", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"", !13, i64 0, !13, i64 2, !10, i64 4}
!18 = !{!"long", !7, i64 0}
!19 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!14, !10, i64 172}
!21 = !{!14, !13, i64 114}
!22 = !{!12, !6, i64 608}
!23 = !{!12, !6, i64 0}
!24 = !{!14, !10, i64 36}
!25 = !{!14, !10, i64 76}
!26 = !{!14, !10, i64 168}
!27 = !{!12, !6, i64 544}
!28 = !{!12, !10, i64 352}
!29 = !{!12, !10, i64 344}
!30 = !{!12, !6, i64 408}
!31 = !{!12, !10, i64 568}
!32 = !{!12, !6, i64 560}
!33 = !{!14, !6, i64 184}
!34 = !{!12, !10, i64 356}
!35 = !{!13, !13, i64 0}
!36 = !{!12, !6, i64 424}
!37 = !{!12, !6, i64 656}
!38 = !{!12, !6, i64 464}
!39 = !{!12, !6, i64 432}
!40 = !{!14, !13, i64 70}


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

@TIFFWriteEncodedStrip.module = external hidden constant [22 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [56 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @TIFFWriteEncodedStrip(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = and i32 %6, 64
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %10

8:                                                ; preds = %4
  %9 = tail call i32 @TIFFWriteCheck(ptr noundef nonnull %0, i32 noundef 0, ptr noundef nonnull @TIFFWriteEncodedStrip.module)
  %.not66 = icmp eq i32 %9, 0
  br i1 %.not66, label %110, label %10

10:                                               ; preds = %8, %4
  %11 = getelementptr inbounds i8, ptr %0, i64 220
  %12 = load i32, ptr %11, align 4, !tbaa !18
  %.not67 = icmp ugt i32 %12, %1
  br i1 %.not67, label %32, label %13

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 162
  %15 = load i16, ptr %14, align 2, !tbaa !19
  %16 = icmp eq i16 %15, 2
  br i1 %16, label %17, label %21

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 608
  %19 = load ptr, ptr %18, align 8, !tbaa !20
  %20 = load ptr, ptr %0, align 8, !tbaa !21
  tail call void (ptr, ptr, ptr, ...) @TIFFErrorExt(ptr noundef %19, ptr noundef %20, ptr noundef nonnull @.str.2) #2
  br label %110

21:                                               ; preds = %13
  %22 = tail call i32 @TIFFGrowStrips(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @TIFFWriteEncodedStrip.module)
  %.not68 = icmp eq i32 %22, 0
  br i1 %.not68, label %110, label %23

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %0, i64 84
  %25 = load i32, ptr %24, align 4, !tbaa !22
  %26 = getelementptr inbounds i8, ptr %0, i64 124
  %27 = load i32, ptr %26, align 4, !tbaa !23
  %28 = add i32 %25, -1
  %29 = add i32 %28, %27
  %30 = udiv i32 %29, %27
  %31 = getelementptr inbounds i8, ptr %0, i64 216
  store i32 %30, ptr %31, align 8, !tbaa !24
  br label %32

32:                                               ; preds = %23, %10
  %33 = load i32, ptr %5, align 8, !tbaa !5
  %34 = and i32 %33, 16
  %.not69 = icmp eq i32 %34, 0
  br i1 %.not69, label %38, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %0, i64 544
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %.not70 = icmp eq ptr %37, null
  br i1 %.not70, label %38, label %40

38:                                               ; preds = %35, %32
  %39 = tail call i32 @TIFFWriteBufferSetup(ptr noundef nonnull %0, ptr noundef null, i32 noundef -1)
  %.not71 = icmp eq i32 %39, 0
  br i1 %.not71, label %110, label %._crit_edge

._crit_edge:                                      ; preds = %38
  %.pre = load i32, ptr %5, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %._crit_edge, %35
  %41 = phi i32 [ %.pre, %._crit_edge ], [ %33, %35 ]
  %42 = getelementptr inbounds i8, ptr %0, i64 352
  store i32 %1, ptr %42, align 8, !tbaa !26
  %43 = getelementptr inbounds i8, ptr %0, i64 216
  %44 = load i32, ptr %43, align 8, !tbaa !24
  %45 = urem i32 %1, %44
  %46 = getelementptr inbounds i8, ptr %0, i64 124
  %47 = load i32, ptr %46, align 4, !tbaa !23
  %48 = mul i32 %47, %45
  %49 = getelementptr inbounds i8, ptr %0, i64 344
  store i32 %48, ptr %49, align 8, !tbaa !27
  %50 = and i32 %41, 32
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %59

52:                                               ; preds = %40
  %53 = getelementptr inbounds i8, ptr %0, i64 408
  %54 = load ptr, ptr %53, align 8, !tbaa !28
  %55 = tail call i32 %54(ptr noundef nonnull %0) #2
  %.not72 = icmp eq i32 %55, 0
  br i1 %.not72, label %110, label %56

56:                                               ; preds = %52
  %57 = load i32, ptr %5, align 8, !tbaa !5
  %58 = or i32 %57, 32
  store i32 %58, ptr %5, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %56, %40
  %60 = phi i32 [ %58, %56 ], [ %41, %40 ]
  %61 = getelementptr inbounds i8, ptr %0, i64 568
  store i32 0, ptr %61, align 8, !tbaa !29
  %62 = getelementptr inbounds i8, ptr %0, i64 544
  %63 = load ptr, ptr %62, align 8, !tbaa !25
  %64 = getelementptr inbounds i8, ptr %0, i64 560
  store ptr %63, ptr %64, align 8, !tbaa !30
  %65 = getelementptr inbounds i8, ptr %0, i64 232
  %66 = load ptr, ptr %65, align 8, !tbaa !31
  %67 = zext i32 %1 to i64
  %68 = getelementptr inbounds i32, ptr %66, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !32
  %.not73 = icmp eq i32 %69, 0
  br i1 %.not73, label %72, label %70

70:                                               ; preds = %59
  store i32 0, ptr %68, align 4, !tbaa !32
  %71 = getelementptr inbounds i8, ptr %0, i64 356
  store i32 0, ptr %71, align 4, !tbaa !33
  %.pre80 = load i32, ptr %5, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %70, %59
  %73 = phi i32 [ %.pre80, %70 ], [ %60, %59 ]
  %74 = and i32 %73, -4097
  store i32 %74, ptr %5, align 8, !tbaa !5
  %75 = load i32, ptr %43, align 8, !tbaa !24
  %76 = udiv i32 %1, %75
  %77 = trunc i32 %76 to i16
  %78 = getelementptr inbounds i8, ptr %0, i64 424
  %79 = load ptr, ptr %78, align 8, !tbaa !34
  %80 = tail call i32 %79(ptr noundef nonnull %0, i16 noundef zeroext %77) #2
  %.not74 = icmp eq i32 %80, 0
  br i1 %.not74, label %110, label %81

81:                                               ; preds = %72
  %82 = getelementptr inbounds i8, ptr %0, i64 656
  %83 = load ptr, ptr %82, align 8, !tbaa !35
  tail call void %83(ptr noundef nonnull %0, ptr noundef %2, i32 noundef %3) #2
  %84 = getelementptr inbounds i8, ptr %0, i64 464
  %85 = load ptr, ptr %84, align 8, !tbaa !36
  %86 = tail call i32 %85(ptr noundef nonnull %0, ptr noundef %2, i32 noundef %3, i16 noundef zeroext %77) #2
  %.not75 = icmp eq i32 %86, 0
  br i1 %.not75, label %110, label %87

87:                                               ; preds = %81
  %88 = getelementptr inbounds i8, ptr %0, i64 432
  %89 = load ptr, ptr %88, align 8, !tbaa !37
  %90 = tail call i32 %89(ptr noundef nonnull %0) #2
  %.not76 = icmp eq i32 %90, 0
  br i1 %.not76, label %110, label %91

91:                                               ; preds = %87
  %92 = load i32, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %0, i64 118
  %94 = load i16, ptr %93, align 2, !tbaa !38
  %95 = or i16 %94, 256
  %96 = zext i16 %95 to i32
  %97 = and i32 %92, %96
  %or.cond = icmp eq i32 %97, 0
  br i1 %or.cond, label %98, label %102

98:                                               ; preds = %91
  %99 = load ptr, ptr %62, align 8, !tbaa !25
  %100 = load i32, ptr %61, align 8, !tbaa !29
  %101 = sext i32 %100 to i64
  tail call void @TIFFReverseBits(ptr noundef %99, i64 noundef %101) #2
  br label %102

102:                                              ; preds = %98, %91
  %103 = load i32, ptr %61, align 8, !tbaa !29
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %105, label %108

105:                                              ; preds = %102
  %106 = load ptr, ptr %62, align 8, !tbaa !25
  %107 = tail call i32 @TIFFAppendToStrip(ptr noundef nonnull %0, i32 noundef %1, ptr noundef %106, i32 noundef %103)
  %.not78 = icmp eq i32 %107, 0
  br i1 %.not78, label %110, label %108

108:                                              ; preds = %105, %102
  store i32 0, ptr %61, align 8, !tbaa !29
  %109 = load ptr, ptr %62, align 8, !tbaa !25
  store ptr %109, ptr %64, align 8, !tbaa !30
  br label %110

110:                                              ; preds = %105, %87, %81, %72, %52, %38, %21, %8, %108, %17
  %.0 = phi i32 [ -1, %17 ], [ %3, %108 ], [ -1, %8 ], [ -1, %21 ], [ -1, %38 ], [ -1, %52 ], [ -1, %72 ], [ 0, %81 ], [ -1, %87 ], [ -1, %105 ]
  ret i32 %.0
}

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

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

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


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