; 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 = type { %struct.nk_command, i16, i16, i16, i16, i16, %struct.nk_color }
%struct.nk_command = type { i32, i64 }

; 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: nounwind uwtable
declare hidden ptr @nk_command_buffer_push(ptr noundef, i32 noundef, i64 noundef) #2

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

17:                                               ; preds = %5
  %18 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = fcmp oeq float %19, 0.000000e+00
  br i1 %20, label %28, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %23 = load float, ptr %22, align 4, !tbaa !13
  %24 = fcmp oeq float %23, 0.000000e+00
  br i1 %24, label %28, label %25

25:                                               ; preds = %21
  %26 = load float, ptr %9, align 4, !tbaa !9
  %27 = fcmp ole float %26, 0.000000e+00
  br i1 %27, label %28, label %29

28:                                               ; preds = %25, %21, %17, %5
  store i32 1, ptr %11, align 4
  br label %130

29:                                               ; preds = %25
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nk_command_buffer, ptr %30, i32 0, i32 2
  %32 = load i32, ptr %31, align 8, !tbaa !14
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %83

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nk_command_buffer, ptr %35, i32 0, i32 1
  store ptr %36, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nk_rect, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4, !tbaa !18
  %40 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %41 = load float, ptr %40, align 4, !tbaa !18
  %42 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = fadd float %41, %43
  %45 = fcmp ogt float %39, %44
  br i1 %45, label %78, label %46

46:                                               ; preds = %34
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.nk_rect, ptr %47, i32 0, i32 0
  %49 = load float, ptr %48, align 4, !tbaa !18
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nk_rect, ptr %50, i32 0, i32 2
  %52 = load float, ptr %51, align 4, !tbaa !11
  %53 = fadd float %49, %52
  %54 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %55 = load float, ptr %54, align 4, !tbaa !18
  %56 = fcmp olt float %53, %55
  br i1 %56, label %78, label %57

57:                                               ; preds = %46
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.nk_rect, ptr %58, i32 0, i32 1
  %60 = load float, ptr %59, align 4, !tbaa !19
  %61 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %62 = load float, ptr %61, align 4, !tbaa !19
  %63 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %64 = load float, ptr %63, align 4, !tbaa !13
  %65 = fadd float %62, %64
  %66 = fcmp ogt float %60, %65
  br i1 %66, label %78, label %67

67:                                               ; preds = %57
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.nk_rect, ptr %68, i32 0, i32 1
  %70 = load float, ptr %69, align 4, !tbaa !19
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.nk_rect, ptr %71, i32 0, i32 3
  %73 = load float, ptr %72, align 4, !tbaa !13
  %74 = fadd float %70, %73
  %75 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %76 = load float, ptr %75, align 4, !tbaa !19
  %77 = fcmp olt float %74, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %67, %57, %46, %34
  store i32 1, ptr %11, align 4
  br label %80

79:                                               ; preds = %67
  store i32 0, ptr %11, align 4
  br label %80

80:                                               ; preds = %79, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %81 = load i32, ptr %11, align 4
  switch i32 %81, label %130 [
    i32 0, label %82
  ]

82:                                               ; preds = %80
  br label %83

83:                                               ; preds = %82, %29
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = call ptr @nk_command_buffer_push(ptr noundef %84, i32 noundef 7, i64 noundef 32)
  store ptr %85, ptr %10, align 8, !tbaa !5
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %89, label %88

88:                                               ; preds = %83
  store i32 1, ptr %11, align 4
  br label %130

89:                                               ; preds = %83
  %90 = load float, ptr %9, align 4, !tbaa !9
  %91 = fptoui float %90 to i16
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.nk_command_circle, ptr %92, i32 0, i32 3
  store i16 %91, ptr %93, align 4, !tbaa !20
  %94 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %95 = load float, ptr %94, align 4, !tbaa !18
  %96 = fptosi float %95 to i16
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.nk_command_circle, ptr %97, i32 0, i32 1
  store i16 %96, ptr %98, align 8, !tbaa !25
  %99 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %100 = load float, ptr %99, align 4, !tbaa !19
  %101 = fptosi float %100 to i16
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.nk_command_circle, ptr %102, i32 0, i32 2
  store i16 %101, ptr %103, align 2, !tbaa !26
  %104 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %105 = load float, ptr %104, align 4, !tbaa !11
  %106 = fcmp olt float %105, 0.000000e+00
  br i1 %106, label %107, label %108

107:                                              ; preds = %89
  br label %111

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

111:                                              ; preds = %108, %107
  %112 = phi float [ 0.000000e+00, %107 ], [ %110, %108 ]
  %113 = fptoui float %112 to i16
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.nk_command_circle, ptr %114, i32 0, i32 4
  store i16 %113, ptr %115, align 2, !tbaa !27
  %116 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %117 = load float, ptr %116, align 4, !tbaa !13
  %118 = fcmp olt float %117, 0.000000e+00
  br i1 %118, label %119, label %120

119:                                              ; preds = %111
  br label %123

120:                                              ; preds = %111
  %121 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %122 = load float, ptr %121, align 4, !tbaa !13
  br label %123

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

130:                                              ; preds = %123, %88, %80, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %131 = load i32, ptr %11, align 4
  switch i32 %131, label %133 [
    i32 0, label %132
    i32 1, label %132
  ]

132:                                              ; preds = %130, %130
  ret void

133:                                              ; preds = %130
  unreachable
}

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_stroke_circle(ptr noundef %0, <2 x float> %1, <2 x float> %2, float noundef %3, i32 %4) local_unnamed_addr #1 {
  %6 = icmp eq ptr %0, null
  %.sroa.7.8.vec.extract40 = extractelement <2 x float> %2, i64 0
  %7 = fcmp oeq float %.sroa.7.8.vec.extract40, 0.000000e+00
  %or.cond = select i1 %6, i1 true, i1 %7
  %.sroa.7.12.vec.extract46 = extractelement <2 x float> %2, i64 1
  %8 = fcmp oeq float %.sroa.7.12.vec.extract46, 0.000000e+00
  %or.cond5 = select i1 %or.cond, i1 true, i1 %8
  %9 = fcmp ole float %3, 0.000000e+00
  %or.cond7 = or i1 %9, %or.cond5
  br i1 %or.cond7, label %50, label %10

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

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

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

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %0, i64 12
  %26 = load float, ptr %25, align 4, !tbaa !16
  %.sroa.026.4.vec.extract = extractelement <2 x float> %1, i64 1
  %27 = fadd float %.sroa.026.4.vec.extract, %.sroa.7.12.vec.extract46
  %28 = fcmp ogt float %26, %27
  br i1 %28, label %50, label %29

29:                                               ; preds = %24
  %30 = getelementptr inbounds i8, ptr %0, i64 20
  %31 = load float, ptr %30, align 4, !tbaa !17
  %32 = fadd float %26, %31
  %33 = fcmp olt float %32, %.sroa.026.4.vec.extract
  br i1 %33, label %50, label %.critedge

.critedge:                                        ; preds = %29, %10
  %34 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 7, i64 noundef 32)
  %.not52 = icmp eq ptr %34, null
  br i1 %.not52, label %50, label %35

35:                                               ; preds = %.critedge
  %36 = getelementptr inbounds i8, ptr %34, i64 16
  %37 = fcmp olt float %.sroa.7.8.vec.extract40, 0.000000e+00
  %38 = select i1 %37, float 0.000000e+00, float %.sroa.7.8.vec.extract40
  %39 = shufflevector <2 x float> %1, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
  %40 = insertelement <4 x float> %39, float %3, i64 2
  %41 = insertelement <4 x float> %40, float %38, i64 3
  %42 = fptosi <4 x float> %41 to <4 x i16>
  %43 = fptoui <4 x float> %41 to <4 x i16>
  %44 = shufflevector <4 x i16> %42, <4 x i16> %43, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
  store <4 x i16> %44, ptr %36, align 8, !tbaa !18
  %45 = fcmp olt float %.sroa.7.12.vec.extract46, 0.000000e+00
  %46 = select i1 %45, float 0.000000e+00, float %.sroa.7.12.vec.extract46
  %47 = fptoui float %46 to i16
  %48 = getelementptr inbounds i8, ptr %34, i64 24
  store i16 %47, ptr %48, align 8, !tbaa !20
  %49 = getelementptr inbounds i8, ptr %34, i64 26
  store i32 %4, ptr %49, align 2
  br label %50

50:                                               ; preds = %.critedge, %29, %24, %19, %13, %5, %35
  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 = { 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" }

!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 = !{!21, !19, i64 24}
!21 = !{!"nk_command_circle", !22, i64 0, !19, i64 16, !19, i64 18, !19, i64 20, !19, i64 22, !19, i64 24, !23, i64 26}
!22 = !{!"nk_command", !12, i64 0, !13, i64 8}
!23 = !{!"nk_color", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}


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