; LLVM IR from csc-training/mpi-introduction :: heat-equation/common (pngwriter)

; 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.pixel_t = type { i8, i8, i8 }
%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
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @save_png(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i8 noundef signext %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca %struct.pixel_t, align 1
  %22 = alloca %struct.pixel_t, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i8 %4, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 -1, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 3, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 8, ptr %19, align 4, !tbaa !9
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = call noalias ptr @fopen(ptr noundef %23, ptr noundef @.str)
  store ptr %24, ptr %11, align 8, !tbaa !5
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  br label %196

28:                                               ; preds = %5
  %29 = call noalias ptr @png_create_write_struct(ptr noundef @.str.1, ptr noundef null, ptr noundef null, ptr noundef null)
  store ptr %29, ptr %12, align 8, !tbaa !5
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  br label %193

33:                                               ; preds = %28
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = call noalias ptr @png_create_info_struct(ptr noundef %34)
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  br label %192

39:                                               ; preds = %33
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = call ptr @png_set_longjmp_fn(ptr noundef %40, ptr noundef @longjmp, i64 noundef 200)
  %42 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %41, i64 0, i64 0
  %43 = call i32 @_setjmp(ptr noundef %42) #7
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  br label %191

46:                                               ; preds = %39
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = trunc i64 %50 to i32
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = trunc i64 %53 to i32
  %55 = load i32, ptr %19, align 4, !tbaa !9
  call void @png_set_IHDR(ptr noundef %47, ptr noundef %48, i32 noundef %51, i32 noundef %54, i32 noundef %55, i32 noundef 2, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = mul i64 %58, 8
  %60 = call noalias ptr @png_malloc(ptr noundef %56, i64 noundef %59)
  store ptr %60, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %163, %46
  %62 = load i32, ptr %15, align 4, !tbaa !9
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %65, label %166

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = mul i64 1, %68
  %70 = load i32, ptr %18, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = mul i64 %69, %71
  %73 = call noalias ptr @png_malloc(ptr noundef %66, i64 noundef %72)
  store ptr %73, ptr %20, align 8, !tbaa !5
  %74 = load ptr, ptr %20, align 8, !tbaa !5
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = load i32, ptr %15, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  store ptr %74, ptr %78, align 8, !tbaa !5
  %79 = load i8, ptr %10, align 1, !tbaa !11
  %80 = sext i8 %79 to i32
  %81 = icmp eq i32 %80, 99
  br i1 %81, label %86, label %82

82:                                               ; preds = %65
  %83 = load i8, ptr %10, align 1, !tbaa !11
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, 67
  br i1 %85, label %86, label %117

86:                                               ; preds = %82, %65
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %113, %86
  %88 = load i32, ptr %16, align 4, !tbaa !9
  %89 = load i32, ptr %8, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %91, label %116

91:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 3, ptr %21) #6
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load i32, ptr %16, align 4, !tbaa !9
  %94 = load i32, ptr %15, align 4, !tbaa !9
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = mul nsw i32 %94, %95
  %97 = add nsw i32 %93, %96
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds double, ptr %92, i64 %98
  %100 = load double, ptr %99, align 8, !tbaa !12
  call void @cmap(double noundef %100, double noundef 2.550000e+00, double noundef 0.000000e+00, ptr noundef %21)
  %101 = getelementptr inbounds %struct.pixel_t, ptr %21, i32 0, i32 0
  %102 = load i8, ptr %101, align 1, !tbaa !14
  %103 = load ptr, ptr %20, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i32 1
  store ptr %104, ptr %20, align 8, !tbaa !5
  store i8 %102, ptr %103, align 1, !tbaa !11
  %105 = getelementptr inbounds %struct.pixel_t, ptr %21, i32 0, i32 1
  %106 = load i8, ptr %105, align 1, !tbaa !16
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i32 1
  store ptr %108, ptr %20, align 8, !tbaa !5
  store i8 %106, ptr %107, align 1, !tbaa !11
  %109 = getelementptr inbounds %struct.pixel_t, ptr %21, i32 0, i32 2
  %110 = load i8, ptr %109, align 1, !tbaa !17
  %111 = load ptr, ptr %20, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i32 1
  store ptr %112, ptr %20, align 8, !tbaa !5
  store i8 %110, ptr %111, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 3, ptr %21) #6
  br label %113

113:                                              ; preds = %91
  %114 = load i32, ptr %16, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %16, align 4, !tbaa !9
  br label %87, !llvm.loop !18

116:                                              ; preds = %87
  br label %162

117:                                              ; preds = %82
  %118 = load i8, ptr %10, align 1, !tbaa !11
  %119 = sext i8 %118 to i32
  %120 = icmp eq i32 %119, 102
  br i1 %120, label %125, label %121

121:                                              ; preds = %117
  %122 = load i8, ptr %10, align 1, !tbaa !11
  %123 = sext i8 %122 to i32
  %124 = icmp eq i32 %123, 70
  br i1 %124, label %125, label %156

125:                                              ; preds = %121, %117
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %152, %125
  %127 = load i32, ptr %16, align 4, !tbaa !9
  %128 = load i32, ptr %8, align 4, !tbaa !9
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %130, label %155

130:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 3, ptr %22) #6
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = load i32, ptr %15, align 4, !tbaa !9
  %133 = load i32, ptr %16, align 4, !tbaa !9
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  %136 = add nsw i32 %132, %135
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds double, ptr %131, i64 %137
  %139 = load double, ptr %138, align 8, !tbaa !12
  call void @cmap(double noundef %139, double noundef 2.550000e+00, double noundef 0.000000e+00, ptr noundef %22)
  %140 = getelementptr inbounds %struct.pixel_t, ptr %22, i32 0, i32 0
  %141 = load i8, ptr %140, align 1, !tbaa !14
  %142 = load ptr, ptr %20, align 8, !tbaa !5
  %143 = getelementptr inbounds i8, ptr %142, i32 1
  store ptr %143, ptr %20, align 8, !tbaa !5
  store i8 %141, ptr %142, align 1, !tbaa !11
  %144 = getelementptr inbounds %struct.pixel_t, ptr %22, i32 0, i32 1
  %145 = load i8, ptr %144, align 1, !tbaa !16
  %146 = load ptr, ptr %20, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i32 1
  store ptr %147, ptr %20, align 8, !tbaa !5
  store i8 %145, ptr %146, align 1, !tbaa !11
  %148 = getelementptr inbounds %struct.pixel_t, ptr %22, i32 0, i32 2
  %149 = load i8, ptr %148, align 1, !tbaa !17
  %150 = load ptr, ptr %20, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i32 1
  store ptr %151, ptr %20, align 8, !tbaa !5
  store i8 %149, ptr %150, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 3, ptr %22) #6
  br label %152

152:                                              ; preds = %130
  %153 = load i32, ptr %16, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %16, align 4, !tbaa !9
  br label %126, !llvm.loop !20

155:                                              ; preds = %126
  br label %161

156:                                              ; preds = %121
  %157 = load ptr, ptr @stderr, align 8, !tbaa !5
  %158 = load i8, ptr %10, align 1, !tbaa !11
  %159 = sext i8 %158 to i32
  %160 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %157, ptr noundef @.str.2, i32 noundef %159) #6
  call void @exit(i32 noundef 1) #8
  unreachable

161:                                              ; preds = %155
  br label %162

162:                                              ; preds = %161, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %15, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %15, align 4, !tbaa !9
  br label %61, !llvm.loop !21

166:                                              ; preds = %61
  %167 = load ptr, ptr %12, align 8, !tbaa !5
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  call void @png_init_io(ptr noundef %167, ptr noundef %168)
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = load ptr, ptr %13, align 8, !tbaa !5
  %171 = load ptr, ptr %14, align 8, !tbaa !5
  call void @png_set_rows(ptr noundef %169, ptr noundef %170, ptr noundef %171)
  %172 = load ptr, ptr %12, align 8, !tbaa !5
  %173 = load ptr, ptr %13, align 8, !tbaa !5
  call void @png_write_png(ptr noundef %172, ptr noundef %173, i32 noundef 0, ptr noundef null)
  store i32 0, ptr %17, align 4, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %185, %166
  %175 = load i32, ptr %15, align 4, !tbaa !9
  %176 = load i32, ptr %7, align 4, !tbaa !9
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %178, label %188

178:                                              ; preds = %174
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = load ptr, ptr %14, align 8, !tbaa !5
  %181 = load i32, ptr %15, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds ptr, ptr %180, i64 %182
  %184 = load ptr, ptr %183, align 8, !tbaa !5
  call void @png_free(ptr noundef %179, ptr noundef %184)
  br label %185

185:                                              ; preds = %178
  %186 = load i32, ptr %15, align 4, !tbaa !9
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %15, align 4, !tbaa !9
  br label %174, !llvm.loop !22

188:                                              ; preds = %174
  %189 = load ptr, ptr %12, align 8, !tbaa !5
  %190 = load ptr, ptr %14, align 8, !tbaa !5
  call void @png_free(ptr noundef %189, ptr noundef %190)
  br label %191

191:                                              ; preds = %188, %45
  br label %192

192:                                              ; preds = %191, %38
  call void @png_destroy_write_struct(ptr noundef %12, ptr noundef %13)
  br label %193

193:                                              ; preds = %192, %32
  %194 = load ptr, ptr %11, align 8, !tbaa !5
  %195 = call i32 @fclose(ptr noundef %194)
  br label %196

196:                                              ; preds = %193, %27
  %197 = load i32, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret i32 %197
}

; 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

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

declare noalias ptr @png_create_info_struct(ptr noundef) #2

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

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_set_IHDR(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

declare noalias ptr @png_malloc(ptr noundef, i64 noundef) #2

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

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

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

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

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

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

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

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

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

declare i32 @fclose(ptr noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 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 #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 "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 }
attributes #7 = { nounwind returns_twice }
attributes #8 = { 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, !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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2}
!16 = !{!15, !7, i64 1}
!17 = !{!15, !7, i64 2}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}


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

%struct.pixel_t = type { i8, i8, i8 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @save_png(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i8 noundef signext %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.pixel_t, align 1
  %9 = alloca %struct.pixel_t, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store ptr null, ptr %7, align 8, !tbaa !5
  %10 = call noalias ptr @fopen(ptr noundef %3, ptr noundef nonnull @.str)
  %11 = icmp eq ptr %10, null
  br i1 %11, label %72, label %12

12:                                               ; preds = %5
  %13 = call noalias ptr @png_create_write_struct(ptr noundef nonnull @.str.1, ptr noundef null, ptr noundef null, ptr noundef null) #6
  store ptr %13, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %70, label %15

15:                                               ; preds = %12
  %16 = call noalias ptr @png_create_info_struct(ptr noundef nonnull %13) #6
  store ptr %16, ptr %7, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %69, label %18

18:                                               ; preds = %15
  %19 = call ptr @png_set_longjmp_fn(ptr noundef nonnull %13, ptr noundef nonnull @longjmp, i64 noundef 200) #6
  %20 = call i32 @_setjmp(ptr noundef %19) #7
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %21, label %69

21:                                               ; preds = %18
  %22 = sext i32 %1 to i64
  call void @png_set_IHDR(ptr noundef nonnull %13, ptr noundef nonnull %16, i32 noundef %2, i32 noundef %1, i32 noundef 8, i32 noundef 2, i32 noundef 0, i32 noundef 0, i32 noundef 0) #6
  %23 = shl nsw i64 %22, 3
  %24 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %23) #6
  %25 = icmp sgt i32 %1, 0
  br i1 %25, label %.lr.ph74, label %._crit_edge80.critedge

.lr.ph74:                                         ; preds = %21
  %26 = sext i32 %2 to i64
  %27 = mul nsw i64 %26, 3
  %28 = and i8 %4, -33
  %29 = getelementptr inbounds i8, ptr %9, i64 1
  %30 = getelementptr inbounds i8, ptr %9, i64 2
  %31 = getelementptr inbounds i8, ptr %8, i64 1
  %32 = getelementptr inbounds i8, ptr %8, i64 2
  switch i8 %28, label %.lr.ph74.split [
    i8 67, label %.lr.ph74.split.us
    i8 70, label %.lr.ph74.split.us75
  ]

.lr.ph74.split.us:                                ; preds = %.lr.ph74
  %33 = icmp sgt i32 %2, 0
  br i1 %33, label %.preheader.us.us.preheader, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.lr.ph74.split.us
  %wide.trip.count98 = zext nneg i32 %1 to i64
  br label %.preheader.us

.preheader.us.us.preheader:                       ; preds = %.lr.ph74.split.us
  %34 = zext nneg i32 %2 to i64
  %wide.trip.count108 = zext nneg i32 %1 to i64
  br label %.preheader.us.us

.preheader.us.us:                                 ; preds = %.preheader.us.us.preheader, %..loopexit_crit_edge.us.us
  %indvars.iv105 = phi i64 [ 0, %.preheader.us.us.preheader ], [ %indvars.iv.next106, %..loopexit_crit_edge.us.us ]
  %35 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %27) #6
  %36 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv105
  store ptr %35, ptr %36, align 8, !tbaa !5
  %37 = mul nuw nsw i64 %indvars.iv105, %34
  %invariant.gep118 = getelementptr inbounds double, ptr %0, i64 %37
  br label %38

38:                                               ; preds = %.preheader.us.us, %38
  %indvars.iv100 = phi i64 [ 0, %.preheader.us.us ], [ %indvars.iv.next101, %38 ]
  %.070.us.us = phi ptr [ %35, %.preheader.us.us ], [ %45, %38 ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %8) #6
  %gep119 = getelementptr inbounds double, ptr %invariant.gep118, i64 %indvars.iv100
  %39 = load double, ptr %gep119, align 8, !tbaa !9
  call void @cmap(double noundef %39, double noundef 2.550000e+00, double noundef 0.000000e+00, ptr noundef nonnull %8)
  %40 = load i8, ptr %8, align 1, !tbaa !11
  %41 = getelementptr inbounds i8, ptr %.070.us.us, i64 1
  store i8 %40, ptr %.070.us.us, align 1, !tbaa !13
  %42 = load i8, ptr %31, align 1, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %.070.us.us, i64 2
  store i8 %42, ptr %41, align 1, !tbaa !13
  %44 = load i8, ptr %32, align 1, !tbaa !15
  %45 = getelementptr inbounds i8, ptr %.070.us.us, i64 3
  store i8 %44, ptr %43, align 1, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %8) #6
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond104.not = icmp eq i64 %indvars.iv.next101, %34
  br i1 %exitcond104.not, label %..loopexit_crit_edge.us.us, label %38, !llvm.loop !16

..loopexit_crit_edge.us.us:                       ; preds = %38
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %exitcond109.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count108
  br i1 %exitcond109.not, label %._crit_edge, label %.preheader.us.us, !llvm.loop !18

.preheader.us:                                    ; preds = %.preheader.us.preheader, %.preheader.us
  %indvars.iv95 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next96, %.preheader.us ]
  %46 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %27) #6
  %47 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv95
  store ptr %46, ptr %47, align 8, !tbaa !5
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count98
  br i1 %exitcond99.not, label %._crit_edge, label %.preheader.us, !llvm.loop !18

.lr.ph74.split.us75:                              ; preds = %.lr.ph74
  %48 = icmp sgt i32 %2, 0
  %49 = zext nneg i32 %1 to i64
  br i1 %48, label %.preheader65.us.us.preheader, label %.preheader65.us

.preheader65.us.us.preheader:                     ; preds = %.lr.ph74.split.us75
  %wide.trip.count88 = zext nneg i32 %2 to i64
  br label %.preheader65.us.us

.preheader65.us.us:                               ; preds = %.preheader65.us.us.preheader, %..loopexit66_crit_edge.us.us
  %indvars.iv90 = phi i64 [ 0, %.preheader65.us.us.preheader ], [ %indvars.iv.next91, %..loopexit66_crit_edge.us.us ]
  %50 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %27) #6
  %51 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv90
  store ptr %50, ptr %51, align 8, !tbaa !5
  %invariant.gep = getelementptr inbounds double, ptr %0, i64 %indvars.iv90
  br label %52

52:                                               ; preds = %.preheader65.us.us, %52
  %indvars.iv85 = phi i64 [ 0, %.preheader65.us.us ], [ %indvars.iv.next86, %52 ]
  %.168.us.us = phi ptr [ %50, %.preheader65.us.us ], [ %60, %52 ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %9) #6
  %53 = mul nuw nsw i64 %indvars.iv85, %49
  %gep = getelementptr inbounds double, ptr %invariant.gep, i64 %53
  %54 = load double, ptr %gep, align 8, !tbaa !9
  call void @cmap(double noundef %54, double noundef 2.550000e+00, double noundef 0.000000e+00, ptr noundef nonnull %9)
  %55 = load i8, ptr %9, align 1, !tbaa !11
  %56 = getelementptr inbounds i8, ptr %.168.us.us, i64 1
  store i8 %55, ptr %.168.us.us, align 1, !tbaa !13
  %57 = load i8, ptr %29, align 1, !tbaa !14
  %58 = getelementptr inbounds i8, ptr %.168.us.us, i64 2
  store i8 %57, ptr %56, align 1, !tbaa !13
  %59 = load i8, ptr %30, align 1, !tbaa !15
  %60 = getelementptr inbounds i8, ptr %.168.us.us, i64 3
  store i8 %59, ptr %58, align 1, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %9) #6
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %exitcond89.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count88
  br i1 %exitcond89.not, label %..loopexit66_crit_edge.us.us, label %52, !llvm.loop !19

..loopexit66_crit_edge.us.us:                     ; preds = %52
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond94.not = icmp eq i64 %indvars.iv.next91, %49
  br i1 %exitcond94.not, label %._crit_edge, label %.preheader65.us.us, !llvm.loop !18

.preheader65.us:                                  ; preds = %.lr.ph74.split.us75, %.preheader65.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader65.us ], [ 0, %.lr.ph74.split.us75 ]
  %61 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %27) #6
  %62 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv
  store ptr %61, ptr %62, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %49
  br i1 %exitcond.not, label %._crit_edge, label %.preheader65.us, !llvm.loop !18

.lr.ph74.split:                                   ; preds = %.lr.ph74
  %63 = call noalias ptr @png_malloc(ptr noundef nonnull %13, i64 noundef %27) #6
  store ptr %63, ptr %24, align 8, !tbaa !5
  %64 = sext i8 %4 to i32
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str.2, i32 noundef %64) #8
  call void @exit(i32 noundef 1) #9
  unreachable

._crit_edge:                                      ; preds = %.preheader65.us, %..loopexit66_crit_edge.us.us, %.preheader.us, %..loopexit_crit_edge.us.us
  call void @png_init_io(ptr noundef nonnull %13, ptr noundef nonnull %10) #6
  call void @png_set_rows(ptr noundef nonnull %13, ptr noundef nonnull %16, ptr noundef %24) #6
  call void @png_write_png(ptr noundef nonnull %13, ptr noundef nonnull %16, i32 noundef 0, ptr noundef null) #6
  br i1 %25, label %.lr.ph.preheader, label %._crit_edge80

.lr.ph.preheader:                                 ; preds = %._crit_edge
  %wide.trip.count113 = zext nneg i32 %1 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv110 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next111, %.lr.ph ]
  %67 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv110
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  call void @png_free(ptr noundef nonnull %13, ptr noundef %68) #6
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count113
  br i1 %exitcond114.not, label %._crit_edge80, label %.lr.ph, !llvm.loop !20

._crit_edge80.critedge:                           ; preds = %21
  call void @png_init_io(ptr noundef nonnull %13, ptr noundef nonnull %10) #6
  call void @png_set_rows(ptr noundef nonnull %13, ptr noundef nonnull %16, ptr noundef %24) #6
  call void @png_write_png(ptr noundef nonnull %13, ptr noundef nonnull %16, i32 noundef 0, ptr noundef null) #6
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %.lr.ph, %._crit_edge80.critedge, %._crit_edge
  call void @png_free(ptr noundef nonnull %13, ptr noundef %24) #6
  br label %69

69:                                               ; preds = %._crit_edge80, %18, %15
  %.055 = phi i32 [ -1, %15 ], [ -1, %18 ], [ 0, %._crit_edge80 ]
  call void @png_destroy_write_struct(ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  br label %70

70:                                               ; preds = %12, %69
  %.156 = phi i32 [ -1, %12 ], [ %.055, %69 ]
  %71 = call i32 @fclose(ptr noundef nonnull %10)
  br label %72

72:                                               ; preds = %5, %70
  %.2 = phi i32 [ -1, %5 ], [ %.156, %70 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  ret i32 %.2
}

; 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

declare noalias ptr @png_create_write_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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

declare void @png_set_IHDR(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare noalias ptr @png_malloc(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @cmap(double noundef, double noundef, double noundef, ptr 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

; 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 #5

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

declare void @png_set_rows(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @png_write_png(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @png_free(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @png_destroy_write_struct(ptr noundef, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { "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 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind returns_twice }
attributes #8 = { cold nounwind }
attributes #9 = { 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, !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 = !{!"double", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2}
!13 = !{!7, !7, i64 0}
!14 = !{!12, !7, i64 1}
!15 = !{!12, !7, i64 2}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass