; 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 }
%struct.nk_color = type { i8, i8, i8, i8 }
%struct.nk_vec2 = type { float, float }

@.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_add_image = external hidden unnamed_addr constant [101 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: nounwind uwtable
declare dso_local <2 x float> @nk_vec2(float noundef, float noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_add_image(ptr noundef %0, ptr noundef byval(%struct.nk_image) align 8 %1, <2 x float> %2, <2 x float> %3, i32 %4) #1 {
  %6 = alloca %struct.nk_rect, align 4
  %7 = alloca %struct.nk_color, align 1
  %8 = alloca ptr, align 8
  %9 = alloca [2 x %struct.nk_vec2], align 16
  %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 = alloca %struct.nk_vec2, align 4
  %15 = alloca %struct.nk_vec2, align 4
  %16 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 0
  store <2 x float> %2, ptr %16, align 4
  %17 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 1
  store <2 x float> %3, ptr %17, align 4
  store i32 %4, ptr %7, align 1
  store ptr %0, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  br label %22

21:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.2, i32 noundef 10321, ptr noundef @__PRETTY_FUNCTION__.nk_draw_list_add_image) #4
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  br label %135

26:                                               ; preds = %22
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 0
  %29 = getelementptr inbounds %union.nk_handle, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8
  call void @nk_draw_list_push_image(ptr noundef %27, ptr %30)
  %31 = call i32 @nk_image_is_subimage(ptr noundef %1)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %110

33:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %34 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %35 = getelementptr inbounds [4 x i16], ptr %34, i64 0, i64 0
  %36 = load i16, ptr %35, align 4, !tbaa !9
  %37 = uitofp i16 %36 to float
  %38 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 1
  %39 = load i16, ptr %38, align 8, !tbaa !11
  %40 = uitofp i16 %39 to float
  %41 = fdiv float %37, %40
  %42 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 0
  %43 = getelementptr inbounds %struct.nk_vec2, ptr %42, i32 0, i32 0
  store float %41, ptr %43, align 16, !tbaa !13
  %44 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %45 = getelementptr inbounds [4 x i16], ptr %44, i64 0, i64 1
  %46 = load i16, ptr %45, align 2, !tbaa !9
  %47 = uitofp i16 %46 to float
  %48 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 2
  %49 = load i16, ptr %48, align 2, !tbaa !16
  %50 = uitofp i16 %49 to float
  %51 = fdiv float %47, %50
  %52 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 0
  %53 = getelementptr inbounds %struct.nk_vec2, ptr %52, i32 0, i32 1
  store float %51, ptr %53, align 4, !tbaa !17
  %54 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %55 = getelementptr inbounds [4 x i16], ptr %54, i64 0, i64 0
  %56 = load i16, ptr %55, align 4, !tbaa !9
  %57 = zext i16 %56 to i32
  %58 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %59 = getelementptr inbounds [4 x i16], ptr %58, i64 0, i64 2
  %60 = load i16, ptr %59, align 4, !tbaa !9
  %61 = zext i16 %60 to i32
  %62 = add nsw i32 %57, %61
  %63 = sitofp i32 %62 to float
  %64 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 1
  %65 = load i16, ptr %64, align 8, !tbaa !11
  %66 = uitofp i16 %65 to float
  %67 = fdiv float %63, %66
  %68 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 1
  %69 = getelementptr inbounds %struct.nk_vec2, ptr %68, i32 0, i32 0
  store float %67, ptr %69, align 8, !tbaa !13
  %70 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %71 = getelementptr inbounds [4 x i16], ptr %70, i64 0, i64 1
  %72 = load i16, ptr %71, align 2, !tbaa !9
  %73 = zext i16 %72 to i32
  %74 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 3
  %75 = getelementptr inbounds [4 x i16], ptr %74, i64 0, i64 3
  %76 = load i16, ptr %75, align 2, !tbaa !9
  %77 = zext i16 %76 to i32
  %78 = add nsw i32 %73, %77
  %79 = sitofp i32 %78 to float
  %80 = getelementptr inbounds %struct.nk_image, ptr %1, i32 0, i32 2
  %81 = load i16, ptr %80, align 2, !tbaa !16
  %82 = uitofp i16 %81 to float
  %83 = fdiv float %79, %82
  %84 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 1
  %85 = getelementptr inbounds %struct.nk_vec2, ptr %84, i32 0, i32 1
  store float %83, ptr %85, align 4, !tbaa !17
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %88 = load float, ptr %87, align 4, !tbaa !18
  %89 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %90 = load float, ptr %89, align 4, !tbaa !20
  %91 = call <2 x float> @nk_vec2(float noundef %88, float noundef %90)
  store <2 x float> %91, ptr %10, align 4
  %92 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %93 = load float, ptr %92, align 4, !tbaa !18
  %94 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %95 = load float, ptr %94, align 4, !tbaa !21
  %96 = fadd float %93, %95
  %97 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %98 = load float, ptr %97, align 4, !tbaa !20
  %99 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %100 = load float, ptr %99, align 4, !tbaa !22
  %101 = fadd float %98, %100
  %102 = call <2 x float> @nk_vec2(float noundef %96, float noundef %101)
  store <2 x float> %102, ptr %11, align 4
  %103 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 0
  %104 = getelementptr inbounds [2 x %struct.nk_vec2], ptr %9, i64 0, i64 1
  %105 = load <2 x float>, ptr %10, align 4
  %106 = load <2 x float>, ptr %11, align 4
  %107 = load <2 x float>, ptr %103, align 16
  %108 = load <2 x float>, ptr %104, align 8
  %109 = load i32, ptr %7, align 1
  call void @nk_draw_list_push_rect_uv(ptr noundef %86, <2 x float> %105, <2 x float> %106, <2 x float> %107, <2 x float> %108, i32 %109)
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  br label %135

110:                                              ; preds = %26
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %113 = load float, ptr %112, align 4, !tbaa !18
  %114 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %115 = load float, ptr %114, align 4, !tbaa !20
  %116 = call <2 x float> @nk_vec2(float noundef %113, float noundef %115)
  store <2 x float> %116, ptr %12, align 4
  %117 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %118 = load float, ptr %117, align 4, !tbaa !18
  %119 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %120 = load float, ptr %119, align 4, !tbaa !21
  %121 = fadd float %118, %120
  %122 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %123 = load float, ptr %122, align 4, !tbaa !20
  %124 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %125 = load float, ptr %124, align 4, !tbaa !22
  %126 = fadd float %123, %125
  %127 = call <2 x float> @nk_vec2(float noundef %121, float noundef %126)
  store <2 x float> %127, ptr %13, align 4
  %128 = call <2 x float> @nk_vec2(float noundef 0.000000e+00, float noundef 0.000000e+00)
  store <2 x float> %128, ptr %14, align 4
  %129 = call <2 x float> @nk_vec2(float noundef 1.000000e+00, float noundef 1.000000e+00)
  store <2 x float> %129, ptr %15, align 4
  %130 = load <2 x float>, ptr %12, align 4
  %131 = load <2 x float>, ptr %13, align 4
  %132 = load <2 x float>, ptr %14, align 4
  %133 = load <2 x float>, ptr %15, align 4
  %134 = load i32, ptr %7, align 1
  call void @nk_draw_list_push_rect_uv(ptr noundef %111, <2 x float> %130, <2 x float> %131, <2 x float> %132, <2 x float> %133, i32 %134)
  br label %135

135:                                              ; preds = %110, %33, %25
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_image_is_subimage(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @nk_draw_list_push_rect_uv(ptr noundef, <2 x float>, <2 x float>, <2 x float>, <2 x float>, i32) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"short", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"nk_image", !7, i64 0, !10, i64 8, !10, i64 10, !7, i64 12}
!13 = !{!14, !15, i64 0}
!14 = !{!"nk_vec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!12, !10, i64 10}
!17 = !{!14, !15, i64 4}
!18 = !{!19, !15, i64 0}
!19 = !{!"nk_rect", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!20 = !{!19, !15, i64 4}
!21 = !{!19, !15, i64 8}
!22 = !{!19, !15, 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 }

@.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_add_image = external hidden unnamed_addr constant [101 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 hidden void @nk_draw_list_push_image(ptr noundef, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_add_image(ptr noundef %0, ptr noundef byval(%struct.nk_image) align 8 %1, <2 x float> %2, <2 x float> %3, i32 %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 10321, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_draw_list_add_image) #3
  unreachable

7:                                                ; preds = %5
  %8 = load ptr, ptr %1, align 8
  tail call void @nk_draw_list_push_image(ptr noundef nonnull %0, ptr %8)
  %9 = call i32 @nk_image_is_subimage(ptr noundef nonnull %1)
  %.not32 = icmp eq i32 %9, 0
  br i1 %.not32, label %31, label %10

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %1, i64 12
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load <2 x i16>, ptr %11, align 4, !tbaa !5
  %15 = load <2 x i16>, ptr %12, align 8, !tbaa !5
  %16 = uitofp <2 x i16> %15 to <2 x float>
  %17 = uitofp <2 x i16> %14 to <2 x float>
  %18 = fdiv <2 x float> %17, %16
  %19 = zext <2 x i16> %14 to <2 x i32>
  %20 = load <2 x i16>, ptr %13, align 8, !tbaa !5
  %21 = zext <2 x i16> %20 to <2 x i32>
  %22 = add nuw nsw <2 x i32> %21, %19
  %23 = uitofp nneg <2 x i32> %22 to <2 x float>
  %24 = fdiv <2 x float> %23, %16
  %.sroa.015.0.vec.extract = extractelement <2 x float> %2, i64 0
  %.sroa.015.4.vec.extract = extractelement <2 x float> %2, i64 1
  %25 = call <2 x float> @nk_vec2(float noundef %.sroa.015.0.vec.extract, float noundef %.sroa.015.4.vec.extract)
  %26 = fadd <2 x float> %2, %3
  %27 = extractelement <2 x float> %26, i64 0
  %28 = fadd <2 x float> %2, %3
  %29 = extractelement <2 x float> %28, i64 1
  %30 = call <2 x float> @nk_vec2(float noundef %27, float noundef %29)
  call void @nk_draw_list_push_rect_uv(ptr noundef nonnull %0, <2 x float> %25, <2 x float> %30, <2 x float> %18, <2 x float> %24, i32 %4)
  br label %40

31:                                               ; preds = %7
  %.sroa.015.0.vec.extract19 = extractelement <2 x float> %2, i64 0
  %.sroa.015.4.vec.extract25 = extractelement <2 x float> %2, i64 1
  %32 = call <2 x float> @nk_vec2(float noundef %.sroa.015.0.vec.extract19, float noundef %.sroa.015.4.vec.extract25)
  %33 = fadd <2 x float> %2, %3
  %34 = extractelement <2 x float> %33, i64 0
  %35 = fadd <2 x float> %2, %3
  %36 = extractelement <2 x float> %35, i64 1
  %37 = call <2 x float> @nk_vec2(float noundef %34, float noundef %36)
  %38 = call <2 x float> @nk_vec2(float noundef 0.000000e+00, float noundef 0.000000e+00)
  %39 = call <2 x float> @nk_vec2(float noundef 1.000000e+00, float noundef 1.000000e+00)
  call void @nk_draw_list_push_rect_uv(ptr noundef nonnull %0, <2 x float> %32, <2 x float> %37, <2 x float> %38, <2 x float> %39, i32 %4)
  br label %40

40:                                               ; preds = %31, %10
  ret void
}

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

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

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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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