; LLVM IR from khushmmehta/Scorch-V :: src/vendor/imgui/backends (imgui_impl_glfw)

; 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.ImGui_ImplGlfw_Data = type { ptr, i32, double, ptr, [9 x ptr], %struct.ImVec2, [348 x ptr], i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.ImVec2 = type { float, float }

@.str.2 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow = external hidden unnamed_addr constant [51 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: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() #1

; 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) #2

declare ptr @glfwSetWindowFocusCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetCursorEnterCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetCharCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetMonitorCallback(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %4 = call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  store ptr %4, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %5, i32 0, i32 7
  %7 = load i8, ptr %6, align 8, !tbaa !9, !range !16, !noundef !17
  %8 = trunc i8 %7 to i1
  %9 = zext i1 %8 to i32
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  br label %12

12:                                               ; preds = %11, %1
  %13 = phi i1 [ false, %1 ], [ true, %11 ]
  br i1 %13, label %14, label %15

14:                                               ; preds = %12
  br label %17

15:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef 533, ptr noundef @__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow) #5
  unreachable

16:                                               ; No predecessors!
  br label %17

17:                                               ; preds = %16, %14
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = icmp eq ptr %20, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %17
  br label %26

24:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 534, ptr noundef @__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow) #5
  unreachable

25:                                               ; No predecessors!
  br label %26

26:                                               ; preds = %25, %23
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %28, i32 0, i32 10
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = call ptr @glfwSetWindowFocusCallback(ptr noundef %27, ptr noundef %30)
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %33, i32 0, i32 12
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = call ptr @glfwSetCursorEnterCallback(ptr noundef %32, ptr noundef %35)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %38, i32 0, i32 11
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  %41 = call ptr @glfwSetCursorPosCallback(ptr noundef %37, ptr noundef %40)
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %43, i32 0, i32 13
  %45 = load ptr, ptr %44, align 8, !tbaa !22
  %46 = call ptr @glfwSetMouseButtonCallback(ptr noundef %42, ptr noundef %45)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %48, i32 0, i32 14
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  %51 = call ptr @glfwSetScrollCallback(ptr noundef %47, ptr noundef %50)
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %53, i32 0, i32 15
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = call ptr @glfwSetKeyCallback(ptr noundef %52, ptr noundef %55)
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %58, i32 0, i32 16
  %60 = load ptr, ptr %59, align 8, !tbaa !25
  %61 = call ptr @glfwSetCharCallback(ptr noundef %57, ptr noundef %60)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %62, i32 0, i32 17
  %64 = load ptr, ptr %63, align 8, !tbaa !26
  %65 = call ptr @glfwSetMonitorCallback(ptr noundef %64)
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %66, i32 0, i32 7
  store i8 0, ptr %67, align 8, !tbaa !9
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %68, i32 0, i32 10
  store ptr null, ptr %69, align 8, !tbaa !19
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %70, i32 0, i32 12
  store ptr null, ptr %71, align 8, !tbaa !20
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %72, i32 0, i32 11
  store ptr null, ptr %73, align 8, !tbaa !21
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %74, i32 0, i32 13
  store ptr null, ptr %75, align 8, !tbaa !22
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %76, i32 0, i32 14
  store ptr null, ptr %77, align 8, !tbaa !23
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %78, i32 0, i32 15
  store ptr null, ptr %79, align 8, !tbaa !24
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %80, i32 0, i32 16
  store ptr null, ptr %81, align 8, !tbaa !25
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %82, i32 0, i32 17
  store ptr null, ptr %83, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 "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 = { "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 }
attributes #5 = { 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++ TBAA"}
!9 = !{!10, !15, i64 2896}
!10 = !{!"_ZTS19ImGui_ImplGlfw_Data", !6, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !7, i64 32, !13, i64 104, !7, i64 112, !15, i64 2896, !15, i64 2897, !15, i64 2898, !6, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !6, i64 2960}
!11 = !{!"_ZTS13GlfwClientApi", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!10, !6, i64 0}
!19 = !{!10, !6, i64 2904}
!20 = !{!10, !6, i64 2920}
!21 = !{!10, !6, i64 2912}
!22 = !{!10, !6, i64 2928}
!23 = !{!10, !6, i64 2936}
!24 = !{!10, !6, i64 2944}
!25 = !{!10, !6, i64 2952}
!26 = !{!10, !6, i64 2960}


; 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 [100 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() local_unnamed_addr #0

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

declare ptr @glfwSetWindowFocusCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetCursorEnterCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetCharCallback(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetMonitorCallback(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  %3 = getelementptr inbounds i8, ptr %2, i64 2896
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !15, !noundef !16
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %7, label %6

6:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 533, ptr noundef nonnull @__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow) #4
  unreachable

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !17
  %9 = icmp eq ptr %8, %0
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 534, ptr noundef nonnull @__PRETTY_FUNCTION__._Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow) #4
  unreachable

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %2, i64 2904
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = tail call ptr @glfwSetWindowFocusCallback(ptr noundef %0, ptr noundef %13)
  %15 = getelementptr inbounds i8, ptr %2, i64 2920
  %16 = load ptr, ptr %15, align 8, !tbaa !19
  %17 = tail call ptr @glfwSetCursorEnterCallback(ptr noundef %0, ptr noundef %16)
  %18 = getelementptr inbounds i8, ptr %2, i64 2912
  %19 = load ptr, ptr %18, align 8, !tbaa !20
  %20 = tail call ptr @glfwSetCursorPosCallback(ptr noundef %0, ptr noundef %19)
  %21 = getelementptr inbounds i8, ptr %2, i64 2928
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  %23 = tail call ptr @glfwSetMouseButtonCallback(ptr noundef %0, ptr noundef %22)
  %24 = getelementptr inbounds i8, ptr %2, i64 2936
  %25 = load ptr, ptr %24, align 8, !tbaa !22
  %26 = tail call ptr @glfwSetScrollCallback(ptr noundef %0, ptr noundef %25)
  %27 = getelementptr inbounds i8, ptr %2, i64 2944
  %28 = load ptr, ptr %27, align 8, !tbaa !23
  %29 = tail call ptr @glfwSetKeyCallback(ptr noundef %0, ptr noundef %28)
  %30 = getelementptr inbounds i8, ptr %2, i64 2952
  %31 = load ptr, ptr %30, align 8, !tbaa !24
  %32 = tail call ptr @glfwSetCharCallback(ptr noundef %0, ptr noundef %31)
  %33 = getelementptr inbounds i8, ptr %2, i64 2960
  %34 = load ptr, ptr %33, align 8, !tbaa !25
  %35 = tail call ptr @glfwSetMonitorCallback(ptr noundef %34)
  store i8 0, ptr %3, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %12, i8 0, i64 64, i1 false)
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress 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 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !14, i64 2896}
!6 = !{!"_ZTS19ImGui_ImplGlfw_Data", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !8, i64 32, !12, i64 104, !8, i64 112, !14, i64 2896, !14, i64 2897, !14, i64 2898, !7, i64 2904, !7, i64 2912, !7, i64 2920, !7, i64 2928, !7, i64 2936, !7, i64 2944, !7, i64 2952, !7, i64 2960}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS13GlfwClientApi", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !7, i64 2904}
!19 = !{!6, !7, i64 2920}
!20 = !{!6, !7, i64 2912}
!21 = !{!6, !7, i64 2928}
!22 = !{!6, !7, i64 2936}
!23 = !{!6, !7, i64 2944}
!24 = !{!6, !7, i64 2952}
!25 = !{!6, !7, i64 2960}


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