; LLVM IR from rdguez-mariano/fast_imas_IPOL :: io_png/libs/png (pngset)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

declare i32 @png_check_cHRM_fixed(ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #1

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

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

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

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

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

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

28:                                               ; preds = %3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %3
  store i32 1, ptr %25, align 4
  br label %84

32:                                               ; preds = %28
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i32, ptr %6, align 4, !tbaa !9
  call void @png_set_sRGB(ptr noundef %33, ptr noundef %34, i32 noundef %35)
  store float 0x3FDD1758E0000000, ptr %7, align 4, !tbaa !11
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load float, ptr %7, align 4, !tbaa !11
  %39 = fpext float %38 to double
  call void @png_set_gAMA(ptr noundef %36, ptr noundef %37, double noundef %39)
  store i64 45455, ptr %8, align 8, !tbaa !13
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i64, ptr %8, align 8, !tbaa !13
  call void @png_set_gAMA_fixed(ptr noundef %40, ptr noundef %41, i64 noundef %42)
  store i64 31270, ptr %17, align 8, !tbaa !13
  store i64 32900, ptr %18, align 8, !tbaa !13
  store i64 64000, ptr %19, align 8, !tbaa !13
  store i64 33000, ptr %20, align 8, !tbaa !13
  store i64 30000, ptr %21, align 8, !tbaa !13
  store i64 60000, ptr %22, align 8, !tbaa !13
  store i64 15000, ptr %23, align 8, !tbaa !13
  store i64 6000, ptr %24, align 8, !tbaa !13
  store float 0x3FD40346E0000000, ptr %9, align 4, !tbaa !11
  store float 0x3FD50E5600000000, ptr %10, align 4, !tbaa !11
  store float 0x3FE47AE140000000, ptr %11, align 4, !tbaa !11
  store float 0x3FD51EB860000000, ptr %12, align 4, !tbaa !11
  store float 0x3FD3333340000000, ptr %13, align 4, !tbaa !11
  store float 0x3FE3333340000000, ptr %14, align 4, !tbaa !11
  store float 0x3FC3333340000000, ptr %15, align 4, !tbaa !11
  store float 0x3FAEB851E0000000, ptr %16, align 4, !tbaa !11
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load i64, ptr %17, align 8, !tbaa !13
  %45 = load i64, ptr %18, align 8, !tbaa !13
  %46 = load i64, ptr %19, align 8, !tbaa !13
  %47 = load i64, ptr %20, align 8, !tbaa !13
  %48 = load i64, ptr %21, align 8, !tbaa !13
  %49 = load i64, ptr %22, align 8, !tbaa !13
  %50 = load i64, ptr %23, align 8, !tbaa !13
  %51 = load i64, ptr %24, align 8, !tbaa !13
  %52 = call i32 @png_check_cHRM_fixed(ptr noundef %43, i64 noundef %44, i64 noundef %45, i64 noundef %46, i64 noundef %47, i64 noundef %48, i64 noundef %49, i64 noundef %50, i64 noundef %51)
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %83

54:                                               ; preds = %32
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load i64, ptr %17, align 8, !tbaa !13
  %58 = load i64, ptr %18, align 8, !tbaa !13
  %59 = load i64, ptr %19, align 8, !tbaa !13
  %60 = load i64, ptr %20, align 8, !tbaa !13
  %61 = load i64, ptr %21, align 8, !tbaa !13
  %62 = load i64, ptr %22, align 8, !tbaa !13
  %63 = load i64, ptr %23, align 8, !tbaa !13
  %64 = load i64, ptr %24, align 8, !tbaa !13
  call void @png_set_cHRM_fixed(ptr noundef %55, ptr noundef %56, i64 noundef %57, i64 noundef %58, i64 noundef %59, i64 noundef %60, i64 noundef %61, i64 noundef %62, i64 noundef %63, i64 noundef %64)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load float, ptr %9, align 4, !tbaa !11
  %68 = fpext float %67 to double
  %69 = load float, ptr %10, align 4, !tbaa !11
  %70 = fpext float %69 to double
  %71 = load float, ptr %11, align 4, !tbaa !11
  %72 = fpext float %71 to double
  %73 = load float, ptr %12, align 4, !tbaa !11
  %74 = fpext float %73 to double
  %75 = load float, ptr %13, align 4, !tbaa !11
  %76 = fpext float %75 to double
  %77 = load float, ptr %14, align 4, !tbaa !11
  %78 = fpext float %77 to double
  %79 = load float, ptr %15, align 4, !tbaa !11
  %80 = fpext float %79 to double
  %81 = load float, ptr %16, align 4, !tbaa !11
  %82 = fpext float %81 to double
  call void @png_set_cHRM(ptr noundef %65, ptr noundef %66, double noundef %68, double noundef %70, double noundef %72, double noundef %74, double noundef %76, double noundef %78, double noundef %80, double noundef %82)
  br label %83

83:                                               ; preds = %54, %32
  store i32 0, ptr %25, align 4
  br label %84

84:                                               ; preds = %83, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %85 = load i32, ptr %25, align 4
  switch i32 %85, label %87 [
    i32 0, label %86
    i32 1, label %86
  ]

86:                                               ; preds = %84, %84
  ret void

87:                                               ; preds = %84
  unreachable
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind }

!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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}


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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_set_sRGB_gAMA_and_cHRM(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %9, label %6

6:                                                ; preds = %3
  tail call void @png_set_sRGB(ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef %2)
  tail call void @png_set_gAMA(ptr noundef nonnull %0, ptr noundef nonnull %1, double noundef 0x3FDD1758E0000000)
  tail call void @png_set_gAMA_fixed(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 45455)
  %7 = tail call i32 @png_check_cHRM_fixed(ptr noundef nonnull %0, i64 noundef 31270, i64 noundef 32900, i64 noundef 64000, i64 noundef 33000, i64 noundef 30000, i64 noundef 60000, i64 noundef 15000, i64 noundef 6000) #2
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %9, label %8

8:                                                ; preds = %6
  tail call void @png_set_cHRM_fixed(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 31270, i64 noundef 32900, i64 noundef 64000, i64 noundef 33000, i64 noundef 30000, i64 noundef 60000, i64 noundef 15000, i64 noundef 6000)
  tail call void @png_set_cHRM(ptr noundef nonnull %0, ptr noundef nonnull %1, double noundef 0x3FD40346E0000000, double noundef 0x3FD50E5600000000, double noundef 0x3FE47AE140000000, double noundef 0x3FD51EB860000000, double noundef 0x3FD3333340000000, double noundef 0x3FE3333340000000, double noundef 0x3FC3333340000000, double noundef 0x3FAEB851E0000000)
  br label %9

9:                                                ; preds = %6, %8, %3
  ret void
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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)"}


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