; 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_window = type { i32, i32, [64 x i8], i32, %struct.nk_rect, %struct.nk_scroll, %struct.nk_command_buffer, ptr, float, %struct.nk_property_state, %struct.nk_popup_state, %struct.nk_edit_state, i32, ptr, i32, ptr, ptr, ptr }
%struct.nk_rect = type { float, float, float, float }
%struct.nk_scroll = type { i32, i32 }
%struct.nk_command_buffer = type { ptr, %struct.nk_rect, i32, %union.nk_handle, i64, i64, i64 }
%union.nk_handle = type { ptr }
%struct.nk_property_state = type { i32, i32, [64 x i8], i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.nk_popup_state = type { ptr, i32, %struct.nk_popup_buffer, i32, i32, i32, i32, i32, i32, %struct.nk_rect }
%struct.nk_popup_buffer = type { i64, i64, i64, i64, i32 }
%struct.nk_edit_state = type { i32, i32, i32, i32, i32, i32, i32, i32, %struct.nk_scroll, i8, i8 }

; 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 ptr @nk_window_find(ptr noundef, ptr noundef) #1

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

14:                                               ; preds = %3
  store i32 1, ptr %8, align 4
  br label %26

15:                                               ; preds = %3
  %16 = getelementptr inbounds %struct.nk_vec2, ptr %4, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.nk_window, ptr %18, i32 0, i32 4
  %20 = getelementptr inbounds %struct.nk_rect, ptr %19, i32 0, i32 0
  store float %17, ptr %20, align 4, !tbaa !12
  %21 = getelementptr inbounds %struct.nk_vec2, ptr %4, i32 0, i32 1
  %22 = load float, ptr %21, align 4, !tbaa !23
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.nk_window, ptr %23, i32 0, i32 4
  %25 = getelementptr inbounds %struct.nk_rect, ptr %24, i32 0, i32 1
  store float %22, ptr %25, align 4, !tbaa !24
  store i32 0, ptr %8, align 4
  br label %26

26:                                               ; preds = %15, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %27 = load i32, ptr %8, align 4
  switch i32 %27, label %29 [
    i32 0, label %28
    i32 1, label %28
  ]

28:                                               ; preds = %26, %26
  ret void

29:                                               ; preds = %26
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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, !11, i64 0}
!10 = !{!"nk_vec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 76}
!13 = !{!"nk_window", !14, i64 0, !14, i64 4, !7, i64 8, !14, i64 72, !15, i64 76, !16, i64 92, !17, i64 104, !6, i64 168, !11, i64 176, !19, i64 180, !20, i64 288, !22, i64 384, !14, i64 428, !6, i64 432, !14, i64 440, !6, i64 448, !6, i64 456, !6, i64 464}
!14 = !{!"int", !7, i64 0}
!15 = !{!"nk_rect", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!16 = !{!"nk_scroll", !14, i64 0, !14, i64 4}
!17 = !{!"nk_command_buffer", !6, i64 0, !15, i64 8, !14, i64 24, !7, i64 32, !18, i64 40, !18, i64 48, !18, i64 56}
!18 = !{!"long", !7, i64 0}
!19 = !{!"nk_property_state", !14, i64 0, !14, i64 4, !7, i64 8, !14, i64 72, !14, i64 76, !14, i64 80, !14, i64 84, !14, i64 88, !14, i64 92, !14, i64 96, !14, i64 100}
!20 = !{!"nk_popup_state", !6, i64 0, !14, i64 8, !21, i64 16, !14, i64 56, !14, i64 60, !14, i64 64, !14, i64 68, !14, i64 72, !14, i64 76, !15, i64 80}
!21 = !{!"nk_popup_buffer", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !14, i64 32}
!22 = !{!"nk_edit_state", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !16, i64 32, !7, i64 40, !7, i64 41}
!23 = !{!10, !11, i64 4}
!24 = !{!13, !11, i64 80}


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

; Function Attrs: nounwind uwtable
declare dso_local ptr @nk_window_find(ptr noundef, ptr noundef) local_unnamed_addr #0

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

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %4, i64 76
  store <2 x float> %2, ptr %6, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %3, %5
  ret void
}

attributes #0 = { 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 #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" }

!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"}


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