; LLVM IR from mkazhdan/DMG :: Util/PNG (pngset)

; 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.png_info_struct = type { i64, i64, i64, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], float, i8, i32, i32, ptr, %struct.png_time_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, %struct.png_color_16_struct, i64, i64, i8, i64, i64, i8, ptr, float, float, float, float, float, float, float, float, ptr, i64, i64, ptr, ptr, i8, i8, i64, ptr, i64, ptr, ptr, i64, i8, ptr, i64, i8, double, double, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i64, i64, i64, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i64, i64, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i64, i64, i32, float, float, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, i8, i16, i16, i16, i64, i64, i8, i8, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i64, i64, %struct.png_unknown_chunk_t, i64, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_row_info_struct = type { i64, i64, i8, i8, i8, i8 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

declare void @png_warning(ptr noundef, ptr noundef) #1

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

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

declare void @png_free_data(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @png_set_tRNS(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %17, label %14

14:                                               ; preds = %5
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %14, %5
  br label %117

18:                                               ; preds = %14
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free_data(ptr noundef %19, ptr noundef %20, i64 noundef 8192, i32 noundef 0)
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %43

23:                                               ; preds = %18
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call ptr @png_malloc(ptr noundef %24, i64 noundef 256)
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.png_info_struct, ptr %26, i32 0, i32 23
  store ptr %25, ptr %27, align 8, !tbaa !11
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 75
  store ptr %25, ptr %29, align 8, !tbaa !20
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %32, label %42

32:                                               ; preds = %23
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = icmp sle i32 %33, 256
  br i1 %34, label %35, label %42

35:                                               ; preds = %32
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.png_info_struct, ptr %36, i32 0, i32 23
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %38, ptr align 1 %39, i64 %41, i1 false)
  br label %42

42:                                               ; preds = %35, %32, %23
  br label %43

43:                                               ; preds = %42, %18
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %101

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_info_struct, ptr %47, i32 0, i32 7
  %49 = load i8, ptr %48, align 4, !tbaa !25
  %50 = zext i8 %49 to i32
  %51 = shl i32 1, %50
  store i32 %51, ptr %11, align 4, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.png_info_struct, ptr %52, i32 0, i32 8
  %54 = load i8, ptr %53, align 1, !tbaa !26
  %55 = zext i8 %54 to i32
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %64

57:                                               ; preds = %46
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.png_color_16_struct, ptr %58, i32 0, i32 4
  %60 = load i16, ptr %59, align 2, !tbaa !27
  %61 = zext i16 %60 to i32
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = icmp sgt i32 %61, %62
  br i1 %63, label %91, label %64

64:                                               ; preds = %57, %46
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_info_struct, ptr %65, i32 0, i32 8
  %67 = load i8, ptr %66, align 1, !tbaa !26
  %68 = zext i8 %67 to i32
  %69 = icmp eq i32 %68, 2
  br i1 %69, label %70, label %93

70:                                               ; preds = %64
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.png_color_16_struct, ptr %71, i32 0, i32 1
  %73 = load i16, ptr %72, align 2, !tbaa !28
  %74 = zext i16 %73 to i32
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = icmp sgt i32 %74, %75
  br i1 %76, label %91, label %77

77:                                               ; preds = %70
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.png_color_16_struct, ptr %78, i32 0, i32 2
  %80 = load i16, ptr %79, align 2, !tbaa !29
  %81 = zext i16 %80 to i32
  %82 = load i32, ptr %11, align 4, !tbaa !9
  %83 = icmp sgt i32 %81, %82
  br i1 %83, label %91, label %84

84:                                               ; preds = %77
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.png_color_16_struct, ptr %85, i32 0, i32 3
  %87 = load i16, ptr %86, align 2, !tbaa !30
  %88 = zext i16 %87 to i32
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = icmp sgt i32 %88, %89
  br i1 %90, label %91, label %93

91:                                               ; preds = %84, %77, %70, %57
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %92, ptr noundef @.str.29)
  br label %93

93:                                               ; preds = %91, %84, %64
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.png_info_struct, ptr %94, i32 0, i32 24
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %95, ptr align 2 %96, i64 10, i1 false)
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %93
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %99, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %101

101:                                              ; preds = %100, %43
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = trunc i32 %102 to i16
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_info_struct, ptr %104, i32 0, i32 6
  store i16 %103, ptr %105, align 2, !tbaa !31
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %117

108:                                              ; preds = %101
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.png_info_struct, ptr %109, i32 0, i32 2
  %111 = load i64, ptr %110, align 8, !tbaa !32
  %112 = or i64 %111, 16
  store i64 %112, ptr %110, align 8, !tbaa !32
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.png_info_struct, ptr %113, i32 0, i32 48
  %115 = load i64, ptr %114, align 8, !tbaa !33
  %116 = or i64 %115, 8192
  store i64 %116, ptr %114, align 8, !tbaa !33
  br label %117

117:                                              ; preds = %108, %101, %17
  ret void
}

attributes #0 = { nocallback nofree 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 104}
!12 = !{!"png_info_struct", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !6, i64 32, !14, i64 40, !14, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52, !15, i64 60, !7, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !16, i64 88, !17, i64 96, !6, i64 104, !18, i64 112, !18, i64 122, !13, i64 136, !13, i64 144, !7, i64 152, !13, i64 160, !13, i64 168, !7, i64 176, !6, i64 184, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !6, i64 224, !13, i64 232, !13, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 265, !13, i64 272, !6, i64 280, !13, i64 288, !6, i64 296, !6, i64 304, !13, i64 312, !7, i64 320, !6, i64 328, !13, i64 336, !7, i64 344, !19, i64 352, !19, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !13, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!19 = !{!"double", !7, i64 0}
!20 = !{!21, !6, i64 776}
!21 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !7, i64 272, !7, i64 273, !13, i64 280, !13, i64 288, !13, i64 296, !22, i64 304, !6, i64 416, !13, i64 424, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, 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, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !23, i64 568, !13, i64 592, !13, i64 600, !6, i64 608, !14, i64 616, !14, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !14, i64 638, !7, i64 640, !15, i64 644, !18, i64 648, !18, i64 658, !6, i64 672, !13, i64 680, !13, i64 688, !10, i64 696, !15, i64 700, !15, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !17, i64 760, !17, i64 765, !6, i64 776, !18, i64 784, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !13, i64 872, !13, i64 880, !13, i64 888, !13, i64 896, !13, i64 904, !13, i64 912, !10, i64 920, !10, i64 924, !13, i64 928, !13, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !7, i64 984, !7, i64 985, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !13, i64 1040, !6, i64 1048, !6, i64 1056, !10, i64 1064, !6, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !13, i64 1088, !13, i64 1096, !7, i64 1104, !7, i64 1105, !13, i64 1112, !13, i64 1120, !6, i64 1128, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !6, i64 1168, !6, i64 1176, !7, i64 1184, !13, i64 1192, !13, i64 1200, !24, i64 1208, !13, i64 1240, !13, i64 1248}
!22 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24, !10, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !13, i64 96, !13, i64 104}
!23 = !{!"png_row_info_struct", !13, i64 0, !13, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!24 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!25 = !{!12, !7, i64 44}
!26 = !{!12, !7, i64 45}
!27 = !{!18, !14, i64 8}
!28 = !{!18, !14, i64 2}
!29 = !{!18, !14, i64 4}
!30 = !{!18, !14, i64 6}
!31 = !{!12, !14, i64 42}
!32 = !{!12, !13, i64 16}
!33 = !{!12, !13, i64 272}


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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

declare void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @png_malloc(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @png_set_tRNS(ptr noundef %0, ptr noundef %1, ptr noundef readonly %2, i32 noundef %3, ptr noundef readonly %4) local_unnamed_addr #2 {
  %6 = icmp eq ptr %0, null
  %7 = icmp eq ptr %1, null
  %or.cond = or i1 %6, %7
  br i1 %or.cond, label %58, label %8

8:                                                ; preds = %5
  tail call void @png_free_data(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8192, i32 noundef 0) #4
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %16, label %9

9:                                                ; preds = %8
  %10 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef 256) #4
  %11 = getelementptr inbounds i8, ptr %1, i64 104
  store ptr %10, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 776
  store ptr %10, ptr %12, align 8, !tbaa !18
  %13 = add i32 %3, -1
  %or.cond3 = icmp ult i32 %13, 256
  br i1 %or.cond3, label %14, label %16

14:                                               ; preds = %9
  %15 = zext nneg i32 %3 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %10, ptr nonnull align 1 %2, i64 %15, i1 false)
  br label %16

16:                                               ; preds = %9, %14, %8
  %.not42 = icmp eq ptr %4, null
  br i1 %.not42, label %48, label %17

17:                                               ; preds = %16
  %18 = getelementptr inbounds i8, ptr %1, i64 44
  %19 = load i8, ptr %18, align 4, !tbaa !23
  %20 = zext nneg i8 %19 to i32
  %21 = shl nuw i32 1, %20
  %22 = getelementptr inbounds i8, ptr %1, i64 45
  %23 = load i8, ptr %22, align 1, !tbaa !24
  switch i8 %23, label %.thread44 [
    i8 0, label %24
    i8 2, label %29
  ]

24:                                               ; preds = %17
  %25 = getelementptr inbounds i8, ptr %4, i64 8
  %26 = load i16, ptr %25, align 2, !tbaa !25
  %27 = zext i16 %26 to i32
  %28 = icmp slt i32 %21, %27
  br i1 %28, label %44, label %.thread44

29:                                               ; preds = %17
  %30 = getelementptr inbounds i8, ptr %4, i64 2
  %31 = load i16, ptr %30, align 2, !tbaa !26
  %32 = zext i16 %31 to i32
  %33 = icmp slt i32 %21, %32
  br i1 %33, label %44, label %34

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %4, i64 4
  %36 = load i16, ptr %35, align 2, !tbaa !27
  %37 = zext i16 %36 to i32
  %38 = icmp ult i32 %21, %37
  br i1 %38, label %44, label %39

39:                                               ; preds = %34
  %40 = getelementptr inbounds i8, ptr %4, i64 6
  %41 = load i16, ptr %40, align 2, !tbaa !28
  %42 = zext i16 %41 to i32
  %43 = icmp ult i32 %21, %42
  br i1 %43, label %44, label %.thread44

44:                                               ; preds = %39, %34, %29, %24
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.29) #4
  br label %.thread44

.thread44:                                        ; preds = %17, %39, %44, %24
  %45 = getelementptr inbounds i8, ptr %1, i64 112
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(10) %45, ptr noundef nonnull align 2 dereferenceable(10) %4, i64 10, i1 false)
  %spec.store.select = tail call i32 @llvm.umax.i32(i32 %3, i32 1)
  %46 = trunc i32 %spec.store.select to i16
  %47 = getelementptr inbounds i8, ptr %1, i64 42
  store i16 %46, ptr %47, align 2, !tbaa !29
  br label %51

48:                                               ; preds = %16
  %49 = trunc i32 %3 to i16
  %50 = getelementptr inbounds i8, ptr %1, i64 42
  store i16 %49, ptr %50, align 2, !tbaa !29
  %.not43 = icmp eq i32 %3, 0
  br i1 %.not43, label %58, label %51

51:                                               ; preds = %.thread44, %48
  %52 = getelementptr inbounds i8, ptr %1, i64 16
  %53 = load i64, ptr %52, align 8, !tbaa !30
  %54 = or i64 %53, 16
  store i64 %54, ptr %52, align 8, !tbaa !30
  %55 = getelementptr inbounds i8, ptr %1, i64 272
  %56 = load i64, ptr %55, align 8, !tbaa !31
  %57 = or i64 %56, 8192
  store i64 %57, ptr %55, align 8, !tbaa !31
  br label %58

58:                                               ; preds = %5, %51, %48
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #3

attributes #0 = { mustprogress nocallback nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 104}
!6 = !{!"png_info_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !11, i64 42, !8, i64 44, !8, i64 45, !8, i64 46, !8, i64 47, !8, i64 48, !8, i64 49, !8, i64 50, !8, i64 51, !8, i64 52, !12, i64 60, !8, i64 64, !13, i64 68, !13, i64 72, !10, i64 80, !14, i64 88, !15, i64 96, !10, i64 104, !16, i64 112, !16, i64 122, !7, i64 136, !7, i64 144, !8, i64 152, !7, i64 160, !7, i64 168, !8, i64 176, !10, i64 184, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !10, i64 224, !7, i64 232, !7, i64 240, !10, i64 248, !10, i64 256, !8, i64 264, !8, i64 265, !7, i64 272, !10, i64 280, !7, i64 288, !10, i64 296, !10, i64 304, !7, i64 312, !8, i64 320, !10, i64 328, !7, i64 336, !8, i64 344, !17, i64 352, !17, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !7, i64 392, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !7, i64 448, !7, i64 456}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"png_time_struct", !11, i64 0, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6}
!15 = !{!"png_color_8_struct", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4}
!16 = !{!"png_color_16_struct", !8, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !11, i64 8}
!17 = !{!"double", !8, i64 0}
!18 = !{!19, !10, i64 776}
!19 = !{!"png_struct_def", !8, i64 0, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !8, i64 272, !8, i64 273, !7, i64 280, !7, i64 288, !7, i64 296, !20, i64 304, !10, i64 416, !7, i64 424, !13, i64 432, !13, i64 436, !13, i64 440, !13, i64 444, !13, 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, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !21, i64 568, !7, i64 592, !7, i64 600, !10, i64 608, !11, i64 616, !11, i64 618, !8, i64 620, !8, i64 625, !8, i64 626, !8, i64 627, !8, i64 628, !8, i64 629, !8, i64 630, !8, i64 631, !8, i64 632, !8, i64 633, !8, i64 634, !8, i64 635, !8, i64 636, !11, i64 638, !8, i64 640, !12, i64 644, !16, i64 648, !16, i64 658, !10, i64 672, !7, i64 680, !7, i64 688, !13, i64 696, !12, i64 700, !12, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !15, i64 760, !15, i64 765, !10, i64 776, !16, i64 784, !10, i64 800, !10, i64 808, !10, i64 816, !10, i64 824, !10, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !10, i64 864, !7, i64 872, !7, i64 880, !7, i64 888, !7, i64 896, !7, i64 904, !7, i64 912, !13, i64 920, !13, i64 924, !7, i64 928, !7, i64 936, !10, i64 944, !10, i64 952, !10, i64 960, !10, i64 968, !10, i64 976, !8, i64 984, !8, i64 985, !10, i64 992, !10, i64 1000, !10, i64 1008, !10, i64 1016, !10, i64 1024, !10, i64 1032, !7, i64 1040, !10, i64 1048, !10, i64 1056, !13, i64 1064, !10, i64 1072, !8, i64 1080, !11, i64 1082, !11, i64 1084, !11, i64 1086, !7, i64 1088, !7, i64 1096, !8, i64 1104, !8, i64 1105, !7, i64 1112, !7, i64 1120, !10, i64 1128, !10, i64 1136, !10, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !10, i64 1176, !8, i64 1184, !7, i64 1192, !7, i64 1200, !22, i64 1208, !7, i64 1240, !7, i64 1248}
!20 = !{!"z_stream_s", !10, i64 0, !13, i64 8, !7, i64 16, !10, i64 24, !13, i64 32, !7, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !13, i64 88, !7, i64 96, !7, i64 104}
!21 = !{!"png_row_info_struct", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 17, !8, i64 18, !8, i64 19}
!22 = !{!"png_unknown_chunk_t", !8, i64 0, !10, i64 8, !7, i64 16, !8, i64 24}
!23 = !{!6, !8, i64 44}
!24 = !{!6, !8, i64 45}
!25 = !{!16, !11, i64 8}
!26 = !{!16, !11, i64 2}
!27 = !{!16, !11, i64 4}
!28 = !{!16, !11, i64 6}
!29 = !{!6, !11, i64 42}
!30 = !{!6, !7, i64 16}
!31 = !{!6, !7, i64 272}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass