; 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_color = type { i8, i8, i8, i8 }
%struct.nk_command_curve = type { %struct.nk_command, i16, %struct.nk_vec2i, %struct.nk_vec2i, [2 x %struct.nk_vec2i], %struct.nk_color }
%struct.nk_command = type { i32, i64 }
%struct.nk_vec2i = type { i16, i16 }

@.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_stroke_curve = external hidden unnamed_addr constant [129 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_stroke_curve(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, float noundef %9, i32 %10) #3 {
  %12 = alloca %struct.nk_color, align 1
  %13 = alloca ptr, align 8
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store i32 %10, ptr %12, align 1
  store ptr %0, ptr %13, align 8, !tbaa !5
  store float %1, ptr %14, align 4, !tbaa !9
  store float %2, ptr %15, align 4, !tbaa !9
  store float %3, ptr %16, align 4, !tbaa !9
  store float %4, ptr %17, align 4, !tbaa !9
  store float %5, ptr %18, align 4, !tbaa !9
  store float %6, ptr %19, align 4, !tbaa !9
  store float %7, ptr %20, align 4, !tbaa !9
  store float %8, ptr %21, align 4, !tbaa !9
  store float %9, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %25 = load ptr, ptr %13, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %11
  br label %29

28:                                               ; preds = %11
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.2, i32 noundef 8839, ptr noundef @__PRETTY_FUNCTION__.nk_stroke_curve) #5
  unreachable

29:                                               ; preds = %27
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %40

32:                                               ; preds = %29
  %33 = getelementptr inbounds %struct.nk_color, ptr %12, i32 0, i32 3
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = zext i8 %34 to i32
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %40, label %37

37:                                               ; preds = %32
  %38 = load float, ptr %22, align 4, !tbaa !9
  %39 = fcmp ole float %38, 0.000000e+00
  br i1 %39, label %40, label %41

40:                                               ; preds = %37, %32, %29
  store i32 1, ptr %24, align 4
  br label %98

41:                                               ; preds = %37
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = call ptr @nk_command_buffer_push(ptr noundef %42, i32 noundef 3, i64 noundef 40)
  store ptr %43, ptr %23, align 8, !tbaa !5
  %44 = load ptr, ptr %23, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  store i32 1, ptr %24, align 4
  br label %98

47:                                               ; preds = %41
  %48 = load float, ptr %22, align 4, !tbaa !9
  %49 = fptoui float %48 to i16
  %50 = load ptr, ptr %23, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nk_command_curve, ptr %50, i32 0, i32 1
  store i16 %49, ptr %51, align 8, !tbaa !13
  %52 = load float, ptr %14, align 4, !tbaa !9
  %53 = fptosi float %52 to i16
  %54 = load ptr, ptr %23, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.nk_command_curve, ptr %54, i32 0, i32 2
  %56 = getelementptr inbounds %struct.nk_vec2i, ptr %55, i32 0, i32 0
  store i16 %53, ptr %56, align 2, !tbaa !20
  %57 = load float, ptr %15, align 4, !tbaa !9
  %58 = fptosi float %57 to i16
  %59 = load ptr, ptr %23, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.nk_command_curve, ptr %59, i32 0, i32 2
  %61 = getelementptr inbounds %struct.nk_vec2i, ptr %60, i32 0, i32 1
  store i16 %58, ptr %61, align 2, !tbaa !21
  %62 = load float, ptr %16, align 4, !tbaa !9
  %63 = fptosi float %62 to i16
  %64 = load ptr, ptr %23, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.nk_command_curve, ptr %64, i32 0, i32 4
  %66 = getelementptr inbounds [2 x %struct.nk_vec2i], ptr %65, i64 0, i64 0
  %67 = getelementptr inbounds %struct.nk_vec2i, ptr %66, i32 0, i32 0
  store i16 %63, ptr %67, align 2, !tbaa !22
  %68 = load float, ptr %17, align 4, !tbaa !9
  %69 = fptosi float %68 to i16
  %70 = load ptr, ptr %23, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.nk_command_curve, ptr %70, i32 0, i32 4
  %72 = getelementptr inbounds [2 x %struct.nk_vec2i], ptr %71, i64 0, i64 0
  %73 = getelementptr inbounds %struct.nk_vec2i, ptr %72, i32 0, i32 1
  store i16 %69, ptr %73, align 2, !tbaa !23
  %74 = load float, ptr %18, align 4, !tbaa !9
  %75 = fptosi float %74 to i16
  %76 = load ptr, ptr %23, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.nk_command_curve, ptr %76, i32 0, i32 4
  %78 = getelementptr inbounds [2 x %struct.nk_vec2i], ptr %77, i64 0, i64 1
  %79 = getelementptr inbounds %struct.nk_vec2i, ptr %78, i32 0, i32 0
  store i16 %75, ptr %79, align 2, !tbaa !22
  %80 = load float, ptr %19, align 4, !tbaa !9
  %81 = fptosi float %80 to i16
  %82 = load ptr, ptr %23, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.nk_command_curve, ptr %82, i32 0, i32 4
  %84 = getelementptr inbounds [2 x %struct.nk_vec2i], ptr %83, i64 0, i64 1
  %85 = getelementptr inbounds %struct.nk_vec2i, ptr %84, i32 0, i32 1
  store i16 %81, ptr %85, align 2, !tbaa !23
  %86 = load float, ptr %20, align 4, !tbaa !9
  %87 = fptosi float %86 to i16
  %88 = load ptr, ptr %23, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.nk_command_curve, ptr %88, i32 0, i32 3
  %90 = getelementptr inbounds %struct.nk_vec2i, ptr %89, i32 0, i32 0
  store i16 %87, ptr %90, align 2, !tbaa !24
  %91 = load float, ptr %21, align 4, !tbaa !9
  %92 = fptosi float %91 to i16
  %93 = load ptr, ptr %23, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.nk_command_curve, ptr %93, i32 0, i32 3
  %95 = getelementptr inbounds %struct.nk_vec2i, ptr %94, i32 0, i32 1
  store i16 %92, ptr %95, align 2, !tbaa !25
  %96 = load ptr, ptr %23, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.nk_command_curve, ptr %96, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %97, ptr align 1 %12, i64 4, i1 false), !tbaa.struct !26
  store i32 0, ptr %24, align 4
  br label %98

98:                                               ; preds = %47, %46, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  %99 = load i32, ptr %24, align 4
  switch i32 %99, label %101 [
    i32 0, label %100
    i32 1, label %100
  ]

100:                                              ; preds = %98, %98
  ret void

101:                                              ; preds = %98
  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 }
attributes #5 = { 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !7, i64 3}
!12 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!13 = !{!14, !18, i64 16}
!14 = !{!"nk_command_curve", !15, i64 0, !18, i64 16, !19, i64 18, !19, i64 22, !7, i64 26, !12, i64 34}
!15 = !{!"nk_command", !16, i64 0, !17, i64 8}
!16 = !{!"int", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!"nk_vec2i", !18, i64 0, !18, i64 2}
!20 = !{!14, !18, i64 18}
!21 = !{!14, !18, i64 20}
!22 = !{!19, !18, i64 0}
!23 = !{!19, !18, i64 2}
!24 = !{!14, !18, i64 22}
!25 = !{!14, !18, i64 24}
!26 = !{i64 0, i64 1, !27, i64 1, i64 1, !27, i64 2, i64 1, !27, i64 3, i64 1, !27}
!27 = !{!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_stroke_curve = external hidden unnamed_addr constant [129 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_stroke_curve(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, float noundef %9, i32 %10) local_unnamed_addr #1 {
  %.sroa.0.0.extract.trunc = trunc i32 %10 to i24
  %.sroa.2.0.extract.shift = lshr i32 %10, 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 %12, label %13

12:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 8839, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_stroke_curve) #2
  unreachable

13:                                               ; preds = %11
  %14 = icmp ult i32 %10, 16777216
  %15 = fcmp ole float %9, 0.000000e+00
  %or.cond5 = or i1 %15, %14
  br i1 %or.cond5, label %34, label %16

16:                                               ; preds = %13
  %17 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 3, i64 noundef 40)
  %.not31 = icmp eq ptr %17, null
  br i1 %.not31, label %34, label %18

18:                                               ; preds = %16
  %19 = insertelement <8 x float> poison, float %9, i64 0
  %20 = insertelement <8 x float> %19, float %1, i64 1
  %21 = insertelement <8 x float> %20, float %2, i64 2
  %22 = insertelement <8 x float> %21, float %7, i64 3
  %23 = insertelement <8 x float> %22, float %8, i64 4
  %24 = insertelement <8 x float> %23, float %3, i64 5
  %25 = insertelement <8 x float> %24, float %4, i64 6
  %26 = insertelement <8 x float> %25, float %5, i64 7
  %27 = fptoui <8 x float> %26 to <8 x i16>
  %28 = fptosi <8 x float> %26 to <8 x i16>
  %29 = shufflevector <8 x i16> %27, <8 x i16> %28, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %30 = getelementptr inbounds i8, ptr %17, i64 16
  %31 = fptosi float %6 to i16
  %32 = getelementptr inbounds i8, ptr %17, i64 32
  store i16 %31, ptr %32, align 2, !tbaa !5
  store <8 x i16> %29, ptr %30, align 8, !tbaa !10
  %33 = getelementptr inbounds i8, ptr %17, i64 34
  store i24 %.sroa.0.0.extract.trunc, ptr %33, align 2
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %17, i64 37
  store i8 %.sroa.2.0.extract.trunc, ptr %.sroa.2.0..sroa_idx, align 1, !tbaa !11
  br label %34

34:                                               ; preds = %16, %13, %18
  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 = { 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, !7, i64 2}
!6 = !{!"nk_vec2i", !7, i64 0, !7, i64 2}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!8, !8, i64 0}


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