; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (gamma)

; 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.nk_rect = type { float, float, float, float }
%struct.nk_color = type { i8, i8, i8, i8 }
%struct.nk_command_buffer = type { ptr, %struct.nk_rect, i32, %union.nk_handle, i64, i64, i64 }
%union.nk_handle = type { ptr }
%struct.nk_command_rect_multi_color = type { %struct.nk_command, i16, i16, i16, i16, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color }
%struct.nk_command = type { i32, i64 }

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@__PRETTY_FUNCTION__.nk_fill_rect_multi_color = external hidden unnamed_addr constant [142 x i8], align 1

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_command_buffer_push(ptr noundef, i32 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @nk_fill_rect_multi_color(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3, i32 %4, i32 %5, i32 %6) #4 {
  %8 = alloca %struct.nk_rect, align 4
  %9 = alloca %struct.nk_color, align 1
  %10 = alloca %struct.nk_color, align 1
  %11 = alloca %struct.nk_color, align 1
  %12 = alloca %struct.nk_color, align 1
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  store <2 x float> %1, ptr %17, align 4
  %18 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  store <2 x float> %2, ptr %18, align 4
  store i32 %3, ptr %9, align 1
  store i32 %4, ptr %10, align 1
  store i32 %5, ptr %11, align 1
  store i32 %6, ptr %12, align 1
  store ptr %0, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %19 = load ptr, ptr %13, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %7
  br label %23

22:                                               ; preds = %7
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.2, i32 noundef 8908, ptr noundef @__PRETTY_FUNCTION__.nk_fill_rect_multi_color) #6
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %34

26:                                               ; preds = %23
  %27 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 2
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = fcmp oeq float %28, 0.000000e+00
  br i1 %29, label %34, label %30

30:                                               ; preds = %26
  %31 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 3
  %32 = load float, ptr %31, align 4, !tbaa !12
  %33 = fcmp oeq float %32, 0.000000e+00
  br i1 %33, label %34, label %35

34:                                               ; preds = %30, %26, %23
  store i32 1, ptr %15, align 4
  br label %138

35:                                               ; preds = %30
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.nk_command_buffer, ptr %36, i32 0, i32 2
  %38 = load i32, ptr %37, align 8, !tbaa !13
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %89

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.nk_command_buffer, ptr %41, i32 0, i32 1
  store ptr %42, ptr %16, align 8, !tbaa !5
  %43 = load ptr, ptr %16, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.nk_rect, ptr %43, i32 0, i32 0
  %45 = load float, ptr %44, align 4, !tbaa !17
  %46 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 0
  %47 = load float, ptr %46, align 4, !tbaa !17
  %48 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 2
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = fadd float %47, %49
  %51 = fcmp ogt float %45, %50
  br i1 %51, label %84, label %52

52:                                               ; preds = %40
  %53 = load ptr, ptr %16, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.nk_rect, ptr %53, i32 0, i32 0
  %55 = load float, ptr %54, align 4, !tbaa !17
  %56 = load ptr, ptr %16, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.nk_rect, ptr %56, i32 0, i32 2
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = fadd float %55, %58
  %60 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 0
  %61 = load float, ptr %60, align 4, !tbaa !17
  %62 = fcmp olt float %59, %61
  br i1 %62, label %84, label %63

63:                                               ; preds = %52
  %64 = load ptr, ptr %16, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.nk_rect, ptr %64, i32 0, i32 1
  %66 = load float, ptr %65, align 4, !tbaa !18
  %67 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 1
  %68 = load float, ptr %67, align 4, !tbaa !18
  %69 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 3
  %70 = load float, ptr %69, align 4, !tbaa !12
  %71 = fadd float %68, %70
  %72 = fcmp ogt float %66, %71
  br i1 %72, label %84, label %73

73:                                               ; preds = %63
  %74 = load ptr, ptr %16, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.nk_rect, ptr %74, i32 0, i32 1
  %76 = load float, ptr %75, align 4, !tbaa !18
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.nk_rect, ptr %77, i32 0, i32 3
  %79 = load float, ptr %78, align 4, !tbaa !12
  %80 = fadd float %76, %79
  %81 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 1
  %82 = load float, ptr %81, align 4, !tbaa !18
  %83 = fcmp olt float %80, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %73, %63, %52, %40
  store i32 1, ptr %15, align 4
  br label %86

85:                                               ; preds = %73
  store i32 0, ptr %15, align 4
  br label %86

86:                                               ; preds = %85, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %87 = load i32, ptr %15, align 4
  switch i32 %87, label %138 [
    i32 0, label %88
  ]

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88, %35
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = call ptr @nk_command_buffer_push(ptr noundef %90, i32 noundef 6, i64 noundef 40)
  store ptr %91, ptr %14, align 8, !tbaa !5
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %95, label %94

94:                                               ; preds = %89
  store i32 1, ptr %15, align 4
  br label %138

95:                                               ; preds = %89
  %96 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 0
  %97 = load float, ptr %96, align 4, !tbaa !17
  %98 = fptosi float %97 to i16
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %99, i32 0, i32 1
  store i16 %98, ptr %100, align 8, !tbaa !19
  %101 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 1
  %102 = load float, ptr %101, align 4, !tbaa !18
  %103 = fptosi float %102 to i16
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %104, i32 0, i32 2
  store i16 %103, ptr %105, align 2, !tbaa !24
  %106 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 2
  %107 = load float, ptr %106, align 4, !tbaa !9
  %108 = fcmp olt float 0.000000e+00, %107
  br i1 %108, label %109, label %112

109:                                              ; preds = %95
  %110 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 2
  %111 = load float, ptr %110, align 4, !tbaa !9
  br label %113

112:                                              ; preds = %95
  br label %113

113:                                              ; preds = %112, %109
  %114 = phi float [ %111, %109 ], [ 0.000000e+00, %112 ]
  %115 = fptoui float %114 to i16
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %116, i32 0, i32 3
  store i16 %115, ptr %117, align 4, !tbaa !25
  %118 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 3
  %119 = load float, ptr %118, align 4, !tbaa !12
  %120 = fcmp olt float 0.000000e+00, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %113
  %122 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 3
  %123 = load float, ptr %122, align 4, !tbaa !12
  br label %125

124:                                              ; preds = %113
  br label %125

125:                                              ; preds = %124, %121
  %126 = phi float [ %123, %121 ], [ 0.000000e+00, %124 ]
  %127 = fptoui float %126 to i16
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %128, i32 0, i32 4
  store i16 %127, ptr %129, align 2, !tbaa !26
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %130, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %131, ptr align 1 %9, i64 4, i1 false), !tbaa.struct !27
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %132, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %133, ptr align 1 %10, i64 4, i1 false), !tbaa.struct !27
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %134, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %135, ptr align 1 %11, i64 4, i1 false), !tbaa.struct !27
  %136 = load ptr, ptr %14, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.nk_command_rect_multi_color, ptr %136, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %137, ptr align 1 %12, i64 4, i1 false), !tbaa.struct !27
  store i32 0, ptr %15, align 4
  br label %138

138:                                              ; preds = %125, %94, %86, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %139 = load i32, ptr %15, align 4
  switch i32 %139, label %141 [
    i32 0, label %140
    i32 1, label %140
  ]

140:                                              ; preds = %138, %138
  ret void

141:                                              ; preds = %138
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind uwtable "min-legal-vector-width"="64" "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 }
attributes #6 = { 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, !11, i64 8}
!10 = !{!"nk_rect", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!14, !15, i64 24}
!14 = !{!"nk_command_buffer", !6, i64 0, !10, i64 8, !15, i64 24, !7, i64 32, !16, i64 40, !16, i64 48, !16, i64 56}
!15 = !{!"int", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !11, i64 4}
!19 = !{!20, !22, i64 16}
!20 = !{!"nk_command_rect_multi_color", !21, i64 0, !22, i64 16, !22, i64 18, !22, i64 20, !22, i64 22, !23, i64 24, !23, i64 28, !23, i64 32, !23, i64 36}
!21 = !{!"nk_command", !15, i64 0, !16, i64 8}
!22 = !{!"short", !7, i64 0}
!23 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!24 = !{!20, !22, i64 18}
!25 = !{!20, !22, i64 20}
!26 = !{!20, !22, i64 22}
!27 = !{i64 0, i64 1, !28, i64 1, i64 1, !28, i64 2, i64 1, !28, i64 3, i64 1, !28}
!28 = !{!7, !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"

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@__PRETTY_FUNCTION__.nk_fill_rect_multi_color = external hidden unnamed_addr constant [142 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_command_buffer_push(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @nk_fill_rect_multi_color(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3, i32 %4, i32 %5, i32 %6) local_unnamed_addr #2 {
  %8 = extractelement <2 x float> %2, i64 1
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %9, label %10

9:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 8908, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_fill_rect_multi_color) #3
  unreachable

10:                                               ; preds = %7
  %11 = extractelement <2 x float> %2, i64 0
  %12 = fcmp oeq float %11, 0.000000e+00
  %13 = fcmp oeq float %8, 0.000000e+00
  %or.cond5 = select i1 %12, i1 true, i1 %13
  br i1 %or.cond5, label %50, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %.not53 = icmp eq i32 %16, 0
  br i1 %.not53, label %.critedge, label %17

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load float, ptr %18, align 4, !tbaa !14
  %20 = fadd <2 x float> %1, %2
  %21 = extractelement <2 x float> %20, i64 0
  %22 = fcmp ogt float %19, %21
  br i1 %22, label %50, label %23

23:                                               ; preds = %17
  %.sroa.028.0.vec.extract = extractelement <2 x float> %1, i64 0
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load float, ptr %24, align 4, !tbaa !15
  %26 = fadd float %19, %25
  %27 = fcmp olt float %26, %.sroa.028.0.vec.extract
  br i1 %27, label %50, label %28

28:                                               ; preds = %23
  %29 = getelementptr inbounds i8, ptr %0, i64 12
  %30 = load float, ptr %29, align 4, !tbaa !16
  %.sroa.028.4.vec.extract = extractelement <2 x float> %1, i64 1
  %31 = fadd float %.sroa.028.4.vec.extract, %8
  %32 = fcmp ogt float %30, %31
  br i1 %32, label %50, label %33

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %0, i64 20
  %35 = load float, ptr %34, align 4, !tbaa !17
  %36 = fadd float %30, %35
  %37 = fcmp olt float %36, %.sroa.028.4.vec.extract
  br i1 %37, label %50, label %.critedge

.critedge:                                        ; preds = %33, %14
  %38 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 6, i64 noundef 40)
  %.not54 = icmp eq ptr %38, null
  br i1 %.not54, label %50, label %39

39:                                               ; preds = %.critedge
  %40 = getelementptr inbounds i8, ptr %38, i64 16
  %41 = fptosi <2 x float> %1 to <2 x i16>
  store <2 x i16> %41, ptr %40, align 8, !tbaa !18
  %42 = fcmp ogt <2 x float> %2, zeroinitializer
  %43 = getelementptr inbounds i8, ptr %38, i64 20
  %44 = select <2 x i1> %42, <2 x float> %2, <2 x float> zeroinitializer
  %45 = fptoui <2 x float> %44 to <2 x i16>
  store <2 x i16> %45, ptr %43, align 4, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %38, i64 24
  store i32 %3, ptr %46, align 8
  %47 = getelementptr inbounds i8, ptr %38, i64 28
  store i32 %4, ptr %47, align 4
  %48 = getelementptr inbounds i8, ptr %38, i64 36
  store i32 %5, ptr %48, align 4
  %49 = getelementptr inbounds i8, ptr %38, i64 32
  store i32 %6, ptr %49, align 8
  br label %50

50:                                               ; preds = %.critedge, %33, %28, %23, %17, %10, %39
  ret void
}

attributes #0 = { 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 #1 = { 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 = { nounwind uwtable "min-legal-vector-width"="64" "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 }

!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, !12, i64 24}
!6 = !{!"nk_command_buffer", !7, i64 0, !10, i64 8, !12, i64 24, !8, i64 32, !13, i64 40, !13, i64 48, !13, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"nk_rect", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !11, i64 4}
!17 = !{!10, !11, i64 12}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !8, i64 0}


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