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

19:                                               ; preds = %7
  br label %21

20:                                               ; preds = %7
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.2, i32 noundef 8993, ptr noundef @__PRETTY_FUNCTION__.nk_fill_arc) #5
  unreachable

21:                                               ; preds = %19
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %29

24:                                               ; preds = %21
  %25 = getelementptr inbounds %struct.nk_color, ptr %8, i32 0, i32 3
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = zext i8 %26 to i32
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %24, %21
  store i32 1, ptr %16, align 4
  br label %59

30:                                               ; preds = %24
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = call ptr @nk_command_buffer_push(ptr noundef %31, i32 noundef 10, i64 noundef 40)
  store ptr %32, ptr %15, align 8, !tbaa !5
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  store i32 1, ptr %16, align 4
  br label %59

36:                                               ; preds = %30
  %37 = load float, ptr %10, align 4, !tbaa !9
  %38 = fptosi float %37 to i16
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %39, i32 0, i32 1
  store i16 %38, ptr %40, align 8, !tbaa !13
  %41 = load float, ptr %11, align 4, !tbaa !9
  %42 = fptosi float %41 to i16
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %43, i32 0, i32 2
  store i16 %42, ptr %44, align 2, !tbaa !19
  %45 = load float, ptr %12, align 4, !tbaa !9
  %46 = fptoui float %45 to i16
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %47, i32 0, i32 3
  store i16 %46, ptr %48, align 4, !tbaa !20
  %49 = load float, ptr %13, align 4, !tbaa !9
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %50, i32 0, i32 4
  %52 = getelementptr inbounds [2 x float], ptr %51, i64 0, i64 0
  store float %49, ptr %52, align 8, !tbaa !9
  %53 = load float, ptr %14, align 4, !tbaa !9
  %54 = load ptr, ptr %15, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %54, i32 0, i32 4
  %56 = getelementptr inbounds [2 x float], ptr %55, i64 0, i64 1
  store float %53, ptr %56, align 4, !tbaa !9
  %57 = load ptr, ptr %15, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.nk_command_arc_filled, ptr %57, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %58, ptr align 1 %8, i64 4, i1 false), !tbaa.struct !21
  store i32 0, ptr %16, align 4
  br label %59

59:                                               ; preds = %36, %35, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %60 = load i32, ptr %16, align 4
  switch i32 %60, label %62 [
    i32 0, label %61
    i32 1, label %61
  ]

61:                                               ; preds = %59, %59
  ret void

62:                                               ; preds = %59
  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_arc_filled", !15, i64 0, !18, i64 16, !18, i64 18, !18, i64 20, !7, i64 24, !12, i64 32}
!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 = !{!14, !18, i64 18}
!20 = !{!14, !18, i64 20}
!21 = !{i64 0, i64 1, !22, i64 1, i64 1, !22, i64 2, i64 1, !22, i64 3, i64 1, !22}
!22 = !{!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_arc = external hidden unnamed_addr constant [97 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_arc(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, i32 %6) local_unnamed_addr #1 {
  %.sroa.0.0.extract.trunc = trunc i32 %6 to i24
  %.sroa.2.0.extract.shift = lshr i32 %6, 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 %8, label %9

8:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 8993, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_fill_arc) #2
  unreachable

9:                                                ; preds = %7
  %10 = icmp ult i32 %6, 16777216
  br i1 %10, label %23, label %11

11:                                               ; preds = %9
  %12 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 10, i64 noundef 40)
  %.not19 = icmp eq ptr %12, null
  br i1 %.not19, label %23, label %13

13:                                               ; preds = %11
  %14 = insertelement <2 x float> poison, float %1, i64 0
  %15 = insertelement <2 x float> %14, float %2, i64 1
  %16 = fptosi <2 x float> %15 to <2 x i16>
  %17 = getelementptr inbounds i8, ptr %12, i64 16
  store <2 x i16> %16, ptr %17, align 8, !tbaa !5
  %18 = fptoui float %3 to i16
  %19 = getelementptr inbounds i8, ptr %12, i64 20
  store i16 %18, ptr %19, align 4, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %12, i64 24
  store float %4, ptr %20, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %12, i64 28
  store float %5, ptr %21, align 4, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %12, i64 32
  store i24 %.sroa.0.0.extract.trunc, ptr %22, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 35
  store i8 %.sroa.2.0.extract.trunc, ptr %.sroa.2.0..sroa_idx, align 1, !tbaa !17
  br label %23

23:                                               ; preds = %11, %9, %13
  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, !6, i64 0}
!6 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 20}
!10 = !{!"nk_command_arc_filled", !11, i64 0, !6, i64 16, !6, i64 18, !6, i64 20, !7, i64 24, !14, i64 32}
!11 = !{!"nk_command", !12, i64 0, !13, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!7, !7, i64 0}


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