; 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_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_rect = type { float, float, float, float }
%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_path_arc_to_fast = external hidden unnamed_addr constant [91 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: nounwind uwtable
declare dso_local <2 x float> @nk_vec2(float noundef, float noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

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

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

19:                                               ; preds = %5
  br label %21

20:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.2, i32 noundef 10019, ptr noundef @__PRETTY_FUNCTION__.nk_draw_list_path_arc_to_fast) #6
  unreachable

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

24:                                               ; preds = %21
  store i32 1, ptr %12, align 4
  br label %64

25:                                               ; preds = %21
  %26 = load i32, ptr %9, align 4, !tbaa !11
  %27 = load i32, ptr %10, align 4, !tbaa !11
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %29, label %63

29:                                               ; preds = %25
  %30 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %30, ptr %11, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %59, %29
  %32 = load i32, ptr %11, align 4, !tbaa !11
  %33 = load i32, ptr %10, align 4, !tbaa !11
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %35, label %62

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.nk_draw_list, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %11, align 4, !tbaa !11
  %39 = sext i32 %38 to i64
  %40 = urem i64 %39, 12
  %41 = getelementptr inbounds [12 x %struct.nk_vec2], ptr %37, i64 0, i64 %40
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %41, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %42 = getelementptr inbounds %struct.nk_vec2, ptr %6, i32 0, i32 0
  %43 = load float, ptr %42, align 4, !tbaa !14
  %44 = getelementptr inbounds %struct.nk_vec2, ptr %13, i32 0, i32 0
  %45 = load float, ptr %44, align 4, !tbaa !14
  %46 = load float, ptr %8, align 4, !tbaa !9
  %47 = call float @llvm.fmuladd.f32(float %45, float %46, float %43)
  store float %47, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %48 = getelementptr inbounds %struct.nk_vec2, ptr %6, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !16
  %50 = getelementptr inbounds %struct.nk_vec2, ptr %13, i32 0, i32 1
  %51 = load float, ptr %50, align 4, !tbaa !16
  %52 = load float, ptr %8, align 4, !tbaa !9
  %53 = call float @llvm.fmuladd.f32(float %51, float %52, float %49)
  store float %53, ptr %15, align 4, !tbaa !9
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load float, ptr %14, align 4, !tbaa !9
  %56 = load float, ptr %15, align 4, !tbaa !9
  %57 = call <2 x float> @nk_vec2(float noundef %55, float noundef %56)
  store <2 x float> %57, ptr %16, align 4
  %58 = load <2 x float>, ptr %16, align 4
  call void @nk_draw_list_path_line_to(ptr noundef %54, <2 x float> %58)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %59

59:                                               ; preds = %35
  %60 = load i32, ptr %11, align 4, !tbaa !11
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %11, align 4, !tbaa !11
  br label %31, !llvm.loop !17

62:                                               ; preds = %31
  br label %63

63:                                               ; preds = %62, %25
  store i32 0, ptr %12, align 4
  br label %64

64:                                               ; preds = %63, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %65 = load i32, ptr %12, align 4
  switch i32 %65, label %67 [
    i32 0, label %66
    i32 1, label %66
  ]

66:                                               ; preds = %64, %64
  ret void

67:                                               ; preds = %64
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!14 = !{!15, !10, i64 0}
!15 = !{!"nk_vec2", !10, i64 0, !10, i64 4}
!16 = !{!15, !10, i64 4}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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_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_path_arc_to_fast = 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

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

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

7:                                                ; preds = %5
  %.not19 = icmp sgt i32 %3, %4
  br i1 %.not19, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %7
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.015.0.vec.extract = extractelement <2 x float> %1, i64 0
  %.sroa.015.4.vec.extract = extractelement <2 x float> %1, i64 1
  %9 = sext i32 %3 to i64
  %10 = add i32 %4, 1
  br label %11

11:                                               ; preds = %.preheader, %11
  %indvars.iv = phi i64 [ %9, %.preheader ], [ %indvars.iv.next, %11 ]
  %12 = urem i64 %indvars.iv, 12
  %13 = getelementptr inbounds [12 x %struct.nk_vec2], ptr %8, i64 0, i64 %12
  %.sroa.02.0.copyload = load float, ptr %13, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %13, i64 4
  %.sroa.4.0.copyload = load float, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %14 = tail call float @llvm.fmuladd.f32(float %.sroa.02.0.copyload, float %2, float %.sroa.015.0.vec.extract)
  %15 = tail call float @llvm.fmuladd.f32(float %.sroa.4.0.copyload, float %2, float %.sroa.015.4.vec.extract)
  %16 = tail call <2 x float> @nk_vec2(float noundef %14, float noundef %15)
  tail call void @nk_draw_list_path_line_to(ptr noundef nonnull %0, <2 x float> %16)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %10, %lftr.wideiv
  br i1 %exitcond.not, label %.loopexit, label %11, !llvm.loop !9

.loopexit:                                        ; preds = %11, %7
  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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass