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

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

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

29:                                               ; preds = %26, %21, %8
  store i32 1, ptr %18, align 4
  br label %63

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

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

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

63:                                               ; preds = %36, %35, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  %64 = load i32, ptr %18, align 4
  switch i32 %64, label %66 [
    i32 0, label %65
    i32 1, label %65
  ]

65:                                               ; preds = %63, %63
  ret void

66:                                               ; preds = %63
  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 }

!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 22}
!14 = !{!"nk_command_arc", !15, i64 0, !18, i64 16, !18, i64 18, !18, i64 20, !18, i64 22, !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 16}
!20 = !{!14, !18, i64 18}
!21 = !{!14, !18, i64 20}
!22 = !{i64 0, i64 1, !23, i64 1, i64 1, !23, i64 2, i64 1, !23, i64 3, i64 1, !23}
!23 = !{!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_arc(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, i32 %7) local_unnamed_addr #0 {
  %.sroa.0.0.extract.trunc = trunc i32 %7 to i24
  %.sroa.2.0.extract.shift = lshr i32 %7, 24
  %.sroa.2.0.extract.trunc = trunc nuw i32 %.sroa.2.0.extract.shift to i8
  %9 = icmp eq ptr %0, null
  %10 = icmp ult i32 %7, 16777216
  %or.cond = select i1 %9, i1 true, i1 %10
  %11 = fcmp ole float %6, 0.000000e+00
  %or.cond5 = or i1 %11, %or.cond
  br i1 %or.cond5, label %26, label %12

12:                                               ; preds = %8
  %13 = tail call ptr @nk_command_buffer_push(ptr noundef nonnull %0, i32 noundef 9, i64 noundef 40)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %26, label %14

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

26:                                               ; preds = %12, %8, %14
  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" }

!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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!7, !7, i64 0}


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