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

@ATOM = external dso_local global i32, align 4
@CONS = external dso_local global i32, align 4
@cell = external dso_local global [10240 x float], align 16
@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 i32 @ord(float noundef) #1

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

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

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

; 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 float @assoc(float noundef, float noundef) #1

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

8:                                                ; preds = %27, %2
  %9 = load i32, ptr %3, align 4, !tbaa !11
  %10 = lshr i32 %9, 20
  %11 = load i32, ptr @CONS, align 4, !tbaa !11
  %12 = icmp eq i32 %10, %11
  br i1 %12, label %13, label %30

13:                                               ; preds = %8
  %14 = load float, ptr %3, align 4, !tbaa !5
  %15 = call float @car(float noundef %14)
  %16 = load float, ptr %4, align 4, !tbaa !5
  %17 = call float @eval(float noundef %15, float noundef %16)
  %18 = load float, ptr @nil, align 4, !tbaa !5
  %19 = call float @cons(float noundef %17, float noundef %18)
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  store float %19, ptr %20, align 4, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = call i32 @ord(float noundef %22)
  %24 = add i32 %23, 1
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [10240 x float], ptr @cell, i64 0, i64 %25
  store ptr %26, ptr %5, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %13
  %28 = load float, ptr %3, align 4, !tbaa !5
  %29 = call float @cdr(float noundef %28)
  store float %29, ptr %3, align 4, !tbaa !5
  br label %8, !llvm.loop !13

30:                                               ; preds = %8
  %31 = load i32, ptr %3, align 4, !tbaa !11
  %32 = lshr i32 %31, 20
  %33 = load i32, ptr @ATOM, align 4, !tbaa !11
  %34 = icmp eq i32 %32, %33
  br i1 %34, label %35, label %40

35:                                               ; preds = %30
  %36 = load float, ptr %3, align 4, !tbaa !5
  %37 = load float, ptr %4, align 4, !tbaa !5
  %38 = call float @assoc(float noundef %36, float noundef %37)
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  store float %38, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %35, %30
  %41 = call float @pop()
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret float %41
}

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

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


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

@ATOM = external dso_local local_unnamed_addr global i32, align 4
@CONS = external dso_local local_unnamed_addr global i32, align 4
@cell = external dso_local local_unnamed_addr global [10240 x float], align 16
@nil = external dso_local local_unnamed_addr global float, align 4

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

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

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

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

; 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 float @assoc(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local float @evlis(float noundef %0, float noundef %1) local_unnamed_addr #0 {
  %3 = load float, ptr @nil, align 4, !tbaa !5
  %4 = tail call ptr @push(float noundef %3)
  %5 = bitcast float %0 to i32
  %6 = lshr i32 %5, 20
  %7 = load i32, ptr @CONS, align 4, !tbaa !9
  %8 = icmp eq i32 %6, %7
  br i1 %8, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.012 = phi ptr [ %16, %.lr.ph ], [ %4, %2 ]
  %.0911 = phi float [ %17, %.lr.ph ], [ %0, %2 ]
  %9 = tail call float @car(float noundef %.0911)
  %10 = tail call float @eval(float noundef %9, float noundef %1)
  %11 = load float, ptr @nil, align 4, !tbaa !5
  %12 = tail call float @cons(float noundef %10, float noundef %11)
  store float %12, ptr %.012, align 4, !tbaa !5
  %13 = tail call i32 @ord(float noundef %12)
  %14 = add i32 %13, 1
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds [10240 x float], ptr @cell, i64 0, i64 %15
  %17 = tail call float @cdr(float noundef %.0911)
  %18 = bitcast float %17 to i32
  %19 = lshr i32 %18, 20
  %20 = load i32, ptr @CONS, align 4, !tbaa !9
  %21 = icmp eq i32 %19, %20
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %2
  %.09.lcssa = phi float [ %0, %2 ], [ %17, %.lr.ph ]
  %.0.lcssa = phi ptr [ %4, %2 ], [ %16, %.lr.ph ]
  %.lcssa = phi i32 [ %6, %2 ], [ %19, %.lr.ph ]
  %22 = load i32, ptr @ATOM, align 4, !tbaa !9
  %23 = icmp eq i32 %.lcssa, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %._crit_edge
  %25 = tail call float @assoc(float noundef %.09.lcssa, float noundef %1)
  store float %25, ptr %.0.lcssa, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %24, %._crit_edge
  %27 = tail call float @pop()
  ret float %27
}

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

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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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