; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (allocator)

; 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.allocator_stats = type { i64, i64, i64 }
%struct.GLFWallocator = type { ptr, ptr, ptr, ptr }

@glad_glClear = external dso_local global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@function_name = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 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: nounwind uwtable
declare dso_local i32 @gladLoadGL(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.allocator_stats, align 8
  %3 = alloca %struct.GLFWallocator, align 8
  %4 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #5
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #5
  %5 = getelementptr inbounds %struct.GLFWallocator, ptr %3, i32 0, i32 0
  store ptr @allocate, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.GLFWallocator, ptr %3, i32 0, i32 1
  store ptr @reallocate, ptr %6, align 8, !tbaa !10
  %7 = getelementptr inbounds %struct.GLFWallocator, ptr %3, i32 0, i32 2
  store ptr @deallocate, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %struct.GLFWallocator, ptr %3, i32 0, i32 3
  store ptr %2, ptr %8, align 8, !tbaa !12
  %9 = call ptr @glfwSetErrorCallback(ptr noundef @error_callback)
  call void @glfwInitAllocator(ptr noundef %3)
  store ptr @.str.1, ptr @function_name, align 8, !tbaa !13
  %10 = call i32 @glfwInit()
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %13, label %12

12:                                               ; preds = %0
  call void @exit(i32 noundef 1) #6
  unreachable

13:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store ptr @.str.2, ptr @function_name, align 8, !tbaa !13
  %14 = call ptr @glfwCreateWindow(i32 noundef 400, i32 noundef 400, ptr noundef @.str.3, ptr noundef null, ptr noundef null)
  store ptr %14, ptr %4, align 8, !tbaa !13
  %15 = load ptr, ptr %4, align 8, !tbaa !13
  %16 = icmp ne ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @glfwTerminate()
  call void @exit(i32 noundef 1) #6
  unreachable

18:                                               ; preds = %13
  store ptr @.str.4, ptr @function_name, align 8, !tbaa !13
  %19 = load ptr, ptr %4, align 8, !tbaa !13
  call void @glfwMakeContextCurrent(ptr noundef %19)
  %20 = call i32 @gladLoadGL(ptr noundef @glfwGetProcAddress)
  store ptr @.str.5, ptr @function_name, align 8, !tbaa !13
  call void @glfwSwapInterval(i32 noundef 1)
  br label %21

21:                                               ; preds = %26, %18
  store ptr @.str.6, ptr @function_name, align 8, !tbaa !13
  %22 = load ptr, ptr %4, align 8, !tbaa !13
  %23 = call i32 @glfwWindowShouldClose(ptr noundef %22)
  %24 = icmp ne i32 %23, 0
  %25 = xor i1 %24, true
  br i1 %25, label %26, label %29

26:                                               ; preds = %21
  %27 = load ptr, ptr @glad_glClear, align 8, !tbaa !13
  call void %27(i32 noundef 16384)
  store ptr @.str.7, ptr @function_name, align 8, !tbaa !13
  %28 = load ptr, ptr %4, align 8, !tbaa !13
  call void @glfwSwapBuffers(ptr noundef %28)
  store ptr @.str.8, ptr @function_name, align 8, !tbaa !13
  call void @glfwWaitEvents()
  br label %21, !llvm.loop !14

29:                                               ; preds = %21
  store ptr @.str.9, ptr @function_name, align 8, !tbaa !13
  call void @glfwTerminate()
  call void @exit(i32 noundef 0) #6
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @allocate(i64 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @reallocate(ptr noundef, i64 noundef, ptr noundef) #1

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

declare ptr @glfwSetErrorCallback(ptr noundef) #3

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

declare void @glfwInitAllocator(ptr noundef) #3

declare i32 @glfwInit() #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @glfwTerminate() #3

declare void @glfwMakeContextCurrent(ptr noundef) #3

declare ptr @glfwGetProcAddress(ptr noundef) #3

declare void @glfwSwapInterval(i32 noundef) #3

declare i32 @glfwWindowShouldClose(ptr noundef) #3

declare void @glfwSwapBuffers(ptr noundef) #3

declare void @glfwWaitEvents() #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #5 = { nounwind }
attributes #6 = { 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, !7, i64 0}
!6 = !{!"GLFWallocator", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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.allocator_stats = type { i64, i64, i64 }
%struct.GLFWallocator = type { ptr, ptr, ptr, ptr }

@glad_glClear = external dso_local local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@function_name = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @gladLoadGL(ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %struct.allocator_stats, align 8
  %2 = alloca %struct.GLFWallocator, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  store ptr @allocate, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @reallocate, ptr %3, align 8, !tbaa !10
  %4 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @deallocate, ptr %4, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr %1, ptr %5, align 8, !tbaa !12
  %6 = call ptr @glfwSetErrorCallback(ptr noundef nonnull @error_callback) #6
  call void @glfwInitAllocator(ptr noundef nonnull %2) #6
  store ptr @.str.1, ptr @function_name, align 8, !tbaa !13
  %7 = call i32 @glfwInit() #6
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %0
  call void @exit(i32 noundef 1) #7
  unreachable

9:                                                ; preds = %0
  store ptr @.str.2, ptr @function_name, align 8, !tbaa !13
  %10 = call ptr @glfwCreateWindow(i32 noundef 400, i32 noundef 400, ptr noundef nonnull @.str.3, ptr noundef null, ptr noundef null) #6
  %.not4 = icmp eq ptr %10, null
  br i1 %.not4, label %11, label %12

11:                                               ; preds = %9
  call void @glfwTerminate() #6
  call void @exit(i32 noundef 1) #7
  unreachable

12:                                               ; preds = %9
  store ptr @.str.4, ptr @function_name, align 8, !tbaa !13
  call void @glfwMakeContextCurrent(ptr noundef nonnull %10) #6
  %13 = call i32 @gladLoadGL(ptr noundef nonnull @glfwGetProcAddress)
  store ptr @.str.5, ptr @function_name, align 8, !tbaa !13
  call void @glfwSwapInterval(i32 noundef 1) #6
  store ptr @.str.6, ptr @function_name, align 8, !tbaa !13
  %14 = call i32 @glfwWindowShouldClose(ptr noundef nonnull %10) #6
  %.not56 = icmp eq i32 %14, 0
  br i1 %.not56, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %12, %.lr.ph
  %15 = load ptr, ptr @glad_glClear, align 8, !tbaa !13
  call void %15(i32 noundef 16384) #6
  store ptr @.str.7, ptr @function_name, align 8, !tbaa !13
  call void @glfwSwapBuffers(ptr noundef nonnull %10) #6
  store ptr @.str.8, ptr @function_name, align 8, !tbaa !13
  call void @glfwWaitEvents() #6
  store ptr @.str.6, ptr @function_name, align 8, !tbaa !13
  %16 = call i32 @glfwWindowShouldClose(ptr noundef nonnull %10) #6
  %.not5 = icmp eq i32 %16, 0
  br i1 %.not5, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %12
  store ptr @.str.9, ptr @function_name, align 8, !tbaa !13
  call void @glfwTerminate() #6
  call void @exit(i32 noundef 0) #7
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @allocate(i64 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @reallocate(ptr noundef, i64 noundef, ptr noundef) #1

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

declare ptr @glfwSetErrorCallback(ptr noundef) local_unnamed_addr #4

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

declare void @glfwInitAllocator(ptr noundef) local_unnamed_addr #4

declare i32 @glfwInit() local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @glfwTerminate() local_unnamed_addr #4

declare void @glfwMakeContextCurrent(ptr noundef) local_unnamed_addr #4

declare ptr @glfwGetProcAddress(ptr noundef) #4

declare void @glfwSwapInterval(i32 noundef) local_unnamed_addr #4

declare i32 @glfwWindowShouldClose(ptr noundef) local_unnamed_addr #4

declare void @glfwSwapBuffers(ptr noundef) local_unnamed_addr #4

declare void @glfwWaitEvents() local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { noreturn 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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "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 = { 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 #6 = { nounwind }
attributes #7 = { 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, !7, i64 0}
!6 = !{!"GLFWallocator", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass