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

; 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 }
%struct.client_info = type { ptr, ptr, ptr }
%struct.TIFFFieldInfo = type { i32, i16, i16, i32, i16, i8, i8, ptr }

@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @TIFFCleanup(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.tiff, ptr %6, i32 0, i32 2
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %13

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call i32 @TIFFFlush(ptr noundef %11)
  br label %13

13:                                               ; preds = %10, %1
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.tiff, ptr %14, i32 0, i32 37
  %16 = load ptr, ptr %15, align 8, !tbaa !19
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  call void %16(ptr noundef %17)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  call void @TIFFFreeDirectory(ptr noundef %18)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tiff, ptr %19, i32 0, i32 6
  %21 = load ptr, ptr %20, align 8, !tbaa !20
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %27

23:                                               ; preds = %13
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.tiff, ptr %24, i32 0, i32 6
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  call void @_TIFFfree(ptr noundef %26)
  br label %27

27:                                               ; preds = %23, %13
  br label %28

28:                                               ; preds = %33, %27
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.tiff, ptr %29, i32 0, i32 62
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %46

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tiff, ptr %34, i32 0, i32 62
  %36 = load ptr, ptr %35, align 8, !tbaa !21
  store ptr %36, ptr %3, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.client_info, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !22
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.tiff, ptr %40, i32 0, i32 62
  store ptr %39, ptr %41, align 8, !tbaa !21
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.client_info, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !24
  call void @_TIFFfree(ptr noundef %44)
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_TIFFfree(ptr noundef %45)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %28, !llvm.loop !25

46:                                               ; preds = %28
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.tiff, ptr %47, i32 0, i32 43
  %49 = load ptr, ptr %48, align 8, !tbaa !27
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %61

51:                                               ; preds = %46
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.tiff, ptr %52, i32 0, i32 3
  %54 = load i32, ptr %53, align 8, !tbaa !28
  %55 = and i32 %54, 512
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %61

57:                                               ; preds = %51
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tiff, ptr %58, i32 0, i32 43
  %60 = load ptr, ptr %59, align 8, !tbaa !27
  call void @_TIFFfree(ptr noundef %60)
  br label %61

61:                                               ; preds = %57, %51, %46
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.tiff, ptr %62, i32 0, i32 3
  %64 = load i32, ptr %63, align 8, !tbaa !28
  %65 = and i32 %64, 2048
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %80

67:                                               ; preds = %61
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.tiff, ptr %68, i32 0, i32 50
  %70 = load ptr, ptr %69, align 8, !tbaa !29
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.tiff, ptr %71, i32 0, i32 51
  %73 = load ptr, ptr %72, align 8, !tbaa !30
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.tiff, ptr %74, i32 0, i32 47
  %76 = load ptr, ptr %75, align 8, !tbaa !31
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.tiff, ptr %77, i32 0, i32 48
  %79 = load i32, ptr %78, align 8, !tbaa !32
  call void %70(ptr noundef %73, ptr noundef %76, i32 noundef %79)
  br label %80

80:                                               ; preds = %67, %61
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.tiff, ptr %81, i32 0, i32 59
  %83 = load i64, ptr %82, align 8, !tbaa !33
  %84 = icmp ugt i64 %83, 0
  br i1 %84, label %85, label %123

85:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !34
  br label %86

86:                                               ; preds = %116, %85
  %87 = load i64, ptr %4, align 8, !tbaa !34
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.tiff, ptr %88, i32 0, i32 59
  %90 = load i64, ptr %89, align 8, !tbaa !33
  %91 = icmp ult i64 %87, %90
  br i1 %91, label %92, label %119

92:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.tiff, ptr %93, i32 0, i32 58
  %95 = load ptr, ptr %94, align 8, !tbaa !35
  %96 = load i64, ptr %4, align 8, !tbaa !34
  %97 = getelementptr inbounds ptr, ptr %95, i64 %96
  %98 = load ptr, ptr %97, align 8, !tbaa !5
  store ptr %98, ptr %5, align 8, !tbaa !5
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.TIFFFieldInfo, ptr %99, i32 0, i32 4
  %101 = load i16, ptr %100, align 4, !tbaa !36
  %102 = zext i16 %101 to i32
  %103 = icmp eq i32 %102, 65
  br i1 %103, label %104, label %115

104:                                              ; preds = %92
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.TIFFFieldInfo, ptr %105, i32 0, i32 7
  %107 = load ptr, ptr %106, align 8, !tbaa !38
  %108 = call i32 @strncmp(ptr noundef @.str, ptr noundef %107, i64 noundef 4) #5
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %115

110:                                              ; preds = %104
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.TIFFFieldInfo, ptr %111, i32 0, i32 7
  %113 = load ptr, ptr %112, align 8, !tbaa !38
  call void @_TIFFfree(ptr noundef %113)
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_TIFFfree(ptr noundef %114)
  br label %115

115:                                              ; preds = %110, %104, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %116

116:                                              ; preds = %115
  %117 = load i64, ptr %4, align 8, !tbaa !34
  %118 = add i64 %117, 1
  store i64 %118, ptr %4, align 8, !tbaa !34
  br label %86, !llvm.loop !39

119:                                              ; preds = %86
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.tiff, ptr %120, i32 0, i32 58
  %122 = load ptr, ptr %121, align 8, !tbaa !35
  call void @_TIFFfree(ptr noundef %122)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %123

123:                                              ; preds = %119, %80
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_TIFFfree(ptr noundef %124)
  ret void
}

declare i32 @TIFFFlush(ptr noundef) #1

declare void @TIFFFreeDirectory(ptr noundef) #1

declare void @_TIFFfree(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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(read) "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 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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, !11, i64 12}
!10 = !{!"tiff", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !6, i64 32, !12, i64 40, !13, i64 48, !16, i64 320, !6, i64 328, !6, i64 336, !11, i64 344, !12, i64 348, !11, i64 352, !11, i64 356, !11, i64 360, !12, i64 364, !11, i64 368, !11, i64 372, !11, i64 376, !11, i64 380, !11, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !11, 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, !11, i64 536, !11, i64 540, !6, i64 544, !11, i64 552, !6, i64 560, !11, i64 568, !6, i64 576, !11, 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, !17, i64 672, !6, i64 680, !18, i64 688, !6, i64 712}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"", !7, i64 0, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 60, !12, i64 62, !12, i64 64, !12, i64 66, !12, i64 68, !12, i64 70, !12, i64 72, !12, i64 74, !11, i64 76, !12, i64 80, !12, i64 82, !14, i64 88, !14, i64 96, !15, i64 104, !15, i64 108, !12, i64 112, !12, i64 114, !15, i64 116, !15, i64 120, !7, i64 124, !7, i64 128, !7, i64 152, !12, i64 156, !6, i64 160, !11, i64 168, !11, i64 172, !6, i64 176, !6, i64 184, !11, i64 192, !12, i64 196, !6, i64 200, !7, i64 208, !12, i64 212, !7, i64 216, !11, i64 240, !6, i64 248, !11, i64 256, !6, i64 264}
!14 = !{!"double", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"", !12, i64 0, !12, i64 2, !11, i64 4}
!17 = !{!"long", !7, i64 0}
!18 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!10, !6, i64 504}
!20 = !{!10, !6, i64 32}
!21 = !{!10, !6, i64 712}
!22 = !{!23, !6, i64 0}
!23 = !{!"client_info", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!23, !6, i64 16}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!10, !6, i64 544}
!28 = !{!10, !11, i64 16}
!29 = !{!10, !6, i64 600}
!30 = !{!10, !6, i64 608}
!31 = !{!10, !6, i64 576}
!32 = !{!10, !11, i64 584}
!33 = !{!10, !17, i64 672}
!34 = !{!17, !17, i64 0}
!35 = !{!10, !6, i64 664}
!36 = !{!37, !12, i64 12}
!37 = !{!"", !11, i64 0, !12, i64 4, !12, i64 6, !11, i64 8, !12, i64 12, !7, i64 14, !7, i64 15, !6, i64 16}
!38 = !{!37, !6, i64 16}
!39 = distinct !{!39, !26}


; 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 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @TIFFCleanup(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %6, label %4

4:                                                ; preds = %1
  %5 = tail call i32 @TIFFFlush(ptr noundef nonnull %0) #3
  br label %6

6:                                                ; preds = %4, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 504
  %8 = load ptr, ptr %7, align 8, !tbaa !18
  tail call void %8(ptr noundef nonnull %0) #3
  tail call void @TIFFFreeDirectory(ptr noundef nonnull %0) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !19
  %.not35 = icmp eq ptr %10, null
  br i1 %.not35, label %12, label %11

11:                                               ; preds = %6
  tail call void @_TIFFfree(ptr noundef nonnull %10) #3
  br label %12

12:                                               ; preds = %11, %6
  %13 = getelementptr inbounds i8, ptr %0, i64 712
  %14 = load ptr, ptr %13, align 8, !tbaa !20
  %.not3641 = icmp eq ptr %14, null
  br i1 %.not3641, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12, %.lr.ph
  %15 = phi ptr [ %19, %.lr.ph ], [ %14, %12 ]
  %16 = load ptr, ptr %15, align 8, !tbaa !21
  store ptr %16, ptr %13, align 8, !tbaa !20
  %17 = getelementptr inbounds i8, ptr %15, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  tail call void @_TIFFfree(ptr noundef %18) #3
  tail call void @_TIFFfree(ptr noundef nonnull %15) #3
  %19 = load ptr, ptr %13, align 8, !tbaa !20
  %.not36 = icmp eq ptr %19, null
  br i1 %.not36, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph, %12
  %20 = getelementptr inbounds i8, ptr %0, i64 544
  %21 = load ptr, ptr %20, align 8, !tbaa !26
  %.not37 = icmp eq ptr %21, null
  br i1 %.not37, label %27, label %22

22:                                               ; preds = %._crit_edge
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load i32, ptr %23, align 8, !tbaa !27
  %25 = and i32 %24, 512
  %.not38 = icmp eq i32 %25, 0
  br i1 %.not38, label %27, label %26

26:                                               ; preds = %22
  tail call void @_TIFFfree(ptr noundef nonnull %21) #3
  br label %27

27:                                               ; preds = %26, %22, %._crit_edge
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load i32, ptr %28, align 8, !tbaa !27
  %30 = and i32 %29, 2048
  %.not39 = icmp eq i32 %30, 0
  br i1 %.not39, label %40, label %31

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %0, i64 600
  %33 = load ptr, ptr %32, align 8, !tbaa !28
  %34 = getelementptr inbounds i8, ptr %0, i64 608
  %35 = load ptr, ptr %34, align 8, !tbaa !29
  %36 = getelementptr inbounds i8, ptr %0, i64 576
  %37 = load ptr, ptr %36, align 8, !tbaa !30
  %38 = getelementptr inbounds i8, ptr %0, i64 584
  %39 = load i32, ptr %38, align 8, !tbaa !31
  tail call void %33(ptr noundef %35, ptr noundef %37, i32 noundef %39) #3
  br label %40

40:                                               ; preds = %31, %27
  %41 = getelementptr inbounds i8, ptr %0, i64 672
  %42 = load i64, ptr %41, align 8, !tbaa !32
  %.not40 = icmp eq i64 %42, 0
  br i1 %.not40, label %64, label %.lr.ph43

.lr.ph43:                                         ; preds = %40
  %43 = getelementptr inbounds i8, ptr %0, i64 664
  br label %44

44:                                               ; preds = %.lr.ph43, %58
  %45 = phi i64 [ %42, %.lr.ph43 ], [ %59, %58 ]
  %.042 = phi i64 [ 0, %.lr.ph43 ], [ %60, %58 ]
  %46 = load ptr, ptr %43, align 8, !tbaa !33
  %47 = getelementptr inbounds ptr, ptr %46, i64 %.042
  %48 = load ptr, ptr %47, align 8, !tbaa !34
  %49 = getelementptr inbounds i8, ptr %48, i64 12
  %50 = load i16, ptr %49, align 4, !tbaa !35
  %51 = icmp eq i16 %50, 65
  br i1 %51, label %52, label %58

52:                                               ; preds = %44
  %53 = getelementptr inbounds i8, ptr %48, i64 16
  %54 = load ptr, ptr %53, align 8, !tbaa !37
  %55 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull dereferenceable(1) %54, i64 noundef 4) #4
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %52
  tail call void @_TIFFfree(ptr noundef %54) #3
  tail call void @_TIFFfree(ptr noundef nonnull %48) #3
  %.pre = load i64, ptr %41, align 8, !tbaa !32
  br label %58

58:                                               ; preds = %57, %52, %44
  %59 = phi i64 [ %.pre, %57 ], [ %45, %52 ], [ %45, %44 ]
  %60 = add nuw i64 %.042, 1
  %61 = icmp ult i64 %60, %59
  br i1 %61, label %44, label %._crit_edge44, !llvm.loop !38

._crit_edge44:                                    ; preds = %58
  %62 = getelementptr inbounds i8, ptr %0, i64 664
  %63 = load ptr, ptr %62, align 8, !tbaa !33
  tail call void @_TIFFfree(ptr noundef %63) #3
  br label %64

64:                                               ; preds = %._crit_edge44, %40
  tail call void @_TIFFfree(ptr noundef nonnull %0) #3
  ret void
}

declare i32 @TIFFFlush(ptr noundef) local_unnamed_addr #1

declare void @TIFFFreeDirectory(ptr noundef) local_unnamed_addr #1

declare void @_TIFFfree(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #2

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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 }
attributes #4 = { nounwind willreturn memory(read) }

!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 12}
!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 = !{!6, !7, i64 504}
!19 = !{!6, !7, i64 32}
!20 = !{!6, !7, i64 712}
!21 = !{!22, !7, i64 0}
!22 = !{!"client_info", !7, i64 0, !7, i64 8, !7, i64 16}
!23 = !{!22, !7, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !7, i64 544}
!27 = !{!6, !10, i64 16}
!28 = !{!6, !7, i64 600}
!29 = !{!6, !7, i64 608}
!30 = !{!6, !7, i64 576}
!31 = !{!6, !10, i64 584}
!32 = !{!6, !16, i64 672}
!33 = !{!6, !7, i64 664}
!34 = !{!7, !7, i64 0}
!35 = !{!36, !11, i64 12}
!36 = !{!"", !10, i64 0, !11, i64 4, !11, i64 6, !10, i64 8, !11, i64 12, !8, i64 14, !8, i64 15, !7, i64 16}
!37 = !{!36, !7, i64 16}
!38 = distinct !{!38, !25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass