; LLVM IR from zchrissirhcz/pixel :: legacy/zcnn (zcnn_png)

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nc_image_load_png(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i1 noundef zeroext %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca ptr, align 8
  %14 = alloca [8 x i8], align 1
  %15 = alloca i8, align 1
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %27 = zext i1 %5 to i8
  store i8 %27, ptr %12, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call noalias ptr @fopen(ptr noundef %28, ptr noundef @.str)
  store ptr %29, ptr %13, align 8, !tbaa !5
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %35, label %32

32:                                               ; preds = %6
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 48, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

35:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %36 = getelementptr inbounds [8 x i8], ptr %14, i64 0, i64 0
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = call i64 @fread(ptr noundef %36, i64 noundef 1, i64 noundef 8, ptr noundef %37)
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #7
  %39 = getelementptr inbounds [8 x i8], ptr %14, i64 0, i64 0
  %40 = call i32 @png_sig_cmp(ptr noundef %39, i64 noundef 0, i64 noundef 8)
  %41 = icmp ne i32 %40, 0
  %42 = xor i1 %41, true
  %43 = zext i1 %42 to i8
  store i8 %43, ptr %15, align 1, !tbaa !9
  %44 = load i8, ptr %15, align 1, !tbaa !9, !range !11, !noundef !12
  %45 = trunc i8 %44 to i1
  br i1 %45, label %51, label %46

46:                                               ; preds = %35
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  %48 = call i32 @fclose(ptr noundef %47)
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.1, ptr noundef @.str.4, i32 noundef 58, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

51:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %52 = call noalias ptr @png_create_read_struct(ptr noundef @.str.5, ptr noundef null, ptr noundef null, ptr noundef null)
  store ptr %52, ptr %16, align 8, !tbaa !5
  %53 = load ptr, ptr %16, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %60, label %55

55:                                               ; preds = %51
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = call i32 @fclose(ptr noundef %56)
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.1, ptr noundef @.str.6, i32 noundef 65, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

60:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %61 = load ptr, ptr %16, align 8, !tbaa !5
  %62 = call noalias ptr @png_create_info_struct(ptr noundef %61)
  store ptr %62, ptr %17, align 8, !tbaa !5
  %63 = load ptr, ptr %17, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %68, label %65

65:                                               ; preds = %60
  call void @png_destroy_read_struct(ptr noundef %16, ptr noundef null, ptr noundef null)
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.1, ptr noundef @.str.7, i32 noundef 71, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

68:                                               ; preds = %60
  %69 = load ptr, ptr %16, align 8, !tbaa !5
  %70 = call ptr @png_set_longjmp_fn(ptr noundef %69, ptr noundef @longjmp, i64 noundef 200)
  %71 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %70, i64 0, i64 0
  %72 = call i32 @_setjmp(ptr noundef %71) #9
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %77

74:                                               ; preds = %68
  call void @png_destroy_read_struct(ptr noundef %16, ptr noundef %17, ptr noundef null)
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str.1, ptr noundef @.str.8, i32 noundef 76, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

77:                                               ; preds = %68
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  call void @png_init_io(ptr noundef %78, ptr noundef %79)
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  call void @png_set_sig_bytes(ptr noundef %80, i32 noundef 8)
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  %82 = load ptr, ptr %17, align 8, !tbaa !5
  call void @png_read_info(ptr noundef %81, ptr noundef %82)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = load ptr, ptr %17, align 8, !tbaa !5
  %85 = call i32 @png_get_image_width(ptr noundef %83, ptr noundef %84)
  store i32 %85, ptr %18, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load ptr, ptr %17, align 8, !tbaa !5
  %88 = call i32 @png_get_image_height(ptr noundef %86, ptr noundef %87)
  store i32 %88, ptr %19, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  %90 = load ptr, ptr %17, align 8, !tbaa !5
  %91 = call zeroext i8 @png_get_bit_depth(ptr noundef %89, ptr noundef %90)
  %92 = zext i8 %91 to i32
  store i32 %92, ptr %20, align 4, !tbaa !13
  %93 = load i32, ptr %20, align 4, !tbaa !13
  %94 = icmp ne i32 %93, 8
  br i1 %94, label %95, label %98

95:                                               ; preds = %77
  %96 = load ptr, ptr @stderr, align 8, !tbaa !5
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.1, ptr noundef @.str.9, i32 noundef 87, ptr noundef @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

98:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %99 = load ptr, ptr %16, align 8, !tbaa !5
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = call zeroext i8 @png_get_channels(ptr noundef %99, ptr noundef %100)
  %102 = zext i8 %101 to i32
  store i32 %102, ptr %21, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = load ptr, ptr %17, align 8, !tbaa !5
  %105 = call i64 @png_get_rowbytes(ptr noundef %103, ptr noundef %104)
  %106 = trunc i64 %105 to i32
  store i32 %106, ptr %22, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %107 = load i32, ptr %19, align 4, !tbaa !13
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 8
  %110 = call noalias ptr @malloc(i64 noundef %109) #10
  store ptr %110, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %111 = load i32, ptr %22, align 4, !tbaa !13
  store i32 %111, ptr %24, align 4, !tbaa !13
  %112 = load i8, ptr %12, align 1, !tbaa !9, !range !11, !noundef !12
  %113 = trunc i8 %112 to i1
  br i1 %113, label %114, label %117

114:                                              ; preds = %98
  %115 = load i32, ptr %22, align 4, !tbaa !13
  %116 = call i32 @nc_align_up(i32 noundef %115, i32 noundef 4)
  store i32 %116, ptr %24, align 4, !tbaa !13
  br label %117

117:                                              ; preds = %114, %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %118 = load i32, ptr %19, align 4, !tbaa !13
  %119 = load i32, ptr %24, align 4, !tbaa !13
  %120 = mul nsw i32 %118, %119
  %121 = sext i32 %120 to i64
  %122 = call noalias ptr @malloc(i64 noundef %121) #10
  store ptr %122, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  store i32 0, ptr %26, align 4, !tbaa !13
  br label %123

123:                                              ; preds = %139, %117
  %124 = load i32, ptr %26, align 4, !tbaa !13
  %125 = load i32, ptr %19, align 4, !tbaa !13
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %142

128:                                              ; preds = %123
  %129 = load ptr, ptr %25, align 8, !tbaa !5
  %130 = load i32, ptr %26, align 4, !tbaa !13
  %131 = load i32, ptr %24, align 4, !tbaa !13
  %132 = mul nsw i32 %130, %131
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i8, ptr %129, i64 %133
  %135 = load ptr, ptr %23, align 8, !tbaa !5
  %136 = load i32, ptr %26, align 4, !tbaa !13
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %135, i64 %137
  store ptr %134, ptr %138, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %128
  %140 = load i32, ptr %26, align 4, !tbaa !13
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %26, align 4, !tbaa !13
  br label %123, !llvm.loop !15

142:                                              ; preds = %127
  %143 = load ptr, ptr %16, align 8, !tbaa !5
  call void @png_set_bgr(ptr noundef %143)
  %144 = load ptr, ptr %16, align 8, !tbaa !5
  %145 = load ptr, ptr %23, align 8, !tbaa !5
  call void @png_read_image(ptr noundef %144, ptr noundef %145)
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  call void @png_read_end(ptr noundef %146, ptr noundef null)
  call void @png_destroy_read_struct(ptr noundef %16, ptr noundef %17, ptr noundef null)
  %147 = load ptr, ptr %23, align 8, !tbaa !5
  call void @free(ptr noundef %147) #7
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = call i32 @fclose(ptr noundef %148)
  %150 = load ptr, ptr %25, align 8, !tbaa !5
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %150, ptr %151, align 8, !tbaa !5
  %152 = load i32, ptr %19, align 4, !tbaa !13
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %152, ptr %153, align 4, !tbaa !13
  %154 = load i32, ptr %18, align 4, !tbaa !13
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %154, ptr %155, align 4, !tbaa !13
  %156 = load i32, ptr %21, align 4, !tbaa !13
  %157 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %156, ptr %157, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  ret void
}

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare i32 @png_sig_cmp(ptr noundef, i64 noundef, i64 noundef) #2

declare i32 @fclose(ptr noundef) #2

declare noalias ptr @png_create_read_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare noalias ptr @png_create_info_struct(ptr noundef) #2

declare void @png_destroy_read_struct(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #5

declare ptr @png_set_longjmp_fn(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) #4

declare void @png_init_io(ptr noundef, ptr noundef) #2

declare void @png_set_sig_bytes(ptr noundef, i32 noundef) #2

declare void @png_read_info(ptr noundef, ptr noundef) #2

declare i32 @png_get_image_width(ptr noundef, ptr noundef) #2

declare i32 @png_get_image_height(ptr noundef, ptr noundef) #2

declare zeroext i8 @png_get_bit_depth(ptr noundef, ptr noundef) #2

declare zeroext i8 @png_get_channels(ptr noundef, ptr noundef) #2

declare i64 @png_get_rowbytes(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

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

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

declare void @png_set_bgr(ptr noundef) #2

declare void @png_read_image(ptr noundef, ptr noundef) #2

declare void @png_read_end(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare void @free(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 = { "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 "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 = { noreturn nounwind "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 #5 = { nounwind returns_twice "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 #6 = { nounwind allocsize(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 #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind returns_twice }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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 [3 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nc_image_load_png(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, i1 noundef zeroext %5) local_unnamed_addr #0 {
  %7 = alloca [8 x i8], align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %11, label %14

11:                                               ; preds = %6
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 48, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

14:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #10
  %15 = call i64 @fread(ptr noundef nonnull %7, i64 noundef 1, i64 noundef 8, ptr noundef nonnull %10)
  %16 = call i32 @png_sig_cmp(ptr noundef nonnull %7, i64 noundef 0, i64 noundef 8) #10
  %.not35 = icmp eq i32 %16, 0
  br i1 %.not35, label %21, label %17

17:                                               ; preds = %14
  %18 = call i32 @fclose(ptr noundef nonnull %10)
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.4, i32 noundef 58, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

21:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #10
  %22 = call noalias ptr @png_create_read_struct(ptr noundef nonnull @.str.5, ptr noundef null, ptr noundef null, ptr noundef null) #10
  store ptr %22, ptr %8, align 8, !tbaa !5
  %.not36 = icmp eq ptr %22, null
  br i1 %.not36, label %23, label %27

23:                                               ; preds = %21
  %24 = call i32 @fclose(ptr noundef nonnull %10)
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.6, i32 noundef 65, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #10
  %28 = call noalias ptr @png_create_info_struct(ptr noundef nonnull %22) #10
  store ptr %28, ptr %9, align 8, !tbaa !5
  %.not37 = icmp eq ptr %28, null
  br i1 %.not37, label %29, label %32

29:                                               ; preds = %27
  call void @png_destroy_read_struct(ptr noundef nonnull %8, ptr noundef null, ptr noundef null) #10
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.7, i32 noundef 71, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

32:                                               ; preds = %27
  %33 = call ptr @png_set_longjmp_fn(ptr noundef nonnull %22, ptr noundef nonnull @longjmp, i64 noundef 200) #10
  %34 = call i32 @_setjmp(ptr noundef %33) #11
  %.not38 = icmp eq i32 %34, 0
  br i1 %.not38, label %38, label %35

35:                                               ; preds = %32
  call void @png_destroy_read_struct(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef null) #10
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.8, i32 noundef 76, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

38:                                               ; preds = %32
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_init_io(ptr noundef %39, ptr noundef nonnull %10) #10
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_set_sig_bytes(ptr noundef %40, i32 noundef 8) #10
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_read_info(ptr noundef %41, ptr noundef %42) #10
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call i32 @png_get_image_width(ptr noundef %43, ptr noundef %44) #10
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = call i32 @png_get_image_height(ptr noundef %46, ptr noundef %47) #10
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = call zeroext i8 @png_get_bit_depth(ptr noundef %49, ptr noundef %50) #10
  %.not39 = icmp eq i8 %51, 8
  br i1 %.not39, label %55, label %52

52:                                               ; preds = %38
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.9, i32 noundef 87, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

55:                                               ; preds = %38
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = call zeroext i8 @png_get_channels(ptr noundef %56, ptr noundef %57) #10
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = call i64 @png_get_rowbytes(ptr noundef %59, ptr noundef %60) #10
  %62 = trunc i64 %61 to i32
  %63 = sext i32 %48 to i64
  %64 = shl nsw i64 %63, 3
  %65 = call noalias ptr @malloc(i64 noundef %64) #12
  br i1 %5, label %66, label %68

66:                                               ; preds = %55
  %67 = call i32 @nc_align_up(i32 noundef %62, i32 noundef 4)
  br label %68

68:                                               ; preds = %66, %55
  %.032 = phi i32 [ %67, %66 ], [ %62, %55 ]
  %69 = mul nsw i32 %.032, %48
  %70 = sext i32 %69 to i64
  %71 = call noalias ptr @malloc(i64 noundef %70) #12
  %72 = icmp sgt i32 %48, 0
  br i1 %72, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %68
  %73 = sext i32 %.032 to i64
  %wide.trip.count = zext nneg i32 %48 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %74 = icmp ult i32 %48, 4
  br i1 %74, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %75 = mul nsw i64 %indvars.iv.epil, %73
  %76 = getelementptr inbounds i8, ptr %71, i64 %75
  %77 = getelementptr inbounds ptr, ptr %65, i64 %indvars.iv.epil
  store ptr %76, ptr %77, align 8, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %68
  %78 = zext i8 %58 to i32
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_set_bgr(ptr noundef %79) #10
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_read_image(ptr noundef %80, ptr noundef %65) #10
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_read_end(ptr noundef %81, ptr noundef null) #10
  call void @png_destroy_read_struct(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef null) #10
  call void @free(ptr noundef %65) #10
  %82 = call i32 @fclose(ptr noundef nonnull %10)
  store ptr %71, ptr %1, align 8, !tbaa !5
  store i32 %48, ptr %2, align 4, !tbaa !11
  store i32 %45, ptr %3, align 4, !tbaa !11
  store i32 %78, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #10
  ret void

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %83 = mul nsw i64 %indvars.iv, %73
  %84 = getelementptr inbounds i8, ptr %71, i64 %83
  %85 = getelementptr inbounds ptr, ptr %65, i64 %indvars.iv
  store ptr %84, ptr %85, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %86 = mul nsw i64 %indvars.iv.next, %73
  %87 = getelementptr inbounds i8, ptr %71, i64 %86
  %88 = getelementptr inbounds ptr, ptr %65, i64 %indvars.iv.next
  store ptr %87, ptr %88, align 8, !tbaa !5
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %89 = mul nsw i64 %indvars.iv.next.1, %73
  %90 = getelementptr inbounds i8, ptr %71, i64 %89
  %91 = getelementptr inbounds ptr, ptr %65, i64 %indvars.iv.next.1
  store ptr %90, ptr %91, align 8, !tbaa !5
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %92 = mul nsw i64 %indvars.iv.next.2, %73
  %93 = getelementptr inbounds i8, ptr %71, i64 %92
  %94 = getelementptr inbounds ptr, ptr %65, i64 %indvars.iv.next.2
  store ptr %93, ptr %94, align 8, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !13
}

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

declare i32 @png_sig_cmp(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

declare noalias ptr @png_create_read_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare noalias ptr @png_create_info_struct(ptr noundef) local_unnamed_addr #4

declare void @png_destroy_read_struct(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #5

declare ptr @png_set_longjmp_fn(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) #3

declare void @png_init_io(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @png_set_sig_bytes(ptr noundef, i32 noundef) local_unnamed_addr #4

declare void @png_read_info(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @png_get_image_width(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @png_get_image_height(ptr noundef, ptr noundef) local_unnamed_addr #4

declare zeroext i8 @png_get_bit_depth(ptr noundef, ptr noundef) local_unnamed_addr #4

declare zeroext i8 @png_get_channels(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i64 @png_get_rowbytes(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6

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

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

declare void @png_set_bgr(ptr noundef) local_unnamed_addr #4

declare void @png_read_image(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @png_read_end(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7

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 = { nofree nounwind "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 = { noreturn nounwind "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 = { "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 #5 = { nounwind returns_twice "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 #6 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { cold nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind }
attributes #11 = { nounwind returns_twice }
attributes #12 = { nounwind allocsize(0) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass