; LLVM IR from BrunoLevy/learn-fpga :: FemtoRV/FIRMWARE/CPP_EXAMPLES/tinyrt_cpp.ll (Z9set_pixeliifff)

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

@FGA_mode = external global i32, align 4
@_ZL6dither = external hidden constant [4 x [4 x i8]], align 16

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9set_pixeliifff(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4) #3 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %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 i8, align 1
  %18 = alloca i8, align 1
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  %22 = alloca i8, align 1
  %23 = alloca float, align 4
  %24 = alloca float, align 4
  %25 = alloca i16, align 2
  %26 = alloca i16, align 2
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store float 0.000000e+00, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store float 1.000000e+00, ptr %12, align 4, !tbaa !9
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %27)
  %29 = load float, ptr %28, align 4, !tbaa !9
  store float %29, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store float 1.000000e+00, ptr %14, align 4, !tbaa !9
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %30)
  %32 = load float, ptr %31, align 4, !tbaa !9
  store float %32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store float 0.000000e+00, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store float 1.000000e+00, ptr %16, align 4, !tbaa !9
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %33)
  %35 = load float, ptr %34, align 4, !tbaa !9
  store float %35, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %36 = load i32, ptr @FGA_mode, align 4, !tbaa !5
  switch i32 %36, label %152 [
    i32 -1, label %37
    i32 0, label %63
    i32 1, label %89
    i32 2, label %104
  ]

37:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #5
  %38 = load float, ptr %8, align 4, !tbaa !9
  %39 = fmul float 2.550000e+02, %38
  %40 = fptoui float %39 to i8
  store i8 %40, ptr %17, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #5
  %41 = load float, ptr %9, align 4, !tbaa !9
  %42 = fmul float 2.550000e+02, %41
  %43 = fptoui float %42 to i8
  store i8 %43, ptr %18, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #5
  %44 = load float, ptr %10, align 4, !tbaa !9
  %45 = fmul float 2.550000e+02, %44
  %46 = fptoui float %45 to i8
  store i8 %46, ptr %19, align 1, !tbaa !11
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = load i8, ptr %17, align 1, !tbaa !11
  %50 = zext i8 %49 to i32
  %51 = and i32 %50, 248
  %52 = shl i32 %51, 5
  %53 = load i8, ptr %18, align 1, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = and i32 %54, 248
  %56 = or i32 %52, %55
  %57 = shl i32 %56, 3
  %58 = load i8, ptr %19, align 1, !tbaa !11
  %59 = zext i8 %58 to i32
  %60 = ashr i32 %59, 3
  %61 = or i32 %57, %60
  %62 = trunc i32 %61 to i16
  call void @GL_setpixel(i32 noundef %47, i32 noundef %48, i16 noundef zeroext %62)
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  br label %152

63:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #5
  %64 = load float, ptr %8, align 4, !tbaa !9
  %65 = fmul float 2.550000e+02, %64
  %66 = fptoui float %65 to i8
  store i8 %66, ptr %20, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #5
  %67 = load float, ptr %9, align 4, !tbaa !9
  %68 = fmul float 2.550000e+02, %67
  %69 = fptoui float %68 to i8
  store i8 %69, ptr %21, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #5
  %70 = load float, ptr %10, align 4, !tbaa !9
  %71 = fmul float 2.550000e+02, %70
  %72 = fptoui float %71 to i8
  store i8 %72, ptr %22, align 1, !tbaa !11
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i8, ptr %20, align 1, !tbaa !11
  %76 = zext i8 %75 to i32
  %77 = and i32 %76, 248
  %78 = shl i32 %77, 5
  %79 = load i8, ptr %21, align 1, !tbaa !11
  %80 = zext i8 %79 to i32
  %81 = and i32 %80, 248
  %82 = or i32 %78, %81
  %83 = shl i32 %82, 3
  %84 = load i8, ptr %22, align 1, !tbaa !11
  %85 = zext i8 %84 to i32
  %86 = ashr i32 %85, 3
  %87 = or i32 %83, %86
  %88 = trunc i32 %87 to i16
  call void @FGA_setpixel(i32 noundef %73, i32 noundef %74, i16 noundef zeroext %88)
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  br label %152

89:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %90 = load float, ptr %8, align 4, !tbaa !9
  %91 = load float, ptr %9, align 4, !tbaa !9
  %92 = fmul float 0x3FE6E2EB20000000, %91
  %93 = call float @llvm.fmuladd.f32(float 0x3FCB367A00000000, float %90, float %92)
  %94 = fpext float %93 to double
  %95 = load float, ptr %10, align 4, !tbaa !9
  %96 = fpext float %95 to double
  %97 = call double @llvm.fmuladd.f64(double 7.220000e-02, double %96, double %94)
  %98 = fptrunc double %97 to float
  store float %98, ptr %23, align 4, !tbaa !9
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = load float, ptr %23, align 4, !tbaa !9
  %102 = fmul float %101, 2.550000e+02
  %103 = fptoui float %102 to i16
  call void @FGA_setpixel(i32 noundef %99, i32 noundef %100, i16 noundef zeroext %103)
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %152

104:                                              ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %105 = load float, ptr %8, align 4, !tbaa !9
  %106 = load float, ptr %9, align 4, !tbaa !9
  %107 = fmul float 0x3FE6E2EB20000000, %106
  %108 = call float @llvm.fmuladd.f32(float 0x3FCB367A00000000, float %105, float %107)
  %109 = fpext float %108 to double
  %110 = load float, ptr %10, align 4, !tbaa !9
  %111 = fpext float %110 to double
  %112 = call double @llvm.fmuladd.f64(double 7.220000e-02, double %111, double %109)
  %113 = fptrunc double %112 to float
  store float %113, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %25) #5
  %114 = load float, ptr %24, align 4, !tbaa !9
  %115 = fmul float %114, 2.550000e+02
  %116 = fptoui float %115 to i16
  store i16 %116, ptr %25, align 2, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 2, ptr %26) #5
  %117 = load i16, ptr %25, align 2, !tbaa !12
  %118 = zext i16 %117 to i32
  %119 = and i32 %118, 15
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = and i32 %120, 3
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [4 x [4 x i8]], ptr @_ZL6dither, i64 0, i64 %122
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = and i32 %124, 3
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [4 x i8], ptr %123, i64 0, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !11
  %129 = zext i8 %128 to i32
  %130 = icmp sgt i32 %119, %129
  %131 = zext i1 %130 to i16
  store i16 %131, ptr %26, align 2, !tbaa !12
  %132 = load i32, ptr %6, align 4, !tbaa !5
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = load i16, ptr %25, align 2, !tbaa !12
  %135 = zext i16 %134 to i32
  %136 = ashr i32 %135, 4
  %137 = load i16, ptr %26, align 2, !tbaa !12
  %138 = zext i16 %137 to i32
  %139 = add nsw i32 %136, %138
  %140 = icmp slt i32 %139, 15
  br i1 %140, label %141, label %148

141:                                              ; preds = %104
  %142 = load i16, ptr %25, align 2, !tbaa !12
  %143 = zext i16 %142 to i32
  %144 = ashr i32 %143, 4
  %145 = load i16, ptr %26, align 2, !tbaa !12
  %146 = zext i16 %145 to i32
  %147 = add nsw i32 %144, %146
  br label %149

148:                                              ; preds = %104
  br label %149

149:                                              ; preds = %148, %141
  %150 = phi i32 [ %147, %141 ], [ 15, %148 ]
  %151 = trunc i32 %150 to i16
  call void @FGA_setpixel(i32 noundef %132, i32 noundef %133, i16 noundef zeroext %151)
  call void @llvm.lifetime.end.p0(i64 2, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %152

152:                                              ; preds = %149, %89, %63, %37, %5
  ret void
}

declare void @GL_setpixel(i32 noundef, i32 noundef, i16 noundef zeroext) #4

declare void @FGA_setpixel(i32 noundef, i32 noundef, i16 noundef zeroext) #4

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !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"

@FGA_mode = external local_unnamed_addr global i32, align 4
@_ZL6dither = external hidden local_unnamed_addr constant [4 x [4 x i8]], align 16

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9set_pixeliifff(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #3 {
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %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
  store float %2, ptr %6, align 4, !tbaa !5
  store float %3, ptr %7, align 4, !tbaa !5
  store float %4, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store float 0.000000e+00, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store float 1.000000e+00, ptr %10, align 4, !tbaa !5
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %17 = load float, ptr %16, align 4, !tbaa !5
  store float %17, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  store float 0.000000e+00, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  store float 1.000000e+00, ptr %12, align 4, !tbaa !5
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %20 = load float, ptr %19, align 4, !tbaa !5
  store float %20, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #6
  store float 0.000000e+00, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #6
  store float 1.000000e+00, ptr %14, align 4, !tbaa !5
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %23 = load float, ptr %22, align 4, !tbaa !5
  store float %23, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #6
  %24 = load i32, ptr @FGA_mode, align 4, !tbaa !9
  switch i32 %24, label %96 [
    i32 -1, label %25
    i32 0, label %42
    i32 1, label %59
    i32 2, label %70
  ]

25:                                               ; preds = %5
  %26 = load float, ptr %6, align 4, !tbaa !5
  %27 = load float, ptr %7, align 4, !tbaa !5
  %28 = fmul float %23, 2.550000e+02
  %29 = fptoui float %28 to i8
  %30 = insertelement <2 x float> poison, float %27, i64 0
  %31 = insertelement <2 x float> %30, float %26, i64 1
  %32 = fmul <2 x float> %31, <float 2.550000e+02, float 2.550000e+02>
  %33 = fptoui <2 x float> %32 to <2 x i8>
  %34 = and <2 x i8> %33, <i8 -8, i8 -8>
  %35 = zext <2 x i8> %34 to <2 x i16>
  %36 = shl nuw <2 x i16> %35, <i16 3, i16 8>
  %shift = shufflevector <2 x i16> %36, <2 x i16> poison, <2 x i32> <i32 1, i32 poison>
  %37 = or disjoint <2 x i16> %36, %shift
  %38 = extractelement <2 x i16> %37, i64 0
  %39 = lshr i8 %29, 3
  %40 = zext nneg i8 %39 to i16
  %41 = or disjoint i16 %38, %40
  call void @GL_setpixel(i32 noundef %0, i32 noundef %1, i16 noundef zeroext %41)
  br label %96

42:                                               ; preds = %5
  %43 = load float, ptr %6, align 4, !tbaa !5
  %44 = load float, ptr %7, align 4, !tbaa !5
  %45 = fmul float %23, 2.550000e+02
  %46 = fptoui float %45 to i8
  %47 = insertelement <2 x float> poison, float %44, i64 0
  %48 = insertelement <2 x float> %47, float %43, i64 1
  %49 = fmul <2 x float> %48, <float 2.550000e+02, float 2.550000e+02>
  %50 = fptoui <2 x float> %49 to <2 x i8>
  %51 = and <2 x i8> %50, <i8 -8, i8 -8>
  %52 = zext <2 x i8> %51 to <2 x i16>
  %53 = shl nuw <2 x i16> %52, <i16 3, i16 8>
  %shift22 = shufflevector <2 x i16> %53, <2 x i16> poison, <2 x i32> <i32 1, i32 poison>
  %54 = or disjoint <2 x i16> %53, %shift22
  %55 = extractelement <2 x i16> %54, i64 0
  %56 = lshr i8 %46, 3
  %57 = zext nneg i8 %56 to i16
  %58 = or disjoint i16 %55, %57
  call void @FGA_setpixel(i32 noundef %0, i32 noundef %1, i16 noundef zeroext %58)
  br label %96

59:                                               ; preds = %5
  %60 = load float, ptr %6, align 4, !tbaa !5
  %61 = load float, ptr %7, align 4, !tbaa !5
  %62 = fmul float %61, 0x3FE6E2EB20000000
  %63 = call float @llvm.fmuladd.f32(float %60, float 0x3FCB367A00000000, float %62)
  %64 = fpext float %63 to double
  %65 = fpext float %23 to double
  %66 = call double @llvm.fmuladd.f64(double %65, double 7.220000e-02, double %64)
  %67 = fptrunc double %66 to float
  %68 = fmul float %67, 2.550000e+02
  %69 = fptoui float %68 to i16
  call void @FGA_setpixel(i32 noundef %0, i32 noundef %1, i16 noundef zeroext %69)
  br label %96

70:                                               ; preds = %5
  %71 = load float, ptr %6, align 4, !tbaa !5
  %72 = load float, ptr %7, align 4, !tbaa !5
  %73 = fmul float %72, 0x3FE6E2EB20000000
  %74 = call float @llvm.fmuladd.f32(float %71, float 0x3FCB367A00000000, float %73)
  %75 = fpext float %74 to double
  %76 = fpext float %23 to double
  %77 = call double @llvm.fmuladd.f64(double %76, double 7.220000e-02, double %75)
  %78 = fptrunc double %77 to float
  %79 = fmul float %78, 2.550000e+02
  %80 = fptoui float %79 to i16
  %81 = zext i16 %80 to i32
  %82 = and i32 %81, 15
  %83 = and i32 %0, 3
  %84 = zext nneg i32 %83 to i64
  %85 = and i32 %1, 3
  %86 = zext nneg i32 %85 to i64
  %87 = getelementptr inbounds [4 x [4 x i8]], ptr @_ZL6dither, i64 0, i64 %84, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !11
  %89 = zext i8 %88 to i32
  %90 = icmp ugt i32 %82, %89
  %91 = lshr i32 %81, 4
  %92 = zext i1 %90 to i32
  %93 = add nuw nsw i32 %91, %92
  %94 = call i32 @llvm.umin.i32(i32 %93, i32 15)
  %95 = trunc nuw nsw i32 %94 to i16
  call void @FGA_setpixel(i32 noundef %0, i32 noundef %1, i16 noundef zeroext %95)
  br label %96

96:                                               ; preds = %70, %59, %42, %25, %5
  ret void
}

declare void @GL_setpixel(i32 noundef, i32 noundef, i16 noundef zeroext) local_unnamed_addr #4

declare void @FGA_setpixel(i32 noundef, i32 noundef, i16 noundef zeroext) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass