; LLVM IR from corentinartaud/graphics :: ThirdParty/FreeImage-3170/Source/LibPNG (pngwutil)

; 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_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, %struct.z_stream_s, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, i32, ptr, i16, i32, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, i32, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, i32, 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, i32, i32, i64, i64, i64, i64, i32, i32, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, i8, [29 x i8], i32, ptr, ptr, i32, i32, ptr, i8, i8, i16, i16, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, i64, %struct.png_unknown_chunk_t, i64, ptr, i64, i32, i32, ptr, [4 x ptr], %struct.png_colorspace }
%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_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }
%struct.png_colorspace = type { i32, %struct.png_xy, %struct.png_XYZ, i16, i16 }
%struct.png_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_XYZ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @png_write_complete_chunk(ptr noalias noundef, i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @png_write_IHDR(ptr noalias noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [13 x i8], align 1
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store i32 %4, ptr %13, align 4, !tbaa !9
  store i32 %5, ptr %14, align 4, !tbaa !9
  store i32 %6, ptr %15, align 4, !tbaa !9
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 13, ptr %17) #4
  %18 = load i32, ptr %13, align 4, !tbaa !9
  switch i32 %18, label %68 [
    i32 0, label %19
    i32 2, label %27
    i32 3, label %38
    i32 4, label %46
    i32 6, label %57
  ]

19:                                               ; preds = %8
  %20 = load i32, ptr %12, align 4, !tbaa !9
  switch i32 %20, label %24 [
    i32 1, label %21
    i32 2, label %21
    i32 4, label %21
    i32 8, label %21
    i32 16, label %21
  ]

21:                                               ; preds = %19, %19, %19, %19, %19
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.png_struct_def, ptr %22, i32 0, i32 67
  store i8 1, ptr %23, align 1, !tbaa !11
  br label %26

24:                                               ; preds = %19
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %25, ptr noundef @.str) #5
  unreachable

26:                                               ; preds = %21
  br label %70

27:                                               ; preds = %8
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 8
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  %31 = load i32, ptr %12, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 16
  br i1 %32, label %33, label %35

33:                                               ; preds = %30
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %34, ptr noundef @.str.1) #5
  unreachable

35:                                               ; preds = %30, %27
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.png_struct_def, ptr %36, i32 0, i32 67
  store i8 3, ptr %37, align 1, !tbaa !11
  br label %70

38:                                               ; preds = %8
  %39 = load i32, ptr %12, align 4, !tbaa !9
  switch i32 %39, label %43 [
    i32 1, label %40
    i32 2, label %40
    i32 4, label %40
    i32 8, label %40
  ]

40:                                               ; preds = %38, %38, %38, %38
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 67
  store i8 1, ptr %42, align 1, !tbaa !11
  br label %45

43:                                               ; preds = %38
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %44, ptr noundef @.str.2) #5
  unreachable

45:                                               ; preds = %40
  br label %70

46:                                               ; preds = %8
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 8
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 16
  br i1 %51, label %52, label %54

52:                                               ; preds = %49
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %53, ptr noundef @.str.3) #5
  unreachable

54:                                               ; preds = %49, %46
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 67
  store i8 2, ptr %56, align 1, !tbaa !11
  br label %70

57:                                               ; preds = %8
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 8
  br i1 %59, label %60, label %65

60:                                               ; preds = %57
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 16
  br i1 %62, label %63, label %65

63:                                               ; preds = %60
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %64, ptr noundef @.str.4) #5
  unreachable

65:                                               ; preds = %60, %57
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.png_struct_def, ptr %66, i32 0, i32 67
  store i8 4, ptr %67, align 1, !tbaa !11
  br label %70

68:                                               ; preds = %8
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %69, ptr noundef @.str.5) #5
  unreachable

70:                                               ; preds = %65, %54, %45, %35, %26
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %70
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_warning(ptr noundef %74, ptr noundef @.str.6)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %73, %70
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.png_struct_def, ptr %76, i32 0, i32 130
  %78 = load i32, ptr %77, align 8, !tbaa !22
  %79 = and i32 %78, 4
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %96

81:                                               ; preds = %75
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.png_struct_def, ptr %82, i32 0, i32 15
  %84 = load i32, ptr %83, align 4, !tbaa !23
  %85 = and i32 %84, 4096
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %96

87:                                               ; preds = %81
  %88 = load i32, ptr %13, align 4, !tbaa !9
  %89 = icmp eq i32 %88, 2
  br i1 %89, label %93, label %90

90:                                               ; preds = %87
  %91 = load i32, ptr %13, align 4, !tbaa !9
  %92 = icmp eq i32 %91, 6
  br i1 %92, label %93, label %96

93:                                               ; preds = %90, %87
  %94 = load i32, ptr %15, align 4, !tbaa !9
  %95 = icmp eq i32 %94, 64
  br i1 %95, label %101, label %96

96:                                               ; preds = %93, %90, %81, %75
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %101

99:                                               ; preds = %96
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_warning(ptr noundef %100, ptr noundef @.str.7)
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %99, %96, %93
  %102 = load i32, ptr %16, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %109

104:                                              ; preds = %101
  %105 = load i32, ptr %16, align 4, !tbaa !9
  %106 = icmp ne i32 %105, 1
  br i1 %106, label %107, label %109

107:                                              ; preds = %104
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_warning(ptr noundef %108, ptr noundef @.str.8)
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %107, %104, %101
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = trunc i32 %110 to i8
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.png_struct_def, ptr %112, i32 0, i32 64
  store i8 %111, ptr %113, align 8, !tbaa !24
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = trunc i32 %114 to i8
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.png_struct_def, ptr %116, i32 0, i32 63
  store i8 %115, ptr %117, align 1, !tbaa !25
  %118 = load i32, ptr %16, align 4, !tbaa !9
  %119 = trunc i32 %118 to i8
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_struct_def, ptr %120, i32 0, i32 60
  store i8 %119, ptr %121, align 4, !tbaa !26
  %122 = load i32, ptr %15, align 4, !tbaa !9
  %123 = trunc i32 %122 to i8
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_struct_def, ptr %124, i32 0, i32 131
  store i8 %123, ptr %125, align 4, !tbaa !27
  %126 = load i32, ptr %14, align 4, !tbaa !9
  %127 = trunc i32 %126 to i8
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.png_struct_def, ptr %128, i32 0, i32 139
  store i8 %127, ptr %129, align 8, !tbaa !28
  %130 = load i32, ptr %10, align 4, !tbaa !9
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.png_struct_def, ptr %131, i32 0, i32 37
  store i32 %130, ptr %132, align 8, !tbaa !29
  %133 = load i32, ptr %11, align 4, !tbaa !9
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.png_struct_def, ptr %134, i32 0, i32 38
  store i32 %133, ptr %135, align 4, !tbaa !30
  %136 = load i32, ptr %12, align 4, !tbaa !9
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.png_struct_def, ptr %137, i32 0, i32 67
  %139 = load i8, ptr %138, align 1, !tbaa !11
  %140 = zext i8 %139 to i32
  %141 = mul nsw i32 %136, %140
  %142 = trunc i32 %141 to i8
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.png_struct_def, ptr %143, i32 0, i32 66
  store i8 %142, ptr %144, align 2, !tbaa !31
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.png_struct_def, ptr %145, i32 0, i32 66
  %147 = load i8, ptr %146, align 2, !tbaa !31
  %148 = zext i8 %147 to i32
  %149 = icmp sge i32 %148, 8
  br i1 %149, label %150, label %159

150:                                              ; preds = %109
  %151 = load i32, ptr %10, align 4, !tbaa !9
  %152 = zext i32 %151 to i64
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.png_struct_def, ptr %153, i32 0, i32 66
  %155 = load i8, ptr %154, align 2, !tbaa !31
  %156 = zext i8 %155 to i64
  %157 = lshr i64 %156, 3
  %158 = mul i64 %152, %157
  br label %169

159:                                              ; preds = %109
  %160 = load i32, ptr %10, align 4, !tbaa !9
  %161 = zext i32 %160 to i64
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.png_struct_def, ptr %162, i32 0, i32 66
  %164 = load i8, ptr %163, align 2, !tbaa !31
  %165 = zext i8 %164 to i64
  %166 = mul i64 %161, %165
  %167 = add i64 %166, 7
  %168 = lshr i64 %167, 3
  br label %169

169:                                              ; preds = %159, %150
  %170 = phi i64 [ %158, %150 ], [ %168, %159 ]
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.png_struct_def, ptr %171, i32 0, i32 41
  store i64 %170, ptr %172, align 8, !tbaa !32
  %173 = load ptr, ptr %9, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.png_struct_def, ptr %173, i32 0, i32 37
  %175 = load i32, ptr %174, align 8, !tbaa !29
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.png_struct_def, ptr %176, i32 0, i32 40
  store i32 %175, ptr %177, align 4, !tbaa !33
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.png_struct_def, ptr %178, i32 0, i32 64
  %180 = load i8, ptr %179, align 8, !tbaa !24
  %181 = load ptr, ptr %9, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.png_struct_def, ptr %181, i32 0, i32 65
  store i8 %180, ptr %182, align 1, !tbaa !34
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.png_struct_def, ptr %183, i32 0, i32 67
  %185 = load i8, ptr %184, align 1, !tbaa !11
  %186 = load ptr, ptr %9, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.png_struct_def, ptr %186, i32 0, i32 68
  store i8 %185, ptr %187, align 4, !tbaa !35
  %188 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 0
  %189 = load i32, ptr %10, align 4, !tbaa !9
  call void @png_save_uint_32(ptr noundef %188, i32 noundef %189)
  %190 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 0
  %191 = getelementptr inbounds i8, ptr %190, i64 4
  %192 = load i32, ptr %11, align 4, !tbaa !9
  call void @png_save_uint_32(ptr noundef %191, i32 noundef %192)
  %193 = load i32, ptr %12, align 4, !tbaa !9
  %194 = trunc i32 %193 to i8
  %195 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 8
  store i8 %194, ptr %195, align 1, !tbaa !36
  %196 = load i32, ptr %13, align 4, !tbaa !9
  %197 = trunc i32 %196 to i8
  %198 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 9
  store i8 %197, ptr %198, align 1, !tbaa !36
  %199 = load i32, ptr %14, align 4, !tbaa !9
  %200 = trunc i32 %199 to i8
  %201 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 10
  store i8 %200, ptr %201, align 1, !tbaa !36
  %202 = load i32, ptr %15, align 4, !tbaa !9
  %203 = trunc i32 %202 to i8
  %204 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 11
  store i8 %203, ptr %204, align 1, !tbaa !36
  %205 = load i32, ptr %16, align 4, !tbaa !9
  %206 = trunc i32 %205 to i8
  %207 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 12
  store i8 %206, ptr %207, align 1, !tbaa !36
  %208 = load ptr, ptr %9, align 8, !tbaa !5
  %209 = getelementptr inbounds [13 x i8], ptr %17, i64 0, i64 0
  call void @png_write_complete_chunk(ptr noundef %208, i32 noundef 1229472850, ptr noundef %209, i64 noundef 13)
  %210 = load ptr, ptr %9, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.png_struct_def, ptr %210, i32 0, i32 62
  %212 = load i8, ptr %211, align 2, !tbaa !37
  %213 = zext i8 %212 to i32
  %214 = icmp eq i32 %213, 0
  br i1 %214, label %215, label %234

215:                                              ; preds = %169
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.png_struct_def, ptr %216, i32 0, i32 63
  %218 = load i8, ptr %217, align 1, !tbaa !25
  %219 = zext i8 %218 to i32
  %220 = icmp eq i32 %219, 3
  br i1 %220, label %227, label %221

221:                                              ; preds = %215
  %222 = load ptr, ptr %9, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.png_struct_def, ptr %222, i32 0, i32 64
  %224 = load i8, ptr %223, align 8, !tbaa !24
  %225 = zext i8 %224 to i32
  %226 = icmp slt i32 %225, 8
  br i1 %226, label %227, label %230

227:                                              ; preds = %221, %215
  %228 = load ptr, ptr %9, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.png_struct_def, ptr %228, i32 0, i32 62
  store i8 8, ptr %229, align 2, !tbaa !37
  br label %233

230:                                              ; preds = %221
  %231 = load ptr, ptr %9, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.png_struct_def, ptr %231, i32 0, i32 62
  store i8 -8, ptr %232, align 2, !tbaa !37
  br label %233

233:                                              ; preds = %230, %227
  br label %234

234:                                              ; preds = %233, %169
  %235 = load ptr, ptr %9, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.png_struct_def, ptr %235, i32 0, i32 15
  store i32 1, ptr %236, align 4, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 13, ptr %17) #4
  ret void
}

; Function Attrs: noreturn
declare void @png_error(ptr noundef, ptr noundef) #2

declare void @png_warning(ptr noundef, ptr 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn "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 = { "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 = { noreturn }

!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, !7, i64 635}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !13, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !14, i64 320, !6, i64 432, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !10, i64 460, !10, i64 464, !10, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !10, i64 512, !10, i64 516, !13, i64 520, !10, i64 528, !10, i64 532, !10, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !13, i64 592, !10, i64 600, !10, i64 604, !6, i64 608, !15, i64 616, !10, i64 620, !15, i64 624, !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, !7, i64 637, !7, i64 638, !7, i64 639, !15, i64 640, !7, i64 642, !10, i64 644, !16, i64 648, !16, i64 658, !6, i64 672, !10, i64 680, !10, i64 684, !10, i64 688, !10, i64 692, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !17, i64 744, !17, i64 749, !6, i64 760, !16, i64 768, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !10, i64 856, !10, i64 860, !13, i64 864, !13, i64 872, !13, i64 880, !13, i64 888, !10, i64 896, !10, i64 900, !6, i64 904, !6, i64 912, !7, i64 920, !7, i64 921, !6, i64 928, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !7, i64 968, !7, i64 969, !10, i64 1000, !6, i64 1008, !6, i64 1016, !10, i64 1024, !10, i64 1028, !6, i64 1032, !7, i64 1040, !7, i64 1041, !15, i64 1042, !15, i64 1044, !10, i64 1048, !7, i64 1052, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !6, i64 1104, !7, i64 1112, !10, i64 1116, !10, i64 1120, !10, i64 1124, !13, i64 1128, !18, i64 1136, !13, i64 1168, !6, i64 1176, !13, i64 1184, !10, i64 1192, !10, i64 1196, !6, i64 1200, !7, i64 1208, !19, i64 1240}
!13 = !{!"long", !7, i64 0}
!14 = !{!"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}
!15 = !{!"short", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!19 = !{!"png_colorspace", !10, i64 0, !20, i64 4, !21, i64 36, !15, i64 72, !15, i64 74}
!20 = !{!"png_xy", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!21 = !{!"png_XYZ", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!22 = !{!12, !10, i64 1048}
!23 = !{!12, !10, i64 300}
!24 = !{!12, !7, i64 632}
!25 = !{!12, !7, i64 631}
!26 = !{!12, !7, i64 628}
!27 = !{!12, !7, i64 1052}
!28 = !{!12, !7, i64 1112}
!29 = !{!12, !10, i64 504}
!30 = !{!12, !10, i64 508}
!31 = !{!12, !7, i64 634}
!32 = !{!12, !13, i64 520}
!33 = !{!12, !10, i64 516}
!34 = !{!12, !7, i64 633}
!35 = !{!12, !7, i64 636}
!36 = !{!7, !7, i64 0}
!37 = !{!12, !7, i64 630}


; 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 [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @png_write_complete_chunk(ptr noalias noundef, i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @png_write_IHDR(ptr noalias noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = alloca [13 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %9) #4
  switch i32 %4, label %21 [
    i32 0, label %10
    i32 2, label %12
    i32 3, label %14
    i32 4, label %17
    i32 6, label %19
  ]

10:                                               ; preds = %8
  switch i32 %3, label %11 [
    i32 1, label %switch.lookup
    i32 2, label %switch.lookup
    i32 4, label %switch.lookup
    i32 8, label %switch.lookup
    i32 16, label %switch.lookup
  ]

11:                                               ; preds = %10
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str) #5
  unreachable

12:                                               ; preds = %8
  switch i32 %3, label %13 [
    i32 16, label %switch.lookup
    i32 8, label %switch.lookup
  ]

13:                                               ; preds = %12
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.1) #5
  unreachable

14:                                               ; preds = %8
  %switch.tableidx = add i32 %3, -1
  %15 = icmp ult i32 %switch.tableidx, 8
  br i1 %15, label %switch.hole_check, label %16

16:                                               ; preds = %switch.hole_check, %14
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.2) #5
  unreachable

17:                                               ; preds = %8
  switch i32 %3, label %18 [
    i32 16, label %switch.lookup
    i32 8, label %switch.lookup
  ]

18:                                               ; preds = %17
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.3) #5
  unreachable

19:                                               ; preds = %8
  switch i32 %3, label %20 [
    i32 16, label %switch.lookup
    i32 8, label %switch.lookup
  ]

20:                                               ; preds = %19
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.4) #5
  unreachable

21:                                               ; preds = %8
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.5) #5
  unreachable

switch.hole_check:                                ; preds = %14
  %switch.maskindex = trunc nuw i32 %switch.tableidx to i8
  %switch.shifted = lshr i8 -117, %switch.maskindex
  %switch.lobit = trunc i8 %switch.shifted to i1
  br i1 %switch.lobit, label %switch.lookup, label %16

switch.lookup:                                    ; preds = %switch.hole_check, %19, %19, %17, %17, %12, %12, %10, %10, %10, %10, %10
  %.sink = phi i8 [ 1, %10 ], [ 1, %10 ], [ 1, %10 ], [ 1, %10 ], [ 1, %10 ], [ 3, %12 ], [ 3, %12 ], [ 2, %17 ], [ 2, %17 ], [ 4, %19 ], [ 4, %19 ], [ 1, %switch.hole_check ]
  %22 = getelementptr inbounds i8, ptr %0, i64 635
  store i8 %.sink, ptr %22, align 1, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %24, label %23

23:                                               ; preds = %switch.lookup
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.6) #4
  br label %24

24:                                               ; preds = %23, %switch.lookup
  %25 = getelementptr inbounds i8, ptr %0, i64 1048
  %26 = load i32, ptr %25, align 8, !tbaa !20
  %27 = and i32 %26, 4
  %.not93 = icmp eq i32 %27, 0
  br i1 %.not93, label %37, label %28

28:                                               ; preds = %24
  %29 = getelementptr inbounds i8, ptr %0, i64 300
  %30 = load i32, ptr %29, align 4, !tbaa !21
  %31 = and i32 %30, 4096
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %37

33:                                               ; preds = %28
  %34 = and i32 %4, -5
  %or.cond7 = icmp ne i32 %34, 2
  %35 = icmp ne i32 %6, 64
  %or.cond9.not95 = or i1 %or.cond7, %35
  %36 = icmp ne i32 %6, 0
  %or.cond11 = and i1 %36, %or.cond9.not95
  br i1 %or.cond11, label %38, label %39

37:                                               ; preds = %28, %24
  %.old10.not = icmp eq i32 %6, 0
  br i1 %.old10.not, label %39, label %38

38:                                               ; preds = %33, %37
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.7) #4
  br label %39

39:                                               ; preds = %33, %38, %37
  %.089 = phi i32 [ 0, %38 ], [ %6, %33 ], [ 0, %37 ]
  %or.cond14 = icmp ugt i32 %7, 1
  br i1 %or.cond14, label %40, label %41

40:                                               ; preds = %39
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #4
  br label %41

41:                                               ; preds = %40, %39
  %.0 = phi i32 [ 1, %40 ], [ %7, %39 ]
  %42 = trunc i32 %3 to i8
  %43 = getelementptr inbounds i8, ptr %0, i64 632
  store i8 %42, ptr %43, align 8, !tbaa !22
  %44 = trunc i32 %4 to i8
  %45 = getelementptr inbounds i8, ptr %0, i64 631
  store i8 %44, ptr %45, align 1, !tbaa !23
  %46 = trunc nuw i32 %.0 to i8
  %47 = getelementptr inbounds i8, ptr %0, i64 628
  store i8 %46, ptr %47, align 4, !tbaa !24
  %48 = trunc i32 %.089 to i8
  %49 = getelementptr inbounds i8, ptr %0, i64 1052
  store i8 %48, ptr %49, align 4, !tbaa !25
  %50 = getelementptr inbounds i8, ptr %0, i64 1112
  store i8 0, ptr %50, align 8, !tbaa !26
  %51 = getelementptr inbounds i8, ptr %0, i64 504
  store i32 %1, ptr %51, align 8, !tbaa !27
  %52 = getelementptr inbounds i8, ptr %0, i64 508
  store i32 %2, ptr %52, align 4, !tbaa !28
  %53 = getelementptr inbounds i8, ptr %0, i64 635
  %54 = load i8, ptr %53, align 1, !tbaa !5
  %55 = mul i8 %54, %42
  %56 = getelementptr inbounds i8, ptr %0, i64 634
  store i8 %55, ptr %56, align 2, !tbaa !29
  %57 = icmp ugt i8 %55, 7
  %58 = zext i32 %1 to i64
  br i1 %57, label %59, label %63

59:                                               ; preds = %41
  %60 = lshr i8 %55, 3
  %61 = zext nneg i8 %60 to i64
  %62 = mul nuw nsw i64 %61, %58
  br label %68

63:                                               ; preds = %41
  %64 = zext nneg i8 %55 to i64
  %65 = mul nuw nsw i64 %64, %58
  %66 = add nuw nsw i64 %65, 7
  %67 = lshr i64 %66, 3
  br label %68

68:                                               ; preds = %63, %59
  %69 = phi i64 [ %62, %59 ], [ %67, %63 ]
  %70 = getelementptr inbounds i8, ptr %0, i64 520
  store i64 %69, ptr %70, align 8, !tbaa !30
  %71 = getelementptr inbounds i8, ptr %0, i64 516
  store i32 %1, ptr %71, align 4, !tbaa !31
  %72 = getelementptr inbounds i8, ptr %0, i64 633
  store i8 %42, ptr %72, align 1, !tbaa !32
  %73 = getelementptr inbounds i8, ptr %0, i64 636
  store i8 %54, ptr %73, align 4, !tbaa !33
  call void @png_save_uint_32(ptr noundef nonnull %9, i32 noundef %1)
  %74 = getelementptr inbounds i8, ptr %9, i64 4
  call void @png_save_uint_32(ptr noundef nonnull %74, i32 noundef %2)
  %75 = getelementptr inbounds i8, ptr %9, i64 8
  store i8 %42, ptr %75, align 1, !tbaa !34
  %76 = getelementptr inbounds i8, ptr %9, i64 9
  store i8 %44, ptr %76, align 1, !tbaa !34
  %77 = getelementptr inbounds i8, ptr %9, i64 10
  store i8 0, ptr %77, align 1, !tbaa !34
  %78 = getelementptr inbounds i8, ptr %9, i64 11
  store i8 %48, ptr %78, align 1, !tbaa !34
  %79 = getelementptr inbounds i8, ptr %9, i64 12
  store i8 %46, ptr %79, align 1, !tbaa !34
  call void @png_write_complete_chunk(ptr noundef nonnull %0, i32 noundef 1229472850, ptr noundef nonnull %9, i64 noundef 13)
  %80 = getelementptr inbounds i8, ptr %0, i64 630
  %81 = load i8, ptr %80, align 2, !tbaa !35
  %82 = icmp eq i8 %81, 0
  br i1 %82, label %83, label %89

83:                                               ; preds = %68
  %84 = load i8, ptr %45, align 1, !tbaa !23
  %85 = icmp eq i8 %84, 3
  br i1 %85, label %.sink.split, label %86

86:                                               ; preds = %83
  %87 = load i8, ptr %43, align 8, !tbaa !22
  %88 = icmp ult i8 %87, 8
  %spec.select = select i1 %88, i8 8, i8 -8
  br label %.sink.split

.sink.split:                                      ; preds = %86, %83
  %.sink97 = phi i8 [ 8, %83 ], [ %spec.select, %86 ]
  store i8 %.sink97, ptr %80, align 2, !tbaa !35
  br label %89

89:                                               ; preds = %.sink.split, %68
  %90 = getelementptr inbounds i8, ptr %0, i64 300
  store i32 1, ptr %90, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %9) #4
  ret void
}

; Function Attrs: noreturn
declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn "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 = { "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 = { noreturn 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, !7, i64 635}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !10, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !11, i64 304, !11, i64 308, !11, i64 312, !12, i64 320, !9, i64 432, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !11, i64 460, !11, i64 464, !11, i64 468, !11, i64 472, !11, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !11, i64 508, !11, i64 512, !11, i64 516, !10, i64 520, !11, i64 528, !11, i64 532, !11, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !9, i64 568, !9, i64 576, !9, i64 584, !10, i64 592, !11, i64 600, !11, i64 604, !9, i64 608, !13, i64 616, !11, i64 620, !13, i64 624, !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, !7, i64 637, !7, i64 638, !7, i64 639, !13, i64 640, !7, i64 642, !11, i64 644, !14, i64 648, !14, i64 658, !9, i64 672, !11, i64 680, !11, i64 684, !11, i64 688, !11, i64 692, !9, i64 696, !9, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !15, i64 744, !15, i64 749, !9, i64 760, !14, i64 768, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !11, i64 856, !11, i64 860, !10, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !11, i64 896, !11, i64 900, !9, i64 904, !9, i64 912, !7, i64 920, !7, i64 921, !9, i64 928, !9, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !7, i64 968, !7, i64 969, !11, i64 1000, !9, i64 1008, !9, i64 1016, !11, i64 1024, !11, i64 1028, !9, i64 1032, !7, i64 1040, !7, i64 1041, !13, i64 1042, !13, i64 1044, !11, i64 1048, !7, i64 1052, !9, i64 1056, !9, i64 1064, !9, i64 1072, !9, i64 1080, !9, i64 1088, !9, i64 1096, !9, i64 1104, !7, i64 1112, !11, i64 1116, !11, i64 1120, !11, i64 1124, !10, i64 1128, !16, i64 1136, !10, i64 1168, !9, i64 1176, !10, i64 1184, !11, i64 1192, !11, i64 1196, !9, i64 1200, !7, i64 1208, !17, i64 1240}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !9, i64 0, !11, i64 8, !10, i64 16, !9, i64 24, !11, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !11, i64 88, !10, i64 96, !10, i64 104}
!13 = !{!"short", !7, i64 0}
!14 = !{!"png_color_16_struct", !7, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!15 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!16 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !10, i64 16, !7, i64 24}
!17 = !{!"png_colorspace", !11, i64 0, !18, i64 4, !19, i64 36, !13, i64 72, !13, i64 74}
!18 = !{!"png_xy", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!19 = !{!"png_XYZ", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!20 = !{!6, !11, i64 1048}
!21 = !{!6, !11, i64 300}
!22 = !{!6, !7, i64 632}
!23 = !{!6, !7, i64 631}
!24 = !{!6, !7, i64 628}
!25 = !{!6, !7, i64 1052}
!26 = !{!6, !7, i64 1112}
!27 = !{!6, !11, i64 504}
!28 = !{!6, !11, i64 508}
!29 = !{!6, !7, i64 634}
!30 = !{!6, !10, i64 520}
!31 = !{!6, !11, i64 516}
!32 = !{!6, !7, i64 633}
!33 = !{!6, !7, i64 636}
!34 = !{!7, !7, i64 0}
!35 = !{!6, !7, i64 630}


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