; 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_circle_filled = type { %struct.nk_command, i16, i16, i16, i16, %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_circle = external hidden unnamed_addr constant [81 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_circle(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3) #4 {
  %5 = alloca %struct.nk_rect, align 4
  %6 = alloca %struct.nk_color, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 0
  store <2 x float> %1, ptr %11, align 4
  %12 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 1
  store <2 x float> %2, ptr %12, align 4
  store i32 %3, ptr %6, align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %4
  br label %17

16:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.2, i32 noundef 8954, ptr noundef @__PRETTY_FUNCTION__.nk_fill_circle) #6
  unreachable

17:                                               ; preds = %15
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %33

20:                                               ; preds = %17
  %21 = getelementptr inbounds %struct.nk_color, ptr %6, i32 0, i32 3
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = zext i8 %22 to i32
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %33, label %25

25:                                               ; preds = %20
  %26 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 2
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = fcmp oeq float %27, 0.000000e+00
  br i1 %28, label %33, label %29

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

33:                                               ; preds = %29, %25, %20, %17
  store i32 1, ptr %9, align 4
  br label %131

34:                                               ; preds = %29
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nk_command_buffer, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !15
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %88

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.nk_command_buffer, ptr %40, i32 0, i32 1
  store ptr %41, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.nk_rect, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !19
  %45 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 0
  %46 = load float, ptr %45, align 4, !tbaa !19
  %47 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 2
  %48 = load float, ptr %47, align 4, !tbaa !11
  %49 = fadd float %46, %48
  %50 = fcmp ogt float %44, %49
  br i1 %50, label %83, label %51

51:                                               ; preds = %39
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.nk_rect, ptr %52, i32 0, i32 0
  %54 = load float, ptr %53, align 4, !tbaa !19
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.nk_rect, ptr %55, i32 0, i32 2
  %57 = load float, ptr %56, align 4, !tbaa !11
  %58 = fadd float %54, %57
  %59 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 0
  %60 = load float, ptr %59, align 4, !tbaa !19
  %61 = fcmp olt float %58, %60
  br i1 %61, label %83, label %62

62:                                               ; preds = %51
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.nk_rect, ptr %63, i32 0, i32 1
  %65 = load float, ptr %64, align 4, !tbaa !20
  %66 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 1
  %67 = load float, ptr %66, align 4, !tbaa !20
  %68 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 3
  %69 = load float, ptr %68, align 4, !tbaa !14
  %70 = fadd float %67, %69
  %71 = fcmp ogt float %65, %70
  br i1 %71, label %83, label %72

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

83:                                               ; preds = %72, %62, %51, %39
  store i32 1, ptr %9, align 4
  br label %85

84:                                               ; preds = %72
  store i32 0, ptr %9, align 4
  br label %85

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

87:                                               ; preds = %85
  br label %88

88:                                               ; preds = %87, %34
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = call ptr @nk_command_buffer_push(ptr noundef %89, i32 noundef 8, i64 noundef 32)
  store ptr %90, ptr %8, align 8, !tbaa !5
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %94, label %93

93:                                               ; preds = %88
  store i32 1, ptr %9, align 4
  br label %131

94:                                               ; preds = %88
  %95 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 0
  %96 = load float, ptr %95, align 4, !tbaa !19
  %97 = fptosi float %96 to i16
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.nk_command_circle_filled, ptr %98, i32 0, i32 1
  store i16 %97, ptr %99, align 8, !tbaa !21
  %100 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 1
  %101 = load float, ptr %100, align 4, !tbaa !20
  %102 = fptosi float %101 to i16
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.nk_command_circle_filled, ptr %103, i32 0, i32 2
  store i16 %102, ptr %104, align 2, !tbaa !25
  %105 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 2
  %106 = load float, ptr %105, align 4, !tbaa !11
  %107 = fcmp olt float %106, 0.000000e+00
  br i1 %107, label %108, label %109

108:                                              ; preds = %94
  br label %112

109:                                              ; preds = %94
  %110 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 2
  %111 = load float, ptr %110, align 4, !tbaa !11
  br label %112

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

120:                                              ; preds = %112
  br label %124

121:                                              ; preds = %112
  %122 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 3
  %123 = load float, ptr %122, align 4, !tbaa !14
  br label %124

124:                                              ; preds = %121, %120
  %125 = phi float [ 0.000000e+00, %120 ], [ %123, %121 ]
  %126 = fptoui float %125 to i16
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.nk_command_circle_filled, ptr %127, i32 0, i32 4
  store i16 %126, ptr %128, align 2, !tbaa !27
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.nk_command_circle_filled, ptr %129, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %130, ptr align 1 %6, i64 4, i1 false), !tbaa.struct !28
  store i32 0, ptr %9, align 4
  br label %131

131:                                              ; preds = %124, %93, %85, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %132 = load i32, ptr %9, align 4
  switch i32 %132, label %134 [
    i32 0, label %133
    i32 1, label %133
  ]

133:                                              ; preds = %131, %131
  ret void

134:                                              ; preds = %131
  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, !7, i64 3}
!10 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!11 = !{!12, !13, i64 8}
!12 = !{!"nk_rect", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 12}
!15 = !{!16, !17, i64 24}
!16 = !{!"nk_command_buffer", !6, i64 0, !12, i64 8, !17, i64 24, !7, i64 32, !18, i64 40, !18, i64 48, !18, i64 56}
!17 = !{!"int", !7, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!12, !13, i64 0}
!20 = !{!12, !13, i64 4}
!21 = !{!22, !24, i64 16}
!22 = !{!"nk_command_circle_filled", !23, i64 0, !24, i64 16, !24, i64 18, !24, i64 20, !24, i64 22, !10, i64 24}
!23 = !{!"nk_command", !17, i64 0, !18, i64 8}
!24 = !{!"short", !7, i64 0}
!25 = !{!22, !24, i64 18}
!26 = !{!22, !24, i64 20}
!27 = !{!22, !24, i64 22}
!28 = !{i64 0, i64 1, !29, i64 1, i64 1, !29, i64 2, i64 1, !29, i64 3, i64 1, !29}
!29 = !{!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_circle = external hidden unnamed_addr constant [81 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_circle(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3) local_unnamed_addr #2 {
  %5 = extractelement <2 x float> %2, i64 1
  %.sroa.0.0.extract.trunc = trunc i32 %3 to i24
  %.sroa.2.0.extract.shift = lshr i32 %3, 24
  %.sroa.2.0.extract.trunc = trunc nuw i32 %.sroa.2.0.extract.shift to i8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 8954, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_fill_circle) #3
  unreachable

7:                                                ; preds = %4
  %8 = extractelement <2 x float> %2, i64 0
  %9 = icmp ult i32 %3, 16777216
  %10 = fcmp oeq float %8, 0.000000e+00
  %or.cond6 = select i1 %9, i1 true, i1 %10
  %11 = fcmp oeq float %5, 0.000000e+00
  %or.cond9 = select i1 %or.cond6, i1 true, i1 %11
  br i1 %or.cond9, label %45, label %12

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %.not50 = icmp eq i32 %14, 0
  br i1 %.not50, label %.critedge, label %15

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

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

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %0, i64 12
  %28 = load float, ptr %27, align 4, !tbaa !16
  %.sroa.0.4.vec.extract = extractelement <2 x float> %1, i64 1
  %29 = fadd float %.sroa.0.4.vec.extract, %5
  %30 = fcmp ogt float %28, %29
  br i1 %30, label %45, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds i8, ptr %0, i64 20
  %33 = load float, ptr %32, align 4, !tbaa !17
  %34 = fadd float %28, %33
  %35 = fcmp olt float %34, %.sroa.0.4.vec.extract
  br i1 %35, label %45, label %.critedge

.critedge:                                        ; preds = %31, %12
  %36 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 8, i64 noundef 32)
  %.not51 = icmp eq ptr %36, null
  br i1 %.not51, label %45, label %37

37:                                               ; preds = %.critedge
  %38 = getelementptr inbounds i8, ptr %36, i64 16
  %39 = fptosi <2 x float> %1 to <2 x i16>
  store <2 x i16> %39, ptr %38, align 8, !tbaa !18
  %40 = fcmp olt <2 x float> %2, zeroinitializer
  %41 = getelementptr inbounds i8, ptr %36, i64 20
  %42 = select <2 x i1> %40, <2 x float> zeroinitializer, <2 x float> %2
  %43 = fptoui <2 x float> %42 to <2 x i16>
  store <2 x i16> %43, ptr %41, align 4, !tbaa !18
  %44 = getelementptr inbounds i8, ptr %36, i64 24
  store i24 %.sroa.0.0.extract.trunc, ptr %44, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %36, i64 27
  store i8 %.sroa.2.0.extract.trunc, ptr %.sroa.2.0..sroa_idx, align 1, !tbaa !20
  br label %45

45:                                               ; preds = %.critedge, %31, %26, %21, %15, %7, %37
  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}
!20 = !{!8, !8, i64 0}


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