; LLVM IR from Erkaman/fluid_sim :: deps/glfw-3.2/tests (timeout)

; 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"

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@glad_glViewport = external global ptr, align 8
@glad_glClearColor = external global ptr, align 8
@glad_glClear = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %9 = call i64 @time(ptr noundef null) #6
  %10 = trunc i64 %9 to i32
  call void @srand(i32 noundef %10) #6
  %11 = call ptr @glfwSetErrorCallback(ptr noundef @error_callback)
  %12 = call i32 @glfwInit()
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %0
  %16 = call ptr @glfwCreateWindow(i32 noundef 640, i32 noundef 480, ptr noundef @.str, ptr noundef null, ptr noundef null)
  store ptr %16, ptr %2, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @glfwTerminate()
  call void @exit(i32 noundef 1) #7
  unreachable

20:                                               ; preds = %15
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  call void @glfwMakeContextCurrent(ptr noundef %21)
  %22 = call i32 @gladLoadGLLoader(ptr noundef @glfwGetProcAddress)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call ptr @glfwSetKeyCallback(ptr noundef %23, ptr noundef @key_callback)
  br label %25

25:                                               ; preds = %30, %20
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = call i32 @glfwWindowShouldClose(ptr noundef %26)
  %28 = icmp ne i32 %27, 0
  %29 = xor i1 %28, true
  br i1 %29, label %30, label %62

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %31 = call float @nrand()
  store float %31, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %32 = call float @nrand()
  store float %32, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %33 = call float @nrand()
  store float %33, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %34 = load float, ptr %5, align 4, !tbaa !9
  %35 = load float, ptr %5, align 4, !tbaa !9
  %36 = load float, ptr %6, align 4, !tbaa !9
  %37 = load float, ptr %6, align 4, !tbaa !9
  %38 = fmul float %36, %37
  %39 = call float @llvm.fmuladd.f32(float %34, float %35, float %38)
  %40 = load float, ptr %7, align 4, !tbaa !9
  %41 = load float, ptr %7, align 4, !tbaa !9
  %42 = call float @llvm.fmuladd.f32(float %40, float %41, float %39)
  %43 = fpext float %42 to double
  %44 = call double @sqrt(double noundef %43) #6
  %45 = fptrunc double %44 to float
  store float %45, ptr %8, align 4, !tbaa !9
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  call void @glfwGetFramebufferSize(ptr noundef %46, ptr noundef %3, ptr noundef %4)
  %47 = load ptr, ptr @glad_glViewport, align 8, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !11
  %49 = load i32, ptr %4, align 4, !tbaa !11
  call void %47(i32 noundef 0, i32 noundef 0, i32 noundef %48, i32 noundef %49)
  %50 = load ptr, ptr @glad_glClearColor, align 8, !tbaa !5
  %51 = load float, ptr %5, align 4, !tbaa !9
  %52 = load float, ptr %8, align 4, !tbaa !9
  %53 = fdiv float %51, %52
  %54 = load float, ptr %6, align 4, !tbaa !9
  %55 = load float, ptr %8, align 4, !tbaa !9
  %56 = fdiv float %54, %55
  %57 = load float, ptr %7, align 4, !tbaa !9
  %58 = load float, ptr %8, align 4, !tbaa !9
  %59 = fdiv float %57, %58
  call void %50(float noundef %53, float noundef %56, float noundef %59, float noundef 1.000000e+00)
  %60 = load ptr, ptr @glad_glClear, align 8, !tbaa !5
  call void %60(i32 noundef 16384)
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  call void @glfwSwapBuffers(ptr noundef %61)
  call void @glfwWaitEventsTimeout(double noundef 1.000000e+00)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %25, !llvm.loop !13

62:                                               ; preds = %25
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  call void @glfwDestroyWindow(ptr noundef %63)
  call void @glfwTerminate()
  call void @exit(i32 noundef 0) #7
  unreachable
}

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) #2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #2

declare ptr @glfwSetErrorCallback(ptr noundef) #3

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

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 i32 @gladLoadGLLoader(ptr noundef) #3

declare ptr @glfwGetProcAddress(ptr noundef) #3

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

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

declare i32 @glfwWindowShouldClose(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden float @nrand() #0

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #5

declare void @glfwGetFramebufferSize(ptr noundef, ptr noundef, ptr noundef) #3

declare void @glfwSwapBuffers(ptr noundef) #3

declare void @glfwWaitEventsTimeout(double noundef) #3

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

declare void @glfwDestroyWindow(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@glad_glViewport = external local_unnamed_addr global ptr, align 8
@glad_glClearColor = external local_unnamed_addr global ptr, align 8
@glad_glClear = external local_unnamed_addr global ptr, align 8

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i64 @time(ptr noundef null) #8
  %4 = trunc i64 %3 to i32
  tail call void @srand(i32 noundef %4) #8
  %5 = tail call ptr @glfwSetErrorCallback(ptr noundef nonnull @error_callback) #8
  %6 = tail call i32 @glfwInit() #8
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %8

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

8:                                                ; preds = %0
  %9 = tail call ptr @glfwCreateWindow(i32 noundef 640, i32 noundef 480, ptr noundef nonnull @.str, ptr noundef null, ptr noundef null) #8
  %.not19 = icmp eq ptr %9, null
  br i1 %.not19, label %10, label %11

10:                                               ; preds = %8
  tail call void @glfwTerminate() #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

11:                                               ; preds = %8
  tail call void @glfwMakeContextCurrent(ptr noundef nonnull %9) #8
  %12 = tail call i32 @gladLoadGLLoader(ptr noundef nonnull @glfwGetProcAddress) #8
  %13 = tail call ptr @glfwSetKeyCallback(ptr noundef nonnull %9, ptr noundef nonnull @key_callback) #8
  %14 = tail call i32 @glfwWindowShouldClose(ptr noundef nonnull %9) #8
  %.not2021 = icmp eq i32 %14, 0
  br i1 %.not2021, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %15 = call float @nrand()
  %16 = call float @nrand()
  %17 = call float @nrand()
  %18 = fmul float %16, %16
  %19 = call float @llvm.fmuladd.f32(float %15, float %15, float %18)
  %20 = call float @llvm.fmuladd.f32(float %17, float %17, float %19)
  %sqrt = call float @llvm.sqrt.f32(float %20)
  call void @glfwGetFramebufferSize(ptr noundef nonnull %9, ptr noundef nonnull %1, ptr noundef nonnull %2) #8
  %21 = load ptr, ptr @glad_glViewport, align 8, !tbaa !5
  %22 = load i32, ptr %1, align 4, !tbaa !9
  %23 = load i32, ptr %2, align 4, !tbaa !9
  call void %21(i32 noundef 0, i32 noundef 0, i32 noundef %22, i32 noundef %23) #8
  %24 = load ptr, ptr @glad_glClearColor, align 8, !tbaa !5
  %25 = fdiv float %15, %sqrt
  %26 = fdiv float %16, %sqrt
  %27 = fdiv float %17, %sqrt
  call void %24(float noundef %25, float noundef %26, float noundef %27, float noundef 1.000000e+00) #8
  %28 = load ptr, ptr @glad_glClear, align 8, !tbaa !5
  call void %28(i32 noundef 16384) #8
  call void @glfwSwapBuffers(ptr noundef nonnull %9) #8
  call void @glfwWaitEventsTimeout(double noundef 1.000000e+00) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %29 = call i32 @glfwWindowShouldClose(ptr noundef nonnull %9) #8
  %.not20 = icmp eq i32 %29, 0
  br i1 %.not20, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %11
  call void @glfwDestroyWindow(ptr noundef nonnull %9) #8
  call void @glfwTerminate() #8
  call void @exit(i32 noundef 0) #9
  unreachable
}

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #2

declare ptr @glfwSetErrorCallback(ptr noundef) local_unnamed_addr #3

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

declare i32 @glfwInit() local_unnamed_addr #3

; 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 #3

declare void @glfwTerminate() local_unnamed_addr #3

declare void @glfwMakeContextCurrent(ptr noundef) local_unnamed_addr #3

declare i32 @gladLoadGLLoader(ptr noundef) local_unnamed_addr #3

declare ptr @glfwGetProcAddress(ptr noundef) #3

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

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

declare i32 @glfwWindowShouldClose(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden float @nrand() local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #6

declare void @glfwGetFramebufferSize(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @glfwSwapBuffers(ptr noundef) local_unnamed_addr #3

declare void @glfwWaitEventsTimeout(double noundef) local_unnamed_addr #3

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

declare void @glfwDestroyWindow(ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.sqrt.f32(float) #7

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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