; 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"

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_plot = external hidden unnamed_addr constant [79 x i8], align 1
@.str.132 = external hidden unnamed_addr constant [7 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

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

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

17:                                               ; preds = %5
  br label %19

18:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.33, ptr noundef @.str.2, i32 noundef 24298, ptr noundef @__PRETTY_FUNCTION__.nk_plot) #4
  unreachable

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

22:                                               ; preds = %19
  br label %24

23:                                               ; preds = %19
  call void @__assert_fail(ptr noundef @.str.132, ptr noundef @.str.2, i32 noundef 24299, ptr noundef @__PRETTY_FUNCTION__.nk_plot) #4
  unreachable

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

27:                                               ; preds = %24
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %34, label %33

33:                                               ; preds = %30, %27, %24
  store i32 1, ptr %14, align 4
  br label %124

34:                                               ; preds = %30
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds float, ptr %35, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !11
  store float %39, ptr %12, align 4, !tbaa !11
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds float, ptr %40, i64 %42
  %44 = load float, ptr %43, align 4, !tbaa !11
  store float %44, ptr %13, align 4, !tbaa !11
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %92, %34
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %49, label %95

49:                                               ; preds = %45
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load i32, ptr %11, align 4, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = add nsw i32 %51, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds float, ptr %50, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !11
  %57 = load float, ptr %12, align 4, !tbaa !11
  %58 = fcmp olt float %56, %57
  br i1 %58, label %59, label %67

59:                                               ; preds = %49
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = load i32, ptr %10, align 4, !tbaa !9
  %63 = add nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %60, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !11
  br label %69

67:                                               ; preds = %49
  %68 = load float, ptr %12, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %67, %59
  %70 = phi float [ %66, %59 ], [ %68, %67 ]
  store float %70, ptr %12, align 4, !tbaa !11
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = add nsw i32 %72, %73
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds float, ptr %71, i64 %75
  %77 = load float, ptr %76, align 4, !tbaa !11
  %78 = load float, ptr %13, align 4, !tbaa !11
  %79 = fcmp olt float %77, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %69
  %81 = load float, ptr %13, align 4, !tbaa !11
  br label %90

82:                                               ; preds = %69
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = add nsw i32 %84, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds float, ptr %83, i64 %87
  %89 = load float, ptr %88, align 4, !tbaa !11
  br label %90

90:                                               ; preds = %82, %80
  %91 = phi float [ %81, %80 ], [ %89, %82 ]
  store float %91, ptr %13, align 4, !tbaa !11
  br label %92

92:                                               ; preds = %90
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %11, align 4, !tbaa !9
  br label %45, !llvm.loop !13

95:                                               ; preds = %45
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = load float, ptr %12, align 4, !tbaa !11
  %100 = load float, ptr %13, align 4, !tbaa !11
  %101 = call i32 @nk_chart_begin(ptr noundef %96, i32 noundef %97, i32 noundef %98, float noundef %99, float noundef %100)
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %123

103:                                              ; preds = %95
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %118, %103
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %108, label %121

108:                                              ; preds = %104
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = load i32, ptr %11, align 4, !tbaa !9
  %112 = load i32, ptr %10, align 4, !tbaa !9
  %113 = add nsw i32 %111, %112
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds float, ptr %110, i64 %114
  %116 = load float, ptr %115, align 4, !tbaa !11
  %117 = call i32 @nk_chart_push(ptr noundef %109, float noundef %116)
  br label %118

118:                                              ; preds = %108
  %119 = load i32, ptr %11, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %11, align 4, !tbaa !9
  br label %104, !llvm.loop !15

121:                                              ; preds = %104
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  call void @nk_chart_end(ptr noundef %122)
  br label %123

123:                                              ; preds = %121, %95
  store i32 0, ptr %14, align 4
  br label %124

124:                                              ; preds = %123, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %125 = load i32, ptr %14, align 4
  switch i32 %125, label %127 [
    i32 0, label %126
    i32 1, label %126
  ]

126:                                              ; preds = %124, %124
  ret void

127:                                              ; preds = %124
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_plot = external hidden unnamed_addr constant [79 x i8], align 1
@.str.132 = external hidden unnamed_addr constant [7 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 dso_local i32 @nk_chart_begin(ptr noundef, i32 noundef, i32 noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_chart_push(ptr noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_chart_end(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @nk_plot(ptr noundef %0, i32 noundef %1, ptr noundef readonly %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %.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.33, ptr noundef nonnull @.str.2, i32 noundef 24298, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_plot) #2
  unreachable

7:                                                ; preds = %5
  %.not50 = icmp eq ptr %2, null
  br i1 %.not50, label %8, label %9

8:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.132, ptr noundef nonnull @.str.2, i32 noundef 24299, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_plot) #2
  unreachable

9:                                                ; preds = %7
  %.not51 = icmp eq i32 %3, 0
  br i1 %.not51, label %32, label %10

10:                                               ; preds = %9
  %11 = sext i32 %4 to i64
  %12 = getelementptr inbounds float, ptr %2, i64 %11
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = icmp sgt i32 %3, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %10
  %wide.trip.count = zext nneg i32 %3 to i64
  %invariant.gep = getelementptr float, ptr %2, i64 %11
  %xtraiter = and i64 %wide.trip.count, 1
  %15 = icmp eq i32 %3, 1
  br i1 %15, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %.055 = phi float [ %13, %.lr.ph.preheader.new ], [ %23, %.lr.ph ]
  %.04354 = phi float [ %13, %.lr.ph.preheader.new ], [ %..043.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  %16 = load float, ptr %gep, align 4, !tbaa !5
  %17 = fcmp olt float %16, %.04354
  %..043 = select i1 %17, float %16, float %.04354
  %18 = fcmp olt float %16, %.055
  %19 = select i1 %18, float %.055, float %16
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %gep.1 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next
  %20 = load float, ptr %gep.1, align 4, !tbaa !5
  %21 = fcmp olt float %20, %..043
  %..043.1 = select i1 %21, float %20, float %..043
  %22 = fcmp olt float %20, %19
  %23 = select i1 %22, float %19, float %20
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %..043.lcssa.ph = phi float [ poison, %.lr.ph.preheader ], [ %..043.1, %.lr.ph ]
  %.lcssa.ph = phi float [ poison, %.lr.ph.preheader ], [ %23, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %.055.unr = phi float [ %13, %.lr.ph.preheader ], [ %23, %.lr.ph ]
  %.04354.unr = phi float [ %13, %.lr.ph.preheader ], [ %..043.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %gep.epil = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.unr
  %24 = load float, ptr %gep.epil, align 4, !tbaa !5
  %25 = fcmp olt float %24, %.04354.unr
  %..043.epil = select i1 %25, float %24, float %.04354.unr
  %26 = fcmp olt float %24, %.055.unr
  %27 = select i1 %26, float %.055.unr, float %24
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %..043.lcssa = phi float [ %..043.lcssa.ph, %._crit_edge.unr-lcssa ], [ %..043.epil, %.lr.ph.epil ]
  %.lcssa = phi float [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %27, %.lr.ph.epil ]
  %28 = tail call i32 @nk_chart_begin(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %3, float noundef %..043.lcssa, float noundef %.lcssa)
  %.not52 = icmp eq i32 %28, 0
  br i1 %.not52, label %32, label %.preheader

._crit_edge.thread:                               ; preds = %10
  %29 = tail call i32 @nk_chart_begin(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %3, float noundef %13, float noundef %13)
  %.not5268 = icmp eq i32 %29, 0
  br i1 %.not5268, label %32, label %._crit_edge59

.preheader:                                       ; preds = %._crit_edge
  br i1 %14, label %.lr.ph58.preheader, label %._crit_edge59

.lr.ph58.preheader:                               ; preds = %.preheader
  %wide.trip.count64 = zext nneg i32 %3 to i64
  %invariant.gep69 = getelementptr float, ptr %2, i64 %11
  br label %.lr.ph58

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %.lr.ph58
  %indvars.iv61 = phi i64 [ 0, %.lr.ph58.preheader ], [ %indvars.iv.next62, %.lr.ph58 ]
  %gep70 = getelementptr float, ptr %invariant.gep69, i64 %indvars.iv61
  %30 = load float, ptr %gep70, align 4, !tbaa !5
  %31 = tail call i32 @nk_chart_push(ptr noundef nonnull %0, float noundef %30)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
  br i1 %exitcond65.not, label %._crit_edge59, label %.lr.ph58, !llvm.loop !11

._crit_edge59:                                    ; preds = %.lr.ph58, %._crit_edge.thread, %.preheader
  tail call void @nk_chart_end(ptr noundef nonnull %0)
  br label %32

32:                                               ; preds = %._crit_edge.thread, %._crit_edge, %._crit_edge59, %9
  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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass