; LLVM IR from erincatto/box2d-lite :: extern/glfw/src/linux_joystick.ll (glfwTerminateJoysticksLinux)

; 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._GLFWlibrary = type { i32, %struct.anon, ptr, ptr, ptr, ptr, i32, [16 x %struct._GLFWjoystick], ptr, i32, %struct._GLFWtls, %struct._GLFWtls, %struct._GLFWmutex, %struct.anon.4, %struct.anon.5, %struct.anon.6, %struct._GLFWlibraryX11, %struct._GLFWlibraryGLX, %struct._GLFWlibraryLinux, %struct._GLFWlibraryEGL, %struct._GLFWlibraryOSMesa }
%struct.anon = type { %struct._GLFWinitconfig, %struct._GLFWfbconfig, %struct._GLFWwndconfig, %struct._GLFWctxconfig, i32 }
%struct._GLFWinitconfig = type { i32, %struct.anon.0 }
%struct.anon.0 = type { i32, i32 }
%struct._GLFWfbconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64 }
%struct._GLFWwndconfig = type { i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.anon.1, %struct.anon.2 }
%struct.anon.1 = type { i32, [256 x i8] }
%struct.anon.2 = type { [256 x i8], [256 x i8] }
%struct._GLFWctxconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, %struct.anon.3 }
%struct.anon.3 = type { i32 }
%struct._GLFWjoystick = type { i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, [33 x i8], ptr, %struct._GLFWjoystickLinux }
%struct._GLFWjoystickLinux = type { i32, [4096 x i8], [512 x i32], [64 x i32], [64 x %struct.input_absinfo], [4 x [2 x i32]] }
%struct.input_absinfo = type { i32, i32, i32, i32, i32, i32 }
%struct._GLFWtls = type { %struct._GLFWtlsPOSIX }
%struct._GLFWtlsPOSIX = type { i32, i32 }
%struct._GLFWmutex = type { %struct._GLFWmutexPOSIX }
%struct._GLFWmutexPOSIX = type { i32, %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.anon.4 = type { i64, %struct._GLFWtimerPOSIX }
%struct._GLFWtimerPOSIX = type { i32, i64 }
%struct.anon.5 = type { i32, ptr, [2 x ptr], ptr, ptr, i32, i32, i32 }
%struct.anon.6 = type { ptr, ptr }
%struct._GLFWlibraryX11 = type { ptr, i32, i64, float, float, i64, i64, i32, ptr, i32, ptr, ptr, [5 x i8], [256 x i16], [349 x i16], double, double, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.anon.7, %struct.anon.8, %struct.anon.9, %struct.anon.10, %struct.anon.11, %struct.anon.12, %struct.anon.13, %struct.anon.14, %struct.anon.15, %struct.anon.16 }
%struct.anon.7 = type { i32, ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.anon.8 = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.9 = type { i32, i32, i32, i32, i32 }
%struct.anon.10 = type { i32, i64, i64 }
%struct.anon.11 = type { ptr, ptr, ptr, ptr }
%struct.anon.12 = type { i32, ptr, i32, i32, ptr, ptr, ptr }
%struct.anon.13 = type { ptr, ptr }
%struct.anon.14 = type { i32, ptr, i32, i32, ptr, ptr, ptr, ptr }
%struct.anon.15 = type { i32, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.anon.16 = type { i32, ptr, i32, i32, i32, i32, ptr, ptr, ptr }
%struct._GLFWlibraryGLX = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct._GLFWlibraryLinux = type { i32, i32, %struct.re_pattern_buffer, i32 }
%struct.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
%struct._GLFWlibraryEGL = type { ptr, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._GLFWlibraryOSMesa = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@_glfw = external global %struct._GLFWlibrary, align 8

; 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
define dso_local void @_glfwTerminateJoysticksLinux() #1 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %3

3:                                                ; preds = %17, %0
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = icmp sle i32 %4, 15
  br i1 %5, label %6, label %20

6:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds %struct._GLFWjoystick, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 7), i64 %8
  store ptr %9, ptr %2, align 8, !tbaa !9
  %10 = load ptr, ptr %2, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct._GLFWjoystick, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %16

14:                                               ; preds = %6
  %15 = load ptr, ptr %2, align 8, !tbaa !9
  call void @closeJoystick(ptr noundef %15)
  br label %16

16:                                               ; preds = %14, %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  br label %17

17:                                               ; preds = %16
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %1, align 4, !tbaa !5
  br label %3, !llvm.loop !14

20:                                               ; preds = %3
  call void @regfree(ptr noundef getelementptr inbounds (%struct._GLFWlibraryLinux, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), i32 0, i32 2))
  %21 = load i32, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), align 8, !tbaa !16
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %23, label %33

23:                                               ; preds = %20
  %24 = load i32, ptr getelementptr inbounds (%struct._GLFWlibraryLinux, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), i32 0, i32 1), align 4, !tbaa !53
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %26, label %30

26:                                               ; preds = %23
  %27 = load i32, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), align 8, !tbaa !16
  %28 = load i32, ptr getelementptr inbounds (%struct._GLFWlibraryLinux, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), i32 0, i32 1), align 4, !tbaa !53
  %29 = call i32 @inotify_rm_watch(i32 noundef %27, i32 noundef %28) #4
  br label %30

30:                                               ; preds = %26, %23
  %31 = load i32, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 18), align 8, !tbaa !16
  %32 = call i32 @close(i32 noundef %31)
  br label %33

33:                                               ; preds = %30, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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

declare void @regfree(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @inotify_rm_watch(i32 noundef, i32 noundef) #3

declare i32 @close(i32 noundef) #2

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_GLFWjoystick", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 112, !13, i64 120}
!13 = !{!"_GLFWjoystickLinux", !6, i64 0, !7, i64 4, !7, i64 4100, !7, i64 6148, !7, i64 6404, !7, i64 7940}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 133184}
!17 = !{!"_GLFWlibrary", !6, i64 0, !18, i64 8, !10, i64 992, !10, i64 1000, !10, i64 1008, !10, i64 1016, !6, i64 1024, !7, i64 1032, !10, i64 130568, !6, i64 130576, !28, i64 130580, !28, i64 130588, !30, i64 130600, !32, i64 130648, !34, i64 130672, !35, i64 130736, !36, i64 130752, !48, i64 132960, !49, i64 133184, !51, i64 133264, !52, i64 133440}
!18 = !{!"", !19, i64 0, !21, i64 16, !23, i64 88, !26, i64 920, !6, i64 976}
!19 = !{!"_GLFWinitconfig", !6, i64 0, !20, i64 4}
!20 = !{!"", !6, i64 0, !6, i64 4}
!21 = !{!"_GLFWfbconfig", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !22, i64 64}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_GLFWwndconfig", !6, i64 0, !6, i64 4, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !24, i64 56, !25, i64 316}
!24 = !{!"", !6, i64 0, !7, i64 4}
!25 = !{!"", !7, i64 0, !7, i64 256}
!26 = !{!"_GLFWctxconfig", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !10, i64 40, !27, i64 48}
!27 = !{!"", !6, i64 0}
!28 = !{!"_GLFWtls", !29, i64 0}
!29 = !{!"_GLFWtlsPOSIX", !6, i64 0, !6, i64 4}
!30 = !{!"_GLFWmutex", !31, i64 0}
!31 = !{!"_GLFWmutexPOSIX", !6, i64 0, !7, i64 8}
!32 = !{!"", !22, i64 0, !33, i64 8}
!33 = !{!"_GLFWtimerPOSIX", !6, i64 0, !22, i64 8}
!34 = !{!"", !6, i64 0, !10, i64 8, !7, i64 16, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 52, !6, i64 56}
!35 = !{!"", !10, i64 0, !10, i64 8}
!36 = !{!"_GLFWlibraryX11", !10, i64 0, !6, i64 8, !22, i64 16, !37, i64 24, !37, i64 28, !22, i64 32, !22, i64 40, !6, i64 48, !10, i64 56, !6, i64 64, !10, i64 72, !10, i64 80, !7, i64 88, !7, i64 94, !7, i64 606, !38, i64 1304, !38, i64 1312, !10, i64 1320, !22, i64 1328, !22, i64 1336, !22, i64 1344, !22, i64 1352, !22, i64 1360, !22, i64 1368, !22, i64 1376, !22, i64 1384, !22, i64 1392, !22, i64 1400, !22, i64 1408, !22, i64 1416, !22, i64 1424, !22, i64 1432, !22, i64 1440, !22, i64 1448, !22, i64 1456, !22, i64 1464, !22, i64 1472, !22, i64 1480, !22, i64 1488, !22, i64 1496, !22, i64 1504, !22, i64 1512, !22, i64 1520, !22, i64 1528, !22, i64 1536, !22, i64 1544, !22, i64 1552, !22, i64 1560, !22, i64 1568, !22, i64 1576, !22, i64 1584, !22, i64 1592, !22, i64 1600, !22, i64 1608, !22, i64 1616, !22, i64 1624, !22, i64 1632, !22, i64 1640, !22, i64 1648, !22, i64 1656, !22, i64 1664, !22, i64 1672, !22, i64 1680, !22, i64 1688, !39, i64 1696, !40, i64 1872, !41, i64 1900, !42, i64 1920, !43, i64 1944, !44, i64 1976, !35, i64 2024, !45, i64 2040, !46, i64 2096, !47, i64 2152}
!37 = !{!"float", !7, i64 0}
!38 = !{!"double", !7, i64 0}
!39 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168}
!40 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!41 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!42 = !{!"", !6, i64 0, !22, i64 8, !22, i64 16}
!43 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!44 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !10, i64 24, !10, i64 32, !10, i64 40}
!45 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!46 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !10, i64 40, !10, i64 48}
!47 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !10, i64 32, !10, i64 40, !10, i64 48}
!48 = !{!"_GLFWlibraryGLX", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !6, i64 176, !6, i64 180, !6, i64 184, !6, i64 188, !6, i64 192, !6, i64 196, !6, i64 200, !6, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !6, i64 220}
!49 = !{!"_GLFWlibraryLinux", !6, i64 0, !6, i64 4, !50, i64 8, !6, i64 72}
!50 = !{!"re_pattern_buffer", !10, i64 0, !22, i64 8, !22, i64 16, !22, i64 24, !10, i64 32, !10, i64 40, !22, i64 48, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56}
!51 = !{!"_GLFWlibraryEGL", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168}
!52 = !{!"_GLFWlibraryOSMesa", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!53 = !{!17, !6, i64 133188}


; 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._GLFWlibrary = type { i32, %struct.anon, ptr, ptr, ptr, ptr, i32, [16 x %struct._GLFWjoystick], ptr, i32, %struct._GLFWtls, %struct._GLFWtls, %struct._GLFWmutex, %struct.anon.4, %struct.anon.5, %struct.anon.6, %struct._GLFWlibraryX11, %struct._GLFWlibraryGLX, %struct._GLFWlibraryLinux, %struct._GLFWlibraryEGL, %struct._GLFWlibraryOSMesa }
%struct.anon = type { %struct._GLFWinitconfig, %struct._GLFWfbconfig, %struct._GLFWwndconfig, %struct._GLFWctxconfig, i32 }
%struct._GLFWinitconfig = type { i32, %struct.anon.0 }
%struct.anon.0 = type { i32, i32 }
%struct._GLFWfbconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64 }
%struct._GLFWwndconfig = type { i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.anon.1, %struct.anon.2 }
%struct.anon.1 = type { i32, [256 x i8] }
%struct.anon.2 = type { [256 x i8], [256 x i8] }
%struct._GLFWctxconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, %struct.anon.3 }
%struct.anon.3 = type { i32 }
%struct._GLFWjoystick = type { i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, [33 x i8], ptr, %struct._GLFWjoystickLinux }
%struct._GLFWjoystickLinux = type { i32, [4096 x i8], [512 x i32], [64 x i32], [64 x %struct.input_absinfo], [4 x [2 x i32]] }
%struct.input_absinfo = type { i32, i32, i32, i32, i32, i32 }
%struct._GLFWtls = type { %struct._GLFWtlsPOSIX }
%struct._GLFWtlsPOSIX = type { i32, i32 }
%struct._GLFWmutex = type { %struct._GLFWmutexPOSIX }
%struct._GLFWmutexPOSIX = type { i32, %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.anon.4 = type { i64, %struct._GLFWtimerPOSIX }
%struct._GLFWtimerPOSIX = type { i32, i64 }
%struct.anon.5 = type { i32, ptr, [2 x ptr], ptr, ptr, i32, i32, i32 }
%struct.anon.6 = type { ptr, ptr }
%struct._GLFWlibraryX11 = type { ptr, i32, i64, float, float, i64, i64, i32, ptr, i32, ptr, ptr, [5 x i8], [256 x i16], [349 x i16], double, double, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.anon.7, %struct.anon.8, %struct.anon.9, %struct.anon.10, %struct.anon.11, %struct.anon.12, %struct.anon.13, %struct.anon.14, %struct.anon.15, %struct.anon.16 }
%struct.anon.7 = type { i32, ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.anon.8 = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.9 = type { i32, i32, i32, i32, i32 }
%struct.anon.10 = type { i32, i64, i64 }
%struct.anon.11 = type { ptr, ptr, ptr, ptr }
%struct.anon.12 = type { i32, ptr, i32, i32, ptr, ptr, ptr }
%struct.anon.13 = type { ptr, ptr }
%struct.anon.14 = type { i32, ptr, i32, i32, ptr, ptr, ptr, ptr }
%struct.anon.15 = type { i32, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.anon.16 = type { i32, ptr, i32, i32, i32, i32, ptr, ptr, ptr }
%struct._GLFWlibraryGLX = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct._GLFWlibraryLinux = type { i32, i32, %struct.re_pattern_buffer, i32 }
%struct.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
%struct._GLFWlibraryEGL = type { ptr, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._GLFWlibraryOSMesa = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@_glfw = external global %struct._GLFWlibrary, align 8

; Function Attrs: nounwind uwtable
define dso_local void @_glfwTerminateJoysticksLinux() local_unnamed_addr #0 {
  %1 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 1032), align 8, !tbaa !5
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %3, label %2

2:                                                ; preds = %0
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 1032))
  br label %3

3:                                                ; preds = %2, %0
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 9128), align 8, !tbaa !5
  %.not.1 = icmp eq i32 %4, 0
  br i1 %.not.1, label %6, label %5

5:                                                ; preds = %3
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 9128))
  br label %6

6:                                                ; preds = %5, %3
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 17224), align 8, !tbaa !5
  %.not.2 = icmp eq i32 %7, 0
  br i1 %.not.2, label %9, label %8

8:                                                ; preds = %6
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 17224))
  br label %9

9:                                                ; preds = %8, %6
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 25320), align 8, !tbaa !5
  %.not.3 = icmp eq i32 %10, 0
  br i1 %.not.3, label %12, label %11

11:                                               ; preds = %9
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 25320))
  br label %12

12:                                               ; preds = %11, %9
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 33416), align 8, !tbaa !5
  %.not.4 = icmp eq i32 %13, 0
  br i1 %.not.4, label %15, label %14

14:                                               ; preds = %12
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 33416))
  br label %15

15:                                               ; preds = %14, %12
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 41512), align 8, !tbaa !5
  %.not.5 = icmp eq i32 %16, 0
  br i1 %.not.5, label %18, label %17

17:                                               ; preds = %15
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 41512))
  br label %18

18:                                               ; preds = %17, %15
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 49608), align 8, !tbaa !5
  %.not.6 = icmp eq i32 %19, 0
  br i1 %.not.6, label %21, label %20

20:                                               ; preds = %18
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 49608))
  br label %21

21:                                               ; preds = %20, %18
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 57704), align 8, !tbaa !5
  %.not.7 = icmp eq i32 %22, 0
  br i1 %.not.7, label %24, label %23

23:                                               ; preds = %21
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 57704))
  br label %24

24:                                               ; preds = %23, %21
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 65800), align 8, !tbaa !5
  %.not.8 = icmp eq i32 %25, 0
  br i1 %.not.8, label %27, label %26

26:                                               ; preds = %24
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 65800))
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 73896), align 8, !tbaa !5
  %.not.9 = icmp eq i32 %28, 0
  br i1 %.not.9, label %30, label %29

29:                                               ; preds = %27
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 73896))
  br label %30

30:                                               ; preds = %29, %27
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 81992), align 8, !tbaa !5
  %.not.10 = icmp eq i32 %31, 0
  br i1 %.not.10, label %33, label %32

32:                                               ; preds = %30
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 81992))
  br label %33

33:                                               ; preds = %32, %30
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 90088), align 8, !tbaa !5
  %.not.11 = icmp eq i32 %34, 0
  br i1 %.not.11, label %36, label %35

35:                                               ; preds = %33
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 90088))
  br label %36

36:                                               ; preds = %35, %33
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 98184), align 8, !tbaa !5
  %.not.12 = icmp eq i32 %37, 0
  br i1 %.not.12, label %39, label %38

38:                                               ; preds = %36
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 98184))
  br label %39

39:                                               ; preds = %38, %36
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 106280), align 8, !tbaa !5
  %.not.13 = icmp eq i32 %40, 0
  br i1 %.not.13, label %42, label %41

41:                                               ; preds = %39
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 106280))
  br label %42

42:                                               ; preds = %41, %39
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 114376), align 8, !tbaa !5
  %.not.14 = icmp eq i32 %43, 0
  br i1 %.not.14, label %45, label %44

44:                                               ; preds = %42
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 114376))
  br label %45

45:                                               ; preds = %44, %42
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 122472), align 8, !tbaa !5
  %.not.15 = icmp eq i32 %46, 0
  br i1 %.not.15, label %48, label %47

47:                                               ; preds = %45
  tail call void @closeJoystick(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 122472))
  br label %48

48:                                               ; preds = %47, %45
  tail call void @regfree(ptr noundef nonnull getelementptr inbounds (i8, ptr @_glfw, i64 133192)) #3
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 133184), align 8, !tbaa !12
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %51, label %59

51:                                               ; preds = %48
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 133188), align 4, !tbaa !49
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %51
  %55 = tail call i32 @inotify_rm_watch(i32 noundef %49, i32 noundef %52) #3
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 133184), align 8, !tbaa !12
  br label %56

56:                                               ; preds = %54, %51
  %57 = phi i32 [ %.pre, %54 ], [ %49, %51 ]
  %58 = tail call i32 @close(i32 noundef %57) #3
  br label %59

59:                                               ; preds = %56, %48
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @closeJoystick(ptr noundef) local_unnamed_addr #0

declare void @regfree(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @inotify_rm_watch(i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @close(i32 noundef) local_unnamed_addr #1

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 = { "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 "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, !7, i64 0}
!6 = !{!"_GLFWjoystick", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !7, i64 48, !10, i64 56, !10, i64 64, !8, i64 72, !10, i64 112, !11, i64 120}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_GLFWjoystickLinux", !7, i64 0, !8, i64 4, !8, i64 4100, !8, i64 6148, !8, i64 6404, !8, i64 7940}
!12 = !{!13, !7, i64 133184}
!13 = !{!"_GLFWlibrary", !7, i64 0, !14, i64 8, !10, i64 992, !10, i64 1000, !10, i64 1008, !10, i64 1016, !7, i64 1024, !8, i64 1032, !10, i64 130568, !7, i64 130576, !24, i64 130580, !24, i64 130588, !26, i64 130600, !28, i64 130648, !30, i64 130672, !31, i64 130736, !32, i64 130752, !44, i64 132960, !45, i64 133184, !47, i64 133264, !48, i64 133440}
!14 = !{!"", !15, i64 0, !17, i64 16, !19, i64 88, !22, i64 920, !7, i64 976}
!15 = !{!"_GLFWinitconfig", !7, i64 0, !16, i64 4}
!16 = !{!"", !7, i64 0, !7, i64 4}
!17 = !{!"_GLFWfbconfig", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !18, i64 64}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_GLFWwndconfig", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !20, i64 56, !21, i64 316}
!20 = !{!"", !7, i64 0, !8, i64 4}
!21 = !{!"", !8, i64 0, !8, i64 256}
!22 = !{!"_GLFWctxconfig", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !23, i64 48}
!23 = !{!"", !7, i64 0}
!24 = !{!"_GLFWtls", !25, i64 0}
!25 = !{!"_GLFWtlsPOSIX", !7, i64 0, !7, i64 4}
!26 = !{!"_GLFWmutex", !27, i64 0}
!27 = !{!"_GLFWmutexPOSIX", !7, i64 0, !8, i64 8}
!28 = !{!"", !18, i64 0, !29, i64 8}
!29 = !{!"_GLFWtimerPOSIX", !7, i64 0, !18, i64 8}
!30 = !{!"", !7, i64 0, !10, i64 8, !8, i64 16, !10, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !7, i64 56}
!31 = !{!"", !10, i64 0, !10, i64 8}
!32 = !{!"_GLFWlibraryX11", !10, i64 0, !7, i64 8, !18, i64 16, !33, i64 24, !33, i64 28, !18, i64 32, !18, i64 40, !7, i64 48, !10, i64 56, !7, i64 64, !10, i64 72, !10, i64 80, !8, i64 88, !8, i64 94, !8, i64 606, !34, i64 1304, !34, i64 1312, !10, i64 1320, !18, i64 1328, !18, i64 1336, !18, i64 1344, !18, i64 1352, !18, i64 1360, !18, i64 1368, !18, i64 1376, !18, i64 1384, !18, i64 1392, !18, i64 1400, !18, i64 1408, !18, i64 1416, !18, i64 1424, !18, i64 1432, !18, i64 1440, !18, i64 1448, !18, i64 1456, !18, i64 1464, !18, i64 1472, !18, i64 1480, !18, i64 1488, !18, i64 1496, !18, i64 1504, !18, i64 1512, !18, i64 1520, !18, i64 1528, !18, i64 1536, !18, i64 1544, !18, i64 1552, !18, i64 1560, !18, i64 1568, !18, i64 1576, !18, i64 1584, !18, i64 1592, !18, i64 1600, !18, i64 1608, !18, i64 1616, !18, i64 1624, !18, i64 1632, !18, i64 1640, !18, i64 1648, !18, i64 1656, !18, i64 1664, !18, i64 1672, !18, i64 1680, !18, i64 1688, !35, i64 1696, !36, i64 1872, !37, i64 1900, !38, i64 1920, !39, i64 1944, !40, i64 1976, !31, i64 2024, !41, i64 2040, !42, i64 2096, !43, i64 2152}
!33 = !{!"float", !8, i64 0}
!34 = !{!"double", !8, i64 0}
!35 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168}
!36 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24}
!37 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!38 = !{!"", !7, i64 0, !18, i64 8, !18, i64 16}
!39 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!40 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40}
!41 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!42 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 40, !10, i64 48}
!43 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !10, i64 48}
!44 = !{!"_GLFWlibraryGLX", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !7, i64 176, !7, i64 180, !7, i64 184, !7, i64 188, !7, i64 192, !7, i64 196, !7, i64 200, !7, i64 204, !7, i64 208, !7, i64 212, !7, i64 216, !7, i64 220}
!45 = !{!"_GLFWlibraryLinux", !7, i64 0, !7, i64 4, !46, i64 8, !7, i64 72}
!46 = !{!"re_pattern_buffer", !10, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !10, i64 32, !10, i64 40, !18, i64 48, !7, i64 56, !7, i64 56, !7, i64 56, !7, i64 56, !7, i64 56, !7, i64 56, !7, i64 56}
!47 = !{!"_GLFWlibraryEGL", !10, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168}
!48 = !{!"_GLFWlibraryOSMesa", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!49 = !{!13, !7, i64 133188}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass