; LLVM IR from niessner/Matterport :: code/gaps/pkgs/fglut (freeglut_state)

; 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.tagSFG_State = type { %struct.tagSFG_XYUse, %struct.tagSFG_XYUse, i32, i8, i32, i8, i8, i8, i8, i32, i32, i32, i32, i32, i64, %struct.tagSFG_List, %struct.tagSFG_List, ptr, i32, ptr, ptr, %struct.tagSFG_XYUse, i32, i32, i32, i32, ptr, i8, i8, i32, i32, i32, i32, i32, i32 }
%struct.tagSFG_List = type { ptr, ptr }
%struct.tagSFG_XYUse = type { i32, i32, i8 }
%struct.tagSFG_Display = type { ptr, i32, i64, i32, i64, i64, i64, i32, i32, i32, i32 }

@fgState = external global %struct.tagSFG_State, align 8
@.str = external hidden unnamed_addr constant [64 x i8], align 1
@fgDisplay = external global %struct.tagSFG_Display, align 8
@.str.11 = external hidden unnamed_addr constant [18 x i8], align 1

declare void @fgError(ptr noundef, ...) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @XFree(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @glutGetModeValues(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [9 x i32], align 16
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 36, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  %14 = load i8, ptr getelementptr inbounds (%struct.tagSFG_State, ptr @fgState, i32 0, i32 3), align 4, !tbaa !11
  %15 = icmp ne i8 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %2
  call void (ptr, ...) @fgError(ptr noundef @.str, ptr noundef @.str.11)
  br label %17

17:                                               ; preds = %16, %2
  store ptr null, ptr %5, align 8, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !5
  %19 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %19, label %108 [
    i32 4096, label %20
    i32 128, label %20
  ]

20:                                               ; preds = %17, %17
  %21 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 0
  store i32 2, ptr %21, align 16, !tbaa !5
  %22 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 1
  store i32 -1, ptr %22, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %23, label %36 [
    i32 4096, label %24
    i32 128, label %28
  ]

24:                                               ; preds = %20
  %25 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 2
  store i32 7, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 3
  store i32 1, ptr %26, align 4, !tbaa !5
  %27 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 4
  store i32 0, ptr %27, align 16, !tbaa !5
  store i32 7, ptr %9, align 4, !tbaa !5
  br label %36

28:                                               ; preds = %20
  %29 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 2
  store i32 7, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 3
  store i32 -1, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 4
  store i32 100000, ptr %31, align 16, !tbaa !5
  %32 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 5
  store i32 1, ptr %32, align 4, !tbaa !5
  %33 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 6
  store i32 100001, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 7
  store i32 1, ptr %34, align 4, !tbaa !5
  %35 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 8
  store i32 0, ptr %35, align 16, !tbaa !5
  store i32 100001, ptr %9, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %28, %24, %20
  %37 = load ptr, ptr @fgDisplay, align 8, !tbaa !16
  %38 = load i32, ptr getelementptr inbounds (%struct.tagSFG_Display, ptr @fgDisplay, i32 0, i32 1), align 8, !tbaa !18
  %39 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 0
  %40 = call ptr @glXChooseFBConfig(ptr noundef %37, i32 noundef %38, ptr noundef %39, ptr noundef %8)
  store ptr %40, ptr %7, align 8, !tbaa !9
  %41 = load ptr, ptr %7, align 8, !tbaa !9
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %107

43:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = mul i64 4, %45
  %47 = call noalias ptr @malloc(i64 noundef %46) #6
  store ptr %47, ptr %10, align 8, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %76, %43
  %49 = load i32, ptr %12, align 4, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %79

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %53 = load ptr, ptr @fgDisplay, align 8, !tbaa !16
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  %55 = load i32, ptr %12, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %54, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = call i32 @glXGetFBConfigAttrib(ptr noundef %53, ptr noundef %58, i32 noundef %59, ptr noundef %13)
  %61 = load i32, ptr %13, align 4, !tbaa !5
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = icmp sgt i32 %61, %62
  br i1 %63, label %64, label %75

64:                                               ; preds = %52
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i32, ptr %66, i64 %69
  store i32 %65, ptr %70, align 4, !tbaa !5
  %71 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %71, ptr %11, align 4, !tbaa !5
  %72 = load ptr, ptr %4, align 8, !tbaa !9
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %72, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %64, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %12, align 4, !tbaa !5
  br label %48, !llvm.loop !19

79:                                               ; preds = %48
  %80 = load ptr, ptr %4, align 8, !tbaa !9
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = mul i64 4, %82
  %84 = call noalias ptr @malloc(i64 noundef %83) #6
  store ptr %84, ptr %5, align 8, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %100, %79
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = load ptr, ptr %4, align 8, !tbaa !9
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp slt i32 %86, %88
  br i1 %89, label %90, label %103

90:                                               ; preds = %85
  %91 = load ptr, ptr %10, align 8, !tbaa !9
  %92 = load i32, ptr %12, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %91, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = load ptr, ptr %5, align 8, !tbaa !9
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i32, ptr %96, i64 %98
  store i32 %95, ptr %99, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %90
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !5
  br label %85, !llvm.loop !21

103:                                              ; preds = %85
  %104 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %104) #5
  %105 = load ptr, ptr %7, align 8, !tbaa !9
  %106 = call i32 @XFree(ptr noundef %105)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %107

107:                                              ; preds = %103, %36
  br label %109

108:                                              ; preds = %17
  br label %109

109:                                              ; preds = %108, %107
  %110 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 36, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret ptr %110
}

declare ptr @glXChooseFBConfig(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare i32 @glXGetFBConfigAttrib(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind allocsize(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 "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 = { nounwind allocsize(0) }

!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, !7, i64 28}
!12 = !{!"tagSFG_State", !13, i64 0, !13, i64 12, !6, i64 24, !7, i64 28, !6, i64 32, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !14, i64 64, !15, i64 72, !15, i64 88, !10, i64 104, !6, i64 112, !10, i64 120, !10, i64 128, !13, i64 136, !6, i64 148, !6, i64 152, !6, i64 156, !6, i64 160, !10, i64 168, !7, i64 176, !7, i64 177, !6, i64 180, !6, i64 184, !6, i64 188, !6, i64 192, !6, i64 196, !6, i64 200}
!13 = !{!"tagSFG_XYUse", !6, i64 0, !6, i64 4, !7, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!"tagSFG_List", !10, i64 0, !10, i64 8}
!16 = !{!17, !10, i64 0}
!17 = !{!"tagSFG_Display", !10, i64 0, !6, i64 8, !14, i64 16, !6, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68}
!18 = !{!17, !6, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.tagSFG_State = type { %struct.tagSFG_XYUse, %struct.tagSFG_XYUse, i32, i8, i32, i8, i8, i8, i8, i32, i32, i32, i32, i32, i64, %struct.tagSFG_List, %struct.tagSFG_List, ptr, i32, ptr, ptr, %struct.tagSFG_XYUse, i32, i32, i32, i32, ptr, i8, i8, i32, i32, i32, i32, i32, i32 }
%struct.tagSFG_List = type { ptr, ptr }
%struct.tagSFG_XYUse = type { i32, i32, i8 }
%struct.tagSFG_Display = type { ptr, i32, i64, i32, i64, i64, i64, i32, i32, i32, i32 }

@fgState = external local_unnamed_addr global %struct.tagSFG_State, align 8
@.str = external hidden unnamed_addr constant [64 x i8], align 1
@fgDisplay = external local_unnamed_addr global %struct.tagSFG_Display, align 8
@.str.11 = external hidden unnamed_addr constant [18 x i8], align 1

declare void @fgError(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @XFree(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @glutGetModeValues(i32 noundef %0, ptr nocapture noundef %1) local_unnamed_addr #2 {
  %3 = alloca [9 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %6 = load i8, ptr getelementptr inbounds (i8, ptr @fgState, i64 28), align 4, !tbaa !5
  %.not = icmp eq i8 %6, 0
  %.sink40.sroa.gep = getelementptr inbounds i8, ptr %3, i64 32
  %.sink40.sroa.gep44 = getelementptr inbounds i8, ptr %3, i64 16
  %.sink41.sroa.gep = getelementptr inbounds i8, ptr %3, i64 28
  %.sink41.sroa.gep45 = getelementptr inbounds i8, ptr %3, i64 12
  %.sink43.sroa.gep = getelementptr inbounds i8, ptr %3, i64 24
  %.sink43.sroa.gep46 = getelementptr inbounds i8, ptr %3, i64 8
  br i1 %.not, label %7, label %8

7:                                                ; preds = %2
  tail call void (ptr, ...) @fgError(ptr noundef nonnull @.str, ptr noundef nonnull @.str.11) #6
  br label %8

8:                                                ; preds = %7, %2
  store i32 0, ptr %1, align 4, !tbaa !14
  switch i32 %0, label %46 [
    i32 4096, label %9
    i32 128, label %9
  ]

9:                                                ; preds = %8, %8
  store i32 2, ptr %3, align 16, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 -1, ptr %10, align 4, !tbaa !14
  switch i32 %0, label %13 [
    i32 4096, label %.sink.split
    i32 128, label %11
  ]

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  store <4 x i32> <i32 7, i32 -1, i32 100000, i32 1>, ptr %12, align 8, !tbaa !14
  br label %.sink.split

.sink.split:                                      ; preds = %9, %11
  %.sink43.sroa.phi = phi ptr [ %.sink43.sroa.gep, %11 ], [ %.sink43.sroa.gep46, %9 ]
  %.sink = phi i32 [ 100001, %11 ], [ 7, %9 ]
  %.sink41.sroa.phi = phi ptr [ %.sink41.sroa.gep, %11 ], [ %.sink41.sroa.gep45, %9 ]
  %.sink40.sroa.phi = phi ptr [ %.sink40.sroa.gep, %11 ], [ %.sink40.sroa.gep44, %9 ]
  store i32 %.sink, ptr %.sink43.sroa.phi, align 8, !tbaa !14
  store i32 1, ptr %.sink41.sroa.phi, align 4, !tbaa !14
  store i32 0, ptr %.sink40.sroa.phi, align 16, !tbaa !14
  br label %13

13:                                               ; preds = %.sink.split, %9
  %.026 = phi i32 [ 0, %9 ], [ %.sink, %.sink.split ]
  %14 = load ptr, ptr @fgDisplay, align 8, !tbaa !15
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @fgDisplay, i64 8), align 8, !tbaa !17
  %16 = call ptr @glXChooseFBConfig(ptr noundef %14, i32 noundef %15, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %.not29 = icmp eq ptr %16, null
  br i1 %.not29, label %46, label %17

17:                                               ; preds = %13
  %18 = load i32, ptr %4, align 4, !tbaa !14
  %19 = sext i32 %18 to i64
  %20 = shl nsw i64 %19, 2
  %21 = call noalias ptr @malloc(i64 noundef %20) #7
  %22 = icmp sgt i32 %18, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %17, %34
  %indvars.iv = phi i64 [ %indvars.iv.next, %34 ], [ 0, %17 ]
  %.02330 = phi i32 [ %.124, %34 ], [ 0, %17 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %23 = load ptr, ptr @fgDisplay, align 8, !tbaa !15
  %24 = getelementptr inbounds ptr, ptr %16, i64 %indvars.iv
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = call i32 @glXGetFBConfigAttrib(ptr noundef %23, ptr noundef %25, i32 noundef %.026, ptr noundef nonnull %5) #6
  %27 = load i32, ptr %5, align 4, !tbaa !14
  %28 = icmp sgt i32 %27, %.02330
  br i1 %28, label %29, label %34

29:                                               ; preds = %.lr.ph
  %30 = load i32, ptr %1, align 4, !tbaa !14
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %21, i64 %31
  store i32 %27, ptr %32, align 4, !tbaa !14
  %33 = add nsw i32 %30, 1
  store i32 %33, ptr %1, align 4, !tbaa !14
  br label %34

34:                                               ; preds = %29, %.lr.ph
  %.124 = phi i32 [ %27, %29 ], [ %.02330, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load i32, ptr %4, align 4, !tbaa !14
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %34, %17
  %38 = load i32, ptr %1, align 4, !tbaa !14
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 2
  %41 = call noalias ptr @malloc(i64 noundef %40) #7
  %42 = icmp sgt i32 %38, 0
  br i1 %42, label %.lr.ph34.preheader, label %._crit_edge35

.lr.ph34.preheader:                               ; preds = %._crit_edge
  %43 = zext nneg i32 %38 to i64
  %44 = shl nuw nsw i64 %43, 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %21, i64 %44, i1 false), !tbaa !14
  br label %._crit_edge35

._crit_edge35:                                    ; preds = %.lr.ph34.preheader, %._crit_edge
  call void @free(ptr noundef %21) #6
  %45 = call i32 @XFree(ptr noundef nonnull %16) #6
  br label %46

46:                                               ; preds = %8, %13, %._crit_edge35
  %.025 = phi ptr [ null, %8 ], [ %41, %._crit_edge35 ], [ null, %13 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %3) #6
  ret ptr %.025
}

declare ptr @glXChooseFBConfig(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

declare i32 @glXGetFBConfigAttrib(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

attributes #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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, !9, i64 28}
!6 = !{!"tagSFG_State", !7, i64 0, !7, i64 12, !8, i64 24, !9, i64 28, !8, i64 32, !9, i64 36, !9, i64 37, !9, i64 38, !9, i64 39, !8, i64 40, !8, i64 44, !8, i64 48, !8, i64 52, !8, i64 56, !11, i64 64, !12, i64 72, !12, i64 88, !13, i64 104, !8, i64 112, !13, i64 120, !13, i64 128, !7, i64 136, !8, i64 148, !8, i64 152, !8, i64 156, !8, i64 160, !13, i64 168, !9, i64 176, !9, i64 177, !8, i64 180, !8, i64 184, !8, i64 188, !8, i64 192, !8, i64 196, !8, i64 200}
!7 = !{!"tagSFG_XYUse", !8, i64 0, !8, i64 4, !9, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"tagSFG_List", !13, i64 0, !13, i64 8}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!8, !8, i64 0}
!15 = !{!16, !13, i64 0}
!16 = !{!"tagSFG_Display", !13, i64 0, !8, i64 8, !11, i64 16, !8, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !8, i64 56, !8, i64 60, !8, i64 64, !8, i64 68}
!17 = !{!16, !8, i64 8}
!18 = !{!13, !13, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass