; LLVM IR from Robert-van-Engelen/lisp :: src (lisp-pr-single)

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

@NIL = external dso_local global i32, align 4
@nil = external dso_local global float, align 4

; 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: nounwind uwtable
declare dso_local float @car(float noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local float @cdr(float noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @not(float noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local float @eval(float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local float @f_while(float noundef %0, ptr noundef %1) #1 {
  %3 = alloca float, align 4
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %7 = load float, ptr @nil, align 4, !tbaa !5
  store float %7, ptr %6, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %34, %2
  %9 = load float, ptr %3, align 4, !tbaa !5
  %10 = call float @car(float noundef %9)
  %11 = load ptr, ptr %4, align 8, !tbaa !9
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = call float @eval(float noundef %10, float noundef %12)
  %14 = call i32 @not(float noundef %13)
  %15 = icmp ne i32 %14, 0
  %16 = xor i1 %15, true
  br i1 %16, label %17, label %35

17:                                               ; preds = %8
  %18 = load float, ptr %3, align 4, !tbaa !5
  %19 = call float @cdr(float noundef %18)
  store float %19, ptr %5, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %31, %17
  %21 = load i32, ptr %5, align 4, !tbaa !11
  %22 = lshr i32 %21, 20
  %23 = load i32, ptr @NIL, align 4, !tbaa !11
  %24 = icmp ne i32 %22, %23
  br i1 %24, label %25, label %34

25:                                               ; preds = %20
  %26 = load float, ptr %5, align 4, !tbaa !5
  %27 = call float @car(float noundef %26)
  %28 = load ptr, ptr %4, align 8, !tbaa !9
  %29 = load float, ptr %28, align 4, !tbaa !5
  %30 = call float @eval(float noundef %27, float noundef %29)
  store float %30, ptr %6, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %25
  %32 = load float, ptr %5, align 4, !tbaa !5
  %33 = call float @cdr(float noundef %32)
  store float %33, ptr %5, align 4, !tbaa !5
  br label %20, !llvm.loop !13

34:                                               ; preds = %20
  br label %8, !llvm.loop !15

35:                                               ; preds = %8
  %36 = load float, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret float %36
}

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 = { 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 = !{!"float", !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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@NIL = external dso_local local_unnamed_addr global i32, align 4
@nil = external dso_local local_unnamed_addr global float, align 4

; Function Attrs: nounwind uwtable
declare dso_local float @car(float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local float @cdr(float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @not(float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local float @eval(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local float @f_while(float noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load float, ptr @nil, align 4, !tbaa !5
  %4 = tail call float @car(float noundef %0)
  %5 = load float, ptr %1, align 4, !tbaa !5
  %6 = tail call float @eval(float noundef %4, float noundef %5)
  %7 = tail call i32 @not(float noundef %6)
  %.not11 = icmp eq i32 %7, 0
  br i1 %.not11, label %.lr.ph13, label %._crit_edge

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph13
  %.1.lcssa = phi float [ %.012, %.lr.ph13 ], [ %18, %.lr.ph ]
  %8 = tail call float @car(float noundef %0)
  %9 = load float, ptr %1, align 4, !tbaa !5
  %10 = tail call float @eval(float noundef %8, float noundef %9)
  %11 = tail call i32 @not(float noundef %10)
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %.lr.ph13, label %._crit_edge, !llvm.loop !9

.lr.ph13:                                         ; preds = %2, %.loopexit
  %.012 = phi float [ %.1.lcssa, %.loopexit ], [ %3, %2 ]
  %12 = tail call float @cdr(float noundef %0)
  %13 = bitcast float %12 to i32
  %14 = lshr i32 %13, 20
  %15 = load i32, ptr @NIL, align 4, !tbaa !11
  %.not89 = icmp eq i32 %14, %15
  br i1 %.not89, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph13, %.lr.ph
  %.0710 = phi float [ %19, %.lr.ph ], [ %12, %.lr.ph13 ]
  %16 = tail call float @car(float noundef %.0710)
  %17 = load float, ptr %1, align 4, !tbaa !5
  %18 = tail call float @eval(float noundef %16, float noundef %17)
  %19 = tail call float @cdr(float noundef %.0710)
  %20 = bitcast float %19 to i32
  %21 = lshr i32 %20, 20
  %22 = load i32, ptr @NIL, align 4, !tbaa !11
  %.not8 = icmp eq i32 %21, %22
  br i1 %.not8, label %.loopexit, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit, %2
  %.0.lcssa = phi float [ %3, %2 ], [ %.1.lcssa, %.loopexit ]
  ret float %.0.lcssa
}

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}


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