; 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_rect = type { float, float, float, float }
%struct.nk_color = type { i8, i8, i8, i8 }
%struct.nk_vec2 = type { float, float }
%struct.nk_draw_list = type { %struct.nk_rect, [12 x %struct.nk_vec2], %struct.nk_convert_config, ptr, ptr, ptr, i32, i32, i32, i64, i32, i32, i32, i32 }
%struct.nk_convert_config = type { float, i32, i32, i32, i32, i32, %struct.nk_draw_null_texture, ptr, i64, i64 }
%struct.nk_draw_null_texture = type { %union.nk_handle, %struct.nk_vec2 }
%union.nk_handle = type { ptr }

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.nk_draw_list_fill_rect = external hidden unnamed_addr constant [91 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @nk_vec2(float noundef, float noundef) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_rect_to(ptr noundef, <2 x float>, <2 x float>, float noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_fill(ptr noundef, i32) #2

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_fill_rect(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3, float noundef %4) #0 {
  %6 = alloca %struct.nk_rect, align 4
  %7 = alloca %struct.nk_color, align 1
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca %struct.nk_vec2, align 4
  %11 = alloca %struct.nk_vec2, align 4
  %12 = alloca %struct.nk_vec2, align 4
  %13 = alloca %struct.nk_vec2, align 4
  %14 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 0
  store <2 x float> %1, ptr %14, align 4
  %15 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 1
  store <2 x float> %2, ptr %15, align 4
  store i32 %3, ptr %7, align 1
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %4, ptr %9, align 4, !tbaa !9
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %5
  br label %20

19:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.2, i32 noundef 10166, ptr noundef @__PRETTY_FUNCTION__.nk_draw_list_fill_rect) #3
  unreachable

20:                                               ; preds = %18
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %27

23:                                               ; preds = %20
  %24 = getelementptr inbounds %struct.nk_color, ptr %7, i32 0, i32 3
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = icmp ne i8 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %23, %20
  br label %80

28:                                               ; preds = %23
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.nk_draw_list, ptr %29, i32 0, i32 12
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %54

33:                                               ; preds = %28
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %36 = load float, ptr %35, align 4, !tbaa !21
  %37 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %38 = load float, ptr %37, align 4, !tbaa !22
  %39 = call <2 x float> @nk_vec2(float noundef %36, float noundef %38)
  store <2 x float> %39, ptr %10, align 4
  %40 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %41 = load float, ptr %40, align 4, !tbaa !21
  %42 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %43 = load float, ptr %42, align 4, !tbaa !23
  %44 = fadd float %41, %43
  %45 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !22
  %47 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %48 = load float, ptr %47, align 4, !tbaa !24
  %49 = fadd float %46, %48
  %50 = call <2 x float> @nk_vec2(float noundef %44, float noundef %49)
  store <2 x float> %50, ptr %11, align 4
  %51 = load float, ptr %9, align 4, !tbaa !9
  %52 = load <2 x float>, ptr %10, align 4
  %53 = load <2 x float>, ptr %11, align 4
  call void @nk_draw_list_path_rect_to(ptr noundef %34, <2 x float> %52, <2 x float> %53, float noundef %51)
  br label %77

54:                                               ; preds = %28
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %57 = load float, ptr %56, align 4, !tbaa !21
  %58 = fsub float %57, 5.000000e-01
  %59 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %60 = load float, ptr %59, align 4, !tbaa !22
  %61 = fsub float %60, 5.000000e-01
  %62 = call <2 x float> @nk_vec2(float noundef %58, float noundef %61)
  store <2 x float> %62, ptr %12, align 4
  %63 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %64 = load float, ptr %63, align 4, !tbaa !21
  %65 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %66 = load float, ptr %65, align 4, !tbaa !23
  %67 = fadd float %64, %66
  %68 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %69 = load float, ptr %68, align 4, !tbaa !22
  %70 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %71 = load float, ptr %70, align 4, !tbaa !24
  %72 = fadd float %69, %71
  %73 = call <2 x float> @nk_vec2(float noundef %67, float noundef %72)
  store <2 x float> %73, ptr %13, align 4
  %74 = load float, ptr %9, align 4, !tbaa !9
  %75 = load <2 x float>, ptr %12, align 4
  %76 = load <2 x float>, ptr %13, align 4
  call void @nk_draw_list_path_rect_to(ptr noundef %55, <2 x float> %75, <2 x float> %76, float noundef %74)
  br label %77

77:                                               ; preds = %54, %33
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load i32, ptr %7, align 1
  call void @nk_draw_list_path_fill(ptr noundef %78, i32 %79)
  br label %80

80:                                               ; preds = %77, %27
  ret void
}

attributes #0 = { 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" }
attributes #1 = { 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 #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 = { 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, !17, i64 232}
!14 = !{!"nk_draw_list", !15, i64 0, !7, i64 16, !16, i64 112, !6, i64 176, !6, i64 184, !6, i64 192, !17, i64 200, !17, i64 204, !17, i64 208, !20, i64 216, !17, i64 224, !17, i64 228, !17, i64 232, !17, i64 236}
!15 = !{!"nk_rect", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!16 = !{!"nk_convert_config", !10, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !18, i64 24, !6, i64 40, !20, i64 48, !20, i64 56}
!17 = !{!"int", !7, i64 0}
!18 = !{!"nk_draw_null_texture", !7, i64 0, !19, i64 8}
!19 = !{!"nk_vec2", !10, i64 0, !10, i64 4}
!20 = !{!"long", !7, i64 0}
!21 = !{!15, !10, i64 0}
!22 = !{!15, !10, i64 4}
!23 = !{!15, !10, i64 8}
!24 = !{!15, !10, 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"

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.nk_draw_list_fill_rect = external hidden unnamed_addr constant [91 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @nk_vec2(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_rect_to(ptr noundef, <2 x float>, <2 x float>, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_fill(ptr noundef, i32) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_fill_rect(ptr noundef %0, <2 x float> %1, <2 x float> %2, i32 %3, float noundef %4) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.2, i32 noundef 10166, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_draw_list_fill_rect) #3
  unreachable

7:                                                ; preds = %5
  %.not31 = icmp ult i32 %3, 16777216
  br i1 %.not31, label %23, label %8

8:                                                ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 232
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = icmp eq i32 %10, 1
  %.sroa.014.0.vec.extract = extractelement <2 x float> %1, i64 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %8
  %.sroa.014.4.vec.extract = extractelement <2 x float> %1, i64 1
  %13 = tail call <2 x float> @nk_vec2(float noundef %.sroa.014.0.vec.extract, float noundef %.sroa.014.4.vec.extract)
  br label %18

14:                                               ; preds = %8
  %15 = fadd float %.sroa.014.0.vec.extract, -5.000000e-01
  %.sroa.014.4.vec.extract24 = extractelement <2 x float> %1, i64 1
  %16 = fadd float %.sroa.014.4.vec.extract24, -5.000000e-01
  %17 = tail call <2 x float> @nk_vec2(float noundef %15, float noundef %16)
  br label %18

18:                                               ; preds = %14, %12
  %.sroa.014.4.vec.extract24.sink = phi float [ %.sroa.014.4.vec.extract24, %14 ], [ %.sroa.014.4.vec.extract, %12 ]
  %.sink = phi <2 x float> [ %17, %14 ], [ %13, %12 ]
  %19 = fadd <2 x float> %1, %2
  %20 = extractelement <2 x float> %19, i64 0
  %.sroa.9.12.vec.extract30 = extractelement <2 x float> %2, i64 1
  %21 = fadd float %.sroa.014.4.vec.extract24.sink, %.sroa.9.12.vec.extract30
  %22 = tail call <2 x float> @nk_vec2(float noundef %20, float noundef %21)
  tail call void @nk_draw_list_path_rect_to(ptr noundef nonnull %0, <2 x float> %.sink, <2 x float> %22, float noundef %4)
  tail call void @nk_draw_list_path_fill(ptr noundef nonnull %0, i32 %3)
  br label %23

23:                                               ; preds = %7, %18
  ret void
}

attributes #0 = { 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" }
attributes #1 = { 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 #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 = { 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, !12, i64 232}
!6 = !{!"nk_draw_list", !7, i64 0, !9, i64 16, !11, i64 112, !15, i64 176, !15, i64 184, !15, i64 192, !12, i64 200, !12, i64 204, !12, i64 208, !16, i64 216, !12, i64 224, !12, i64 228, !12, i64 232, !12, i64 236}
!7 = !{!"nk_rect", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"nk_convert_config", !8, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !13, i64 24, !15, i64 40, !16, i64 48, !16, i64 56}
!12 = !{!"int", !9, i64 0}
!13 = !{!"nk_draw_null_texture", !9, i64 0, !14, i64 8}
!14 = !{!"nk_vec2", !8, i64 0, !8, i64 4}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!"long", !9, i64 0}


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