; 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: 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) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_subimage_handle(ptr dead_on_unwind noalias writable sret(%struct.nk_image) align 8 %0, ptr %1, i16 noundef zeroext %2, i16 noundef zeroext %3, <2 x float> %4, <2 x float> %5) #2 {
  %7 = alloca %union.nk_handle, align 8
  %8 = alloca %struct.nk_rect, align 4
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = getelementptr inbounds %union.nk_handle, ptr %7, i32 0, i32 0
  store ptr %1, ptr %11, align 8
  %12 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  store <2 x float> %4, ptr %12, align 4
  %13 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  store <2 x float> %5, ptr %13, align 4
  store i16 %2, ptr %9, align 2, !tbaa !5
  store i16 %3, ptr %10, align 2, !tbaa !5
  call void @nk_zero(ptr noundef %0, i64 noundef 24)
  %14 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !9
  %15 = load i16, ptr %9, align 2, !tbaa !5
  %16 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 1
  store i16 %15, ptr %16, align 8, !tbaa !11
  %17 = load i16, ptr %10, align 2, !tbaa !5
  %18 = getelementptr inbounds %struct.nk_image, ptr %0, i32 0, i32 2
  store i16 %17, ptr %18, align 2, !tbaa !13
  %19 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !14
  %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 !5
  %24 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !17
  %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 !5
  %29 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 2
  %30 = load float, ptr %29, align 4, !tbaa !18
  %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 !5
  %34 = getelementptr inbounds %struct.nk_rect, ptr %8, i32 0, i32 3
  %35 = load float, ptr %34, align 4, !tbaa !19
  %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 !5
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 8, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"nk_image", !7, i64 0, !6, i64 8, !6, i64 10, !7, i64 12}
!13 = !{!12, !6, i64 10}
!14 = !{!15, !16, i64 0}
!15 = !{!"nk_rect", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!16 = !{!"float", !7, i64 0}
!17 = !{!15, !16, i64 4}
!18 = !{!15, !16, i64 8}
!19 = !{!15, !16, 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_handle(ptr dead_on_unwind noalias writable sret(%struct.nk_image) align 8 %0, ptr %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 ptr %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,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass