; LLVM IR from erincatto/box2d-lite :: extern/glfw/src (input)

; 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.0, ptr, ptr, ptr, ptr, i32, [16 x %struct._GLFWjoystick], ptr, i32, %struct._GLFWtls, %struct._GLFWtls, %struct._GLFWmutex, %struct.anon.5, %struct.anon.6, %struct.anon.7, %struct._GLFWlibraryX11, %struct._GLFWlibraryGLX, %struct._GLFWlibraryLinux, %struct._GLFWlibraryEGL, %struct._GLFWlibraryOSMesa }
%struct.anon.0 = type { %struct._GLFWinitconfig, %struct._GLFWfbconfig, %struct._GLFWwndconfig, %struct._GLFWctxconfig, i32 }
%struct._GLFWinitconfig = type { i32, %struct.anon.1 }
%struct.anon.1 = 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.2, %struct.anon.3 }
%struct.anon.2 = type { i32, [256 x i8] }
%struct.anon.3 = type { [256 x i8], [256 x i8] }
%struct._GLFWctxconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, %struct.anon.4 }
%struct.anon.4 = 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.5 = type { i64, %struct._GLFWtimerPOSIX }
%struct._GLFWtimerPOSIX = type { i32, i64 }
%struct.anon.6 = type { i32, ptr, [2 x ptr], ptr, ptr, i32, i32, i32 }
%struct.anon.7 = 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.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.17 }
%struct.anon.8 = 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.9 = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.10 = type { i32, i32, i32, i32, i32 }
%struct.anon.11 = type { i32, i64, i64 }
%struct.anon.12 = type { ptr, ptr, ptr, ptr }
%struct.anon.13 = type { i32, ptr, i32, i32, ptr, ptr, ptr }
%struct.anon.14 = type { ptr, ptr }
%struct.anon.15 = type { i32, ptr, i32, i32, ptr, ptr, ptr, ptr }
%struct.anon.16 = type { i32, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.anon.17 = 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
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__.glfwGetJoystickButtons = external hidden unnamed_addr constant [56 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

declare void @_glfwInputError(i32 noundef, ptr noundef, ...) #2

declare i32 @_glfwPlatformPollJoystick(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @glfwGetJoystickButtons(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = icmp sge i32 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  br label %12

11:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 930, ptr noundef @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #5
  unreachable

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

15:                                               ; preds = %12
  br label %17

16:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 931, ptr noundef @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #5
  unreachable

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

20:                                               ; preds = %17
  br label %22

21:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 932, ptr noundef @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #5
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  store i32 0, ptr %23, align 4, !tbaa !5
  %24 = load i32, ptr @_glfw, align 8, !tbaa !11
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void (i32, ptr, ...) @_glfwInputError(i32 noundef 65537, ptr noundef null)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

27:                                               ; preds = %22
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 15
  br i1 %32, label %33, label %35

33:                                               ; preds = %30, %27
  %34 = load i32, ptr %4, align 4, !tbaa !5
  call void (i32, ptr, ...) @_glfwInputError(i32 noundef 65539, ptr noundef @.str.11, i32 noundef %34)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

35:                                               ; preds = %30
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %struct._GLFWjoystick, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 7), i64 %37
  store ptr %38, ptr %6, align 8, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct._GLFWjoystick, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !48
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %44, label %43

43:                                               ; preds = %35
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

44:                                               ; preds = %35
  %45 = load ptr, ptr %6, align 8, !tbaa !9
  %46 = call i32 @_glfwPlatformPollJoystick(ptr noundef %45, i32 noundef 2)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

49:                                               ; preds = %44
  %50 = load i32, ptr getelementptr inbounds (%struct._GLFWlibrary, ptr @_glfw, i32 0, i32 1), align 8, !tbaa !51
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %62

52:                                               ; preds = %49
  %53 = load ptr, ptr %6, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct._GLFWjoystick, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 8, !tbaa !52
  %56 = load ptr, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct._GLFWjoystick, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %57, align 8, !tbaa !53
  %59 = mul nsw i32 %58, 4
  %60 = add nsw i32 %55, %59
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  store i32 %60, ptr %61, align 4, !tbaa !5
  br label %67

62:                                               ; preds = %49
  %63 = load ptr, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct._GLFWjoystick, ptr %63, i32 0, i32 4
  %65 = load i32, ptr %64, align 8, !tbaa !52
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  store i32 %65, ptr %66, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %62, %52
  %68 = load ptr, ptr %6, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct._GLFWjoystick, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !54
  store ptr %70, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

71:                                               ; preds = %67, %48, %43, %33, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %72 = load ptr, ptr %3, align 8
  ret ptr %72
}

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 = { "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"="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 #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 = !{!"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 = !{!"_GLFWlibrary", !6, i64 0, !13, 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, !23, i64 130580, !23, i64 130588, !25, i64 130600, !27, i64 130648, !29, i64 130672, !30, i64 130736, !31, i64 130752, !43, i64 132960, !44, i64 133184, !46, i64 133264, !47, i64 133440}
!13 = !{!"", !14, i64 0, !16, i64 16, !18, i64 88, !21, i64 920, !6, i64 976}
!14 = !{!"_GLFWinitconfig", !6, i64 0, !15, i64 4}
!15 = !{!"", !6, i64 0, !6, i64 4}
!16 = !{!"_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, !17, i64 64}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_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, !19, i64 56, !20, i64 316}
!19 = !{!"", !6, i64 0, !7, i64 4}
!20 = !{!"", !7, i64 0, !7, i64 256}
!21 = !{!"_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, !22, i64 48}
!22 = !{!"", !6, i64 0}
!23 = !{!"_GLFWtls", !24, i64 0}
!24 = !{!"_GLFWtlsPOSIX", !6, i64 0, !6, i64 4}
!25 = !{!"_GLFWmutex", !26, i64 0}
!26 = !{!"_GLFWmutexPOSIX", !6, i64 0, !7, i64 8}
!27 = !{!"", !17, i64 0, !28, i64 8}
!28 = !{!"_GLFWtimerPOSIX", !6, i64 0, !17, i64 8}
!29 = !{!"", !6, i64 0, !10, i64 8, !7, i64 16, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 52, !6, i64 56}
!30 = !{!"", !10, i64 0, !10, i64 8}
!31 = !{!"_GLFWlibraryX11", !10, i64 0, !6, i64 8, !17, i64 16, !32, i64 24, !32, i64 28, !17, i64 32, !17, 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, !33, i64 1304, !33, i64 1312, !10, i64 1320, !17, i64 1328, !17, i64 1336, !17, i64 1344, !17, i64 1352, !17, i64 1360, !17, i64 1368, !17, i64 1376, !17, i64 1384, !17, i64 1392, !17, i64 1400, !17, i64 1408, !17, i64 1416, !17, i64 1424, !17, i64 1432, !17, i64 1440, !17, i64 1448, !17, i64 1456, !17, i64 1464, !17, i64 1472, !17, i64 1480, !17, i64 1488, !17, i64 1496, !17, i64 1504, !17, i64 1512, !17, i64 1520, !17, i64 1528, !17, i64 1536, !17, i64 1544, !17, i64 1552, !17, i64 1560, !17, i64 1568, !17, i64 1576, !17, i64 1584, !17, i64 1592, !17, i64 1600, !17, i64 1608, !17, i64 1616, !17, i64 1624, !17, i64 1632, !17, i64 1640, !17, i64 1648, !17, i64 1656, !17, i64 1664, !17, i64 1672, !17, i64 1680, !17, i64 1688, !34, i64 1696, !35, i64 1872, !36, i64 1900, !37, i64 1920, !38, i64 1944, !39, i64 1976, !30, i64 2024, !40, i64 2040, !41, i64 2096, !42, i64 2152}
!32 = !{!"float", !7, i64 0}
!33 = !{!"double", !7, i64 0}
!34 = !{!"", !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}
!35 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!36 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!37 = !{!"", !6, i64 0, !17, i64 8, !17, i64 16}
!38 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!39 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !10, i64 24, !10, i64 32, !10, i64 40}
!40 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!41 = !{!"", !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}
!42 = !{!"", !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}
!43 = !{!"_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}
!44 = !{!"_GLFWlibraryLinux", !6, i64 0, !6, i64 4, !45, i64 8, !6, i64 72}
!45 = !{!"re_pattern_buffer", !10, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !10, i64 32, !10, i64 40, !17, i64 48, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56, !6, i64 56}
!46 = !{!"_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}
!47 = !{!"_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}
!48 = !{!49, !6, i64 0}
!49 = !{!"_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, !50, i64 120}
!50 = !{!"_GLFWjoystickLinux", !6, i64 0, !7, i64 4, !7, i64 4100, !7, i64 6148, !7, i64 6404, !7, i64 7940}
!51 = !{!12, !6, i64 8}
!52 = !{!49, !6, i64 32}
!53 = !{!49, !6, i64 48}
!54 = !{!49, !10, i64 24}


; 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.0, ptr, ptr, ptr, ptr, i32, [16 x %struct._GLFWjoystick], ptr, i32, %struct._GLFWtls, %struct._GLFWtls, %struct._GLFWmutex, %struct.anon.5, %struct.anon.6, %struct.anon.7, %struct._GLFWlibraryX11, %struct._GLFWlibraryGLX, %struct._GLFWlibraryLinux, %struct._GLFWlibraryEGL, %struct._GLFWlibraryOSMesa }
%struct.anon.0 = type { %struct._GLFWinitconfig, %struct._GLFWfbconfig, %struct._GLFWwndconfig, %struct._GLFWctxconfig, i32 }
%struct._GLFWinitconfig = type { i32, %struct.anon.1 }
%struct.anon.1 = 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.2, %struct.anon.3 }
%struct.anon.2 = type { i32, [256 x i8] }
%struct.anon.3 = type { [256 x i8], [256 x i8] }
%struct._GLFWctxconfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, %struct.anon.4 }
%struct.anon.4 = 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.5 = type { i64, %struct._GLFWtimerPOSIX }
%struct._GLFWtimerPOSIX = type { i32, i64 }
%struct.anon.6 = type { i32, ptr, [2 x ptr], ptr, ptr, i32, i32, i32 }
%struct.anon.7 = 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.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.17 }
%struct.anon.8 = 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.9 = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.10 = type { i32, i32, i32, i32, i32 }
%struct.anon.11 = type { i32, i64, i64 }
%struct.anon.12 = type { ptr, ptr, ptr, ptr }
%struct.anon.13 = type { i32, ptr, i32, i32, ptr, ptr, ptr }
%struct.anon.14 = type { ptr, ptr }
%struct.anon.15 = type { i32, ptr, i32, i32, ptr, ptr, ptr, ptr }
%struct.anon.16 = type { i32, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.anon.17 = 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
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__.glfwGetJoystickButtons = external hidden unnamed_addr constant [56 x i8], align 1

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

declare void @_glfwInputError(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

declare i32 @_glfwPlatformPollJoystick(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @glfwGetJoystickButtons(i32 noundef %0, ptr noundef writeonly %1) local_unnamed_addr #2 {
  %3 = icmp sgt i32 %0, -1
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 930, ptr noundef nonnull @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #3
  unreachable

5:                                                ; preds = %2
  %6 = icmp ult i32 %0, 16
  br i1 %6, label %8, label %7

7:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 931, ptr noundef nonnull @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #3
  unreachable

8:                                                ; preds = %5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %9, label %10

9:                                                ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 932, ptr noundef nonnull @__PRETTY_FUNCTION__.glfwGetJoystickButtons) #3
  unreachable

10:                                               ; preds = %8
  store i32 0, ptr %1, align 4, !tbaa !5
  %11 = load i32, ptr @_glfw, align 8, !tbaa !9
  %.not19 = icmp eq i32 %11, 0
  br i1 %.not19, label %12, label %13

12:                                               ; preds = %10
  tail call void (i32, ptr, ...) @_glfwInputError(i32 noundef 65537, ptr noundef null) #4
  br label %31

13:                                               ; preds = %10
  %14 = zext nneg i32 %0 to i64
  %15 = getelementptr inbounds %struct._GLFWjoystick, ptr getelementptr inbounds (i8, ptr @_glfw, i64 1032), i64 %14
  %16 = load i32, ptr %15, align 8, !tbaa !47
  %.not20 = icmp eq i32 %16, 0
  br i1 %.not20, label %31, label %17

17:                                               ; preds = %13
  %18 = tail call i32 @_glfwPlatformPollJoystick(ptr noundef nonnull %15, i32 noundef 2) #4
  %.not21 = icmp eq i32 %18, 0
  br i1 %.not21, label %31, label %19

19:                                               ; preds = %17
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @_glfw, i64 8), align 8, !tbaa !50
  %.not22 = icmp eq i32 %20, 0
  %21 = getelementptr inbounds i8, ptr %15, i64 32
  %22 = load i32, ptr %21, align 8, !tbaa !51
  br i1 %.not22, label %28, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %15, i64 48
  %25 = load i32, ptr %24, align 8, !tbaa !52
  %26 = shl nsw i32 %25, 2
  %27 = add nsw i32 %26, %22
  br label %28

28:                                               ; preds = %19, %23
  %storemerge = phi i32 [ %27, %23 ], [ %22, %19 ]
  store i32 %storemerge, ptr %1, align 4, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %15, i64 24
  %30 = load ptr, ptr %29, align 8, !tbaa !53
  br label %31

31:                                               ; preds = %17, %13, %28, %12
  %.0 = phi ptr [ %30, %28 ], [ null, %12 ], [ null, %13 ], [ null, %17 ]
  ret ptr %.0
}

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


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