; 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_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 }
%struct.nk_draw_command = type { i32, %struct.nk_rect, %union.nk_handle }

@nk_null_rect = external hidden constant %struct.nk_rect, align 4
@.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_line_to = external hidden unnamed_addr constant [70 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
define dso_local void @nk_draw_list_path_line_to(ptr noundef %0, <2 x float> %1) #3 {
  %3 = alloca %struct.nk_vec2, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store <2 x float> %1, ptr %3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  br label %12

11:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.2, i32 noundef 10001, ptr noundef @__PRETTY_FUNCTION__.nk_draw_list_path_line_to) #6
  unreachable

12:                                               ; preds = %10
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 1, ptr %7, align 4
  br label %57

16:                                               ; preds = %12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nk_draw_list, ptr %17, i32 0, i32 8
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %25, label %21

21:                                               ; preds = %16
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load <2 x float>, ptr @nk_null_rect, align 4
  %24 = load <2 x float>, ptr getelementptr inbounds ({ <2 x float>, <2 x float> }, ptr @nk_null_rect, i32 0, i32 1), align 4
  call void @nk_draw_list_add_clip(ptr noundef %22, <2 x float> %23, <2 x float> %24)
  br label %25

25:                                               ; preds = %21, %16
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call ptr @nk_draw_list_command_last(ptr noundef %26)
  store ptr %27, ptr %6, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %48

30:                                               ; preds = %25
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.nk_draw_command, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.nk_draw_list, ptr %34, i32 0, i32 2
  %36 = getelementptr inbounds %struct.nk_convert_config, ptr %35, i32 0, i32 6
  %37 = getelementptr inbounds %struct.nk_draw_null_texture, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = icmp ne ptr %33, %38
  br i1 %39, label %40, label %48

40:                                               ; preds = %30
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.nk_draw_list, ptr %42, i32 0, i32 2
  %44 = getelementptr inbounds %struct.nk_convert_config, ptr %43, i32 0, i32 6
  %45 = getelementptr inbounds %struct.nk_draw_null_texture, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %union.nk_handle, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8
  call void @nk_draw_list_push_image(ptr noundef %41, ptr %47)
  br label %48

48:                                               ; preds = %40, %30, %25
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = call ptr @nk_draw_list_alloc_path(ptr noundef %49, i32 noundef 1)
  store ptr %50, ptr %5, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %54, label %53

53:                                               ; preds = %48
  store i32 1, ptr %7, align 4
  br label %57

54:                                               ; preds = %48
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.nk_vec2, ptr %55, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %56, ptr align 4 %3, i64 8, i1 false), !tbaa.struct !19
  store i32 0, ptr %7, align 4
  br label %57

57:                                               ; preds = %54, %53, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %58 = load i32, ptr %7, align 4
  switch i32 %58, label %60 [
    i32 0, label %59
    i32 1, label %59
  ]

59:                                               ; preds = %57, %57
  ret void

60:                                               ; preds = %57
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_draw_list_command_last(ptr noundef) #4

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_draw_list_alloc_path(ptr noundef, i32 noundef) #4

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

%struct.nk_rect = type { float, float, float, float }

@nk_null_rect = external hidden local_unnamed_addr constant %struct.nk_rect, align 4
@.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_line_to = external hidden unnamed_addr constant [70 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
define dso_local void @nk_draw_list_path_line_to(ptr noundef %0, <2 x float> %1) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %3, label %4

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

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 208
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not16 = icmp eq i32 %6, 0
  br i1 %.not16, label %7, label %10

7:                                                ; preds = %4
  %8 = load <2 x float>, ptr @nk_null_rect, align 4
  %9 = load <2 x float>, ptr getelementptr inbounds (i8, ptr @nk_null_rect, i64 8), align 4
  tail call void @nk_draw_list_add_clip(ptr noundef nonnull %0, <2 x float> %8, <2 x float> %9)
  br label %10

10:                                               ; preds = %7, %4
  %11 = tail call ptr @nk_draw_list_command_last(ptr noundef nonnull %0)
  %.not17 = icmp eq ptr %11, null
  br i1 %.not17, label %18, label %12

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %11, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %0, i64 136
  %16 = load ptr, ptr %15, align 8
  %.not18 = icmp eq ptr %14, %16
  br i1 %.not18, label %18, label %17

17:                                               ; preds = %12
  tail call void @nk_draw_list_push_image(ptr noundef nonnull %0, ptr %16)
  br label %18

18:                                               ; preds = %17, %12, %10
  %19 = tail call ptr @nk_draw_list_alloc_path(ptr noundef nonnull %0, i32 noundef 1)
  %.not19 = icmp eq ptr %19, null
  br i1 %.not19, label %21, label %20

20:                                               ; preds = %18
  store <2 x float> %1, ptr %19, align 4
  br label %21

21:                                               ; preds = %18, %20
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_draw_list_command_last(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nk_draw_list_alloc_path(ptr noundef, i32 noundef) local_unnamed_addr #2

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"="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 = { 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 208}
!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}
!17 = !{!9, !9, i64 0}


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