; LLVM IR from devlinzhou/deterministic_physics :: UnrealDemo/Source/UnrealDemo/gphysics/src/math/glacier_float.ll (ZN6GFloat4ATanES_)

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

%class.GFloat = type { i32 }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN6GFloat3OneEv() #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6GFloatgtES_(ptr noundef nonnull align 4 dereferenceable(4), i32) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN6GFloat7Pi_HalfEv() #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4), i32) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatdvES_(ptr noundef nonnull align 4 dereferenceable(4), i32) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local i32 @_ZN6GFloat4ATanES_(i32 %0) #3 align 2 {
  %2 = alloca %class.GFloat, align 4
  %3 = alloca %class.GFloat, align 4
  %4 = alloca %class.GFloat, align 4
  %5 = alloca %class.GFloat, align 4
  %6 = alloca %class.GFloat, align 4
  %7 = alloca %class.GFloat, align 4
  %8 = alloca %class.GFloat, align 4
  %9 = alloca %class.GFloat, align 4
  %10 = alloca %class.GFloat, align 4
  %11 = alloca %class.GFloat, align 4
  %12 = alloca %class.GFloat, align 4
  %13 = alloca %class.GFloat, align 4
  %14 = alloca %class.GFloat, align 4
  %15 = alloca %class.GFloat, align 4
  %16 = alloca i32, align 4
  %17 = alloca %class.GFloat, align 4
  %18 = alloca %class.GFloat, align 4
  %19 = alloca %class.GFloat, align 4
  %20 = alloca %class.GFloat, align 4
  %21 = getelementptr inbounds %class.GFloat, ptr %3, i32 0, i32 0
  store i32 %0, ptr %21, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %22 = call i32 @_ZN6GFloat3OneEv()
  %23 = getelementptr inbounds %class.GFloat, ptr %5, i32 0, i32 0
  store i32 %22, ptr %23, align 4
  %24 = call i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %25 = getelementptr inbounds %class.GFloat, ptr %4, i32 0, i32 0
  store i32 %24, ptr %25, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %3, i64 4, i1 false), !tbaa.struct !5
  %26 = getelementptr inbounds %class.GFloat, ptr %6, i32 0, i32 0
  %27 = load i32, ptr %26, align 4
  %28 = call noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 %27)
  br i1 %28, label %29, label %35

29:                                               ; preds = %1
  %30 = call i32 @_ZN6GFloat3OneEv()
  %31 = getelementptr inbounds %class.GFloat, ptr %7, i32 0, i32 0
  store i32 %30, ptr %31, align 4
  %32 = getelementptr inbounds %class.GFloat, ptr %7, i32 0, i32 0
  %33 = load i32, ptr %32, align 4
  %34 = call noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 %33)
  br label %35

35:                                               ; preds = %29, %1
  %36 = phi i1 [ false, %1 ], [ %34, %29 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br i1 %36, label %37, label %42

37:                                               ; preds = %35
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %3, i64 4, i1 false), !tbaa.struct !5
  %38 = getelementptr inbounds %class.GFloat, ptr %8, i32 0, i32 0
  %39 = load i32, ptr %38, align 4
  %40 = call i32 @_ZL6s_ATan6GFloat(i32 %39)
  %41 = getelementptr inbounds %class.GFloat, ptr %2, i32 0, i32 0
  store i32 %40, ptr %41, align 4
  br label %79

42:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %43 = call i32 @_ZN6GFloat3OneEv()
  %44 = getelementptr inbounds %class.GFloat, ptr %10, i32 0, i32 0
  store i32 %43, ptr %44, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %3, i64 4, i1 false), !tbaa.struct !5
  %45 = getelementptr inbounds %class.GFloat, ptr %11, i32 0, i32 0
  %46 = load i32, ptr %45, align 4
  %47 = call i32 @_ZNK6GFloatdvES_(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 %46)
  %48 = getelementptr inbounds %class.GFloat, ptr %9, i32 0, i32 0
  store i32 %47, ptr %48, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %49 = call i32 @_ZN6GFloat3OneEv()
  %50 = getelementptr inbounds %class.GFloat, ptr %12, i32 0, i32 0
  store i32 %49, ptr %50, align 4
  %51 = getelementptr inbounds %class.GFloat, ptr %12, i32 0, i32 0
  %52 = load i32, ptr %51, align 4
  %53 = call noundef zeroext i1 @_ZNK6GFloatgtES_(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 %52)
  br i1 %53, label %54, label %65

54:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %55 = call i32 @_ZN6GFloat7Pi_HalfEv()
  %56 = getelementptr inbounds %class.GFloat, ptr %13, i32 0, i32 0
  store i32 %55, ptr %56, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %9, i64 4, i1 false), !tbaa.struct !5
  %57 = getelementptr inbounds %class.GFloat, ptr %15, i32 0, i32 0
  %58 = load i32, ptr %57, align 4
  %59 = call i32 @_ZL6s_ATan6GFloat(i32 %58)
  %60 = getelementptr inbounds %class.GFloat, ptr %14, i32 0, i32 0
  store i32 %59, ptr %60, align 4
  %61 = getelementptr inbounds %class.GFloat, ptr %14, i32 0, i32 0
  %62 = load i32, ptr %61, align 4
  %63 = call i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4) %13, i32 %62)
  %64 = getelementptr inbounds %class.GFloat, ptr %2, i32 0, i32 0
  store i32 %63, ptr %64, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  store i32 1, ptr %16, align 4
  br label %78

65:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %9, i64 4, i1 false), !tbaa.struct !5
  %66 = getelementptr inbounds %class.GFloat, ptr %19, i32 0, i32 0
  %67 = load i32, ptr %66, align 4
  %68 = call i32 @_ZL6s_ATan6GFloat(i32 %67)
  %69 = getelementptr inbounds %class.GFloat, ptr %18, i32 0, i32 0
  store i32 %68, ptr %69, align 4
  %70 = call i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4) %18)
  %71 = getelementptr inbounds %class.GFloat, ptr %17, i32 0, i32 0
  store i32 %70, ptr %71, align 4
  %72 = call i32 @_ZN6GFloat7Pi_HalfEv()
  %73 = getelementptr inbounds %class.GFloat, ptr %20, i32 0, i32 0
  store i32 %72, ptr %73, align 4
  %74 = getelementptr inbounds %class.GFloat, ptr %20, i32 0, i32 0
  %75 = load i32, ptr %74, align 4
  %76 = call i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4) %17, i32 %75)
  %77 = getelementptr inbounds %class.GFloat, ptr %2, i32 0, i32 0
  store i32 %76, ptr %77, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  store i32 1, ptr %16, align 4
  br label %78

78:                                               ; preds = %65, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %79

79:                                               ; preds = %78, %37
  %80 = getelementptr inbounds %class.GFloat, ptr %2, i32 0, i32 0
  %81 = load i32, ptr %80, align 4
  ret i32 %81
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4), i32) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden i32 @_ZL6s_ATan6GFloat(i32) #2

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

!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 = !{i64 0, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


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

%class.GFloat = type { i32 }

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN6GFloat3OneEv() local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6GFloatgtES_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN6GFloat7Pi_HalfEv() local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6GFloatdvES_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local i32 @_ZN6GFloat4ATanES_(i32 %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %class.GFloat, align 4
  %3 = alloca %class.GFloat, align 4
  %4 = alloca %class.GFloat, align 4
  %5 = alloca %class.GFloat, align 4
  %6 = alloca %class.GFloat, align 4
  %7 = alloca %class.GFloat, align 4
  %8 = alloca %class.GFloat, align 4
  store i32 %0, ptr %2, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %9 = tail call i32 @_ZN6GFloat3OneEv()
  store i32 %9, ptr %4, align 4
  %10 = call i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i32 %10, ptr %3, align 4
  %11 = call noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 %0)
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %1
  %13 = call i32 @_ZN6GFloat3OneEv()
  %14 = call noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 %13)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %.sroa.08.0.copyload = load i32, ptr %2, align 4, !tbaa !5
  %16 = call i32 @_ZL6s_ATan6GFloat(i32 %.sroa.08.0.copyload)
  br label %31

.critedge:                                        ; preds = %1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  br label %17

17:                                               ; preds = %.critedge, %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %18 = call i32 @_ZN6GFloat3OneEv()
  store i32 %18, ptr %5, align 4
  %.sroa.05.0.copyload = load i32, ptr %2, align 4, !tbaa !5
  %19 = call i32 @_ZNK6GFloatdvES_(ptr noundef nonnull align 4 dereferenceable(4) %5, i32 %.sroa.05.0.copyload)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  %20 = call i32 @_ZN6GFloat3OneEv()
  %21 = call noundef zeroext i1 @_ZNK6GFloatgtES_(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 %20)
  br i1 %21, label %22, label %26

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %23 = call i32 @_ZN6GFloat7Pi_HalfEv()
  store i32 %23, ptr %6, align 4
  %24 = call i32 @_ZL6s_ATan6GFloat(i32 %19)
  %25 = call i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 %24)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  br label %31

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #3
  %27 = call i32 @_ZL6s_ATan6GFloat(i32 %19)
  store i32 %27, ptr %8, align 4
  %28 = call i32 @_ZNK6GFloatngEv(ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i32 %28, ptr %7, align 4
  %29 = call i32 @_ZN6GFloat7Pi_HalfEv()
  %30 = call i32 @_ZNK6GFloatmiES_(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 %29)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br label %31

31:                                               ; preds = %22, %26, %15
  %.sroa.011.1 = phi i32 [ %16, %15 ], [ %25, %22 ], [ %30, %26 ]
  ret i32 %.sroa.011.1
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6GFloatleES_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden i32 @_ZL6s_ATan6GFloat(i32) local_unnamed_addr #1

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

!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++ TBAA"}


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