; 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_line = type { %struct.nk_command, i16, %struct.nk_vec2i, %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_line = external hidden unnamed_addr constant [100 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_line(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 8821, ptr noundef @__PRETTY_FUNCTION__.nk_stroke_line) #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 %27

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

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

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

33:                                               ; preds = %28
  store i32 1, ptr %16, align 4
  br label %61

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

61:                                               ; preds = %34, %33, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %62 = load i32, ptr %16, align 4
  switch i32 %62, label %64 [
    i32 0, label %63
    i32 1, label %63
  ]

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

64:                                               ; preds = %61
  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, !16, i64 16}
!12 = !{!"nk_command_line", !13, i64 0, !16, i64 16, !17, i64 18, !17, i64 22, !18, i64 26}
!13 = !{!"nk_command", !14, i64 0, !15, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"nk_vec2i", !16, i64 0, !16, i64 2}
!18 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!19 = !{!12, !16, i64 18}
!20 = !{!12, !16, i64 20}
!21 = !{!12, !16, i64 22}
!22 = !{!12, !16, i64 24}
!23 = !{i64 0, i64 1, !24, i64 1, i64 1, !24, i64 2, i64 1, !24, i64 3, i64 1, !24}
!24 = !{!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_line = external hidden unnamed_addr constant [100 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_line(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, i32 %6) local_unnamed_addr #1 {
  %.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 8821, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_stroke_line) #2
  unreachable

9:                                                ; preds = %7
  %10 = fcmp ugt float %5, 0.000000e+00
  br i1 %10, label %11, label %25

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

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

25:                                               ; 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 24}
!10 = !{!"nk_command_line", !11, i64 0, !6, i64 16, !14, i64 18, !14, i64 22, !15, i64 26}
!11 = !{!"nk_command", !12, i64 0, !13, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"nk_vec2i", !6, i64 0, !6, i64 2}
!15 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}


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