; 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_image = type { %union.nk_handle, i16, i16, [4 x i16] }
%union.nk_handle = type { ptr }
%struct.nk_rect = type { float, float, float, float }

; Function Attrs: nounwind uwtable
declare hidden void @nk_zero(ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @nk_subimage_id(ptr dead_on_unwind noalias writable sret(%struct.nk_image) align 8 %0, i32 noundef %1, i16 noundef zeroext %2, i16 noundef zeroext %3, <2 x float> %4, <2 x float> %5) #1 {
  %7 = alloca %struct.nk_rect, align 4
  %8 = alloca i32, align 4
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 0
  store <2 x float> %4, ptr %11, align 4
  %12 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 1
  store <2 x float> %5, ptr %12, align 4
  store i32 %1, ptr %8, align 4, !tbaa !5
  store i16 %2, ptr %9, align 2, !tbaa !9
  store i16 %3, ptr %10, align 2, !tbaa !9
  call void @nk_zero(ptr noundef %0, i64 noundef 24)
  %13 = load i32, ptr %8, align 4, !tbaa !5
  %14 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 0
  store i32 %13, ptr %14, align 8, !tbaa !11
  %15 = load i16, ptr %9, align 2, !tbaa !9
  %16 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 1
  store i16 %15, ptr %16, align 8, !tbaa !12
  %17 = load i16, ptr %10, align 2, !tbaa !9
  %18 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 2
  store i16 %17, ptr %18, align 2, !tbaa !14
  %19 = getelementptr inbounds %struct.nk_rect, ptr %7, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !15
  %21 = fptoui float %20 to i16
  %22 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 3
  %23 = getelementptr inbounds [4 x i16], ptr %22, i64 0, i64 0
  store i16 %21, ptr %23, align 4, !tbaa !9
  %24 = getelementptr inbounds %struct.nk_rect, ptr %7, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !18
  %26 = fptoui float %25 to i16
  %27 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 3
  %28 = getelementptr inbounds [4 x i16], ptr %27, i64 0, i64 1
  store i16 %26, ptr %28, align 2, !tbaa !9
  %29 = getelementptr inbounds %struct.nk_rect, ptr %7, i32 0, i32 2
  %30 = load float, ptr %29, align 4, !tbaa !19
  %31 = fptoui float %30 to i16
  %32 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 3
  %33 = getelementptr inbounds [4 x i16], ptr %32, i64 0, i64 2
  store i16 %31, ptr %33, align 4, !tbaa !9
  %34 = getelementptr inbounds %struct.nk_rect, ptr %7, i32 0, i32 3
  %35 = load float, ptr %34, align 4, !tbaa !20
  %36 = fptoui float %35 to i16
  %37 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 3
  %38 = getelementptr inbounds [4 x i16], ptr %37, i64 0, i64 3
  store i16 %36, ptr %38, align 2, !tbaa !9
  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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 8}
!13 = !{!"nk_image", !7, i64 0, !10, i64 8, !10, i64 10, !7, i64 12}
!14 = !{!13, !10, i64 10}
!15 = !{!16, !17, i64 0}
!16 = !{!"nk_rect", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!17 = !{!"float", !7, i64 0}
!18 = !{!16, !17, i64 4}
!19 = !{!16, !17, i64 8}
!20 = !{!16, !17, i64 12}


; 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"

%struct.nk_image = type { %union.nk_handle, i16, i16, [4 x i16] }
%union.nk_handle = type { ptr }

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_subimage_id(ptr dead_on_unwind noalias writable sret(%struct.nk_image) align 8 %0, i32 noundef %1, i16 noundef zeroext %2, i16 noundef zeroext %3, <2 x float> %4, <2 x float> %5) local_unnamed_addr #1 {
  tail call void @nk_zero(ptr noundef %0, i64 noundef 24)
  store i32 %1, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i16 %2, ptr %7, align 8, !tbaa !8
  %8 = getelementptr inbounds i8, ptr %0, i64 10
  store i16 %3, ptr %8, align 2, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = shufflevector <2 x float> %4, <2 x float> %5, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %11 = fptoui <4 x float> %10 to <4 x i16>
  store <4 x i16> %11, ptr %9, align 4, !tbaa !12
  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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"nk_image", !6, i64 0, !10, i64 8, !10, i64 10, !6, i64 12}
!10 = !{!"short", !6, i64 0}
!11 = !{!9, !10, i64 10}
!12 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass