; 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
@stderr = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local float @assoc(float noundef %0, float noundef %1) #0 {
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %20, %2
  %6 = load i32, ptr %4, align 4, !tbaa !9
  %7 = lshr i32 %6, 20
  %8 = load i32, ptr @CONS, align 4, !tbaa !9
  %9 = icmp eq i32 %7, %8
  br i1 %9, label %10, label %18

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

18:                                               ; preds = %10, %5
  %19 = phi i1 [ false, %5 ], [ %17, %10 ]
  br i1 %19, label %20, label %23

20:                                               ; preds = %18
  %21 = load float, ptr %4, align 4, !tbaa !5
  %22 = call float @cdr(float noundef %21)
  store float %22, ptr %4, align 4, !tbaa !5
  br label %5, !llvm.loop !11

23:                                               ; preds = %18
  %24 = load i32, ptr %4, align 4, !tbaa !9
  %25 = lshr i32 %24, 20
  %26 = load i32, ptr @CONS, align 4, !tbaa !9
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %28, label %32

28:                                               ; preds = %23
  %29 = load float, ptr %4, align 4, !tbaa !5
  %30 = call float @car(float noundef %29)
  %31 = call float @cdr(float noundef %30)
  br label %49

32:                                               ; preds = %23
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = lshr i32 %33, 20
  %35 = load i32, ptr @ATOM, align 4, !tbaa !9
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %37, label %45

37:                                               ; preds = %32
  %38 = load ptr, ptr @stderr, align 8, !tbaa !13
  %39 = load float, ptr %3, align 4, !tbaa !5
  %40 = call i32 @ord(float noundef %39)
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr @cell, i64 %41
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.9, ptr noundef %42) #2
  %44 = call float @err(i32 noundef 3)
  br label %47

45:                                               ; preds = %32
  %46 = call float @err(i32 noundef 3)
  br label %47

47:                                               ; preds = %45, %37
  %48 = phi float [ %44, %37 ], [ %46, %45 ]
  br label %49

49:                                               ; preds = %47, %28
  %50 = phi float [ %31, %28 ], [ %48, %47 ]
  ret float %50
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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


; 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 global [10240 x float], align 16
@stderr = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local float @err(i32 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
define dso_local float @assoc(float noundef %0, float noundef %1) local_unnamed_addr #0 {
  %3 = bitcast float %1 to i32
  %4 = lshr i32 %3, 20
  %5 = load i32, ptr @CONS, align 4, !tbaa !5
  %6 = icmp eq i32 %4, %5
  br i1 %6, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %2
  %7 = tail call float @car(float noundef %1)
  %8 = tail call float @car(float noundef %7)
  %9 = tail call i32 @equ(float noundef %0, float noundef %8)
  %.not25 = icmp eq i32 %9, 0
  br i1 %.not25, label %.lr.ph27, label %.lr.ph..critedge.loopexit_crit_edge

.lr.ph:                                           ; preds = %.lr.ph27
  %10 = tail call float @car(float noundef %13)
  %11 = tail call float @car(float noundef %10)
  %12 = tail call i32 @equ(float noundef %0, float noundef %11)
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %.lr.ph27, label %.lr.ph..critedge.loopexit_crit_edge, !llvm.loop !9

.lr.ph..critedge.loopexit_crit_edge:              ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa20 = phi i32 [ %4, %.lr.ph.preheader ], [ %15, %.lr.ph ]
  %.07.lcssa = phi float [ %1, %.lr.ph.preheader ], [ %13, %.lr.ph ]
  %.pre.pre = load i32, ptr @CONS, align 4, !tbaa !5
  br label %.critedge

.lr.ph27:                                         ; preds = %.lr.ph.preheader, %.lr.ph
  %.0726 = phi float [ %13, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  %13 = tail call float @cdr(float noundef %.0726)
  %14 = bitcast float %13 to i32
  %15 = lshr i32 %14, 20
  %16 = load i32, ptr @CONS, align 4, !tbaa !5
  %17 = icmp eq i32 %15, %16
  br i1 %17, label %.lr.ph, label %.critedge, !llvm.loop !9

.critedge:                                        ; preds = %.lr.ph27, %.lr.ph..critedge.loopexit_crit_edge, %2
  %18 = phi i32 [ %5, %2 ], [ %.pre.pre, %.lr.ph..critedge.loopexit_crit_edge ], [ %16, %.lr.ph27 ]
  %.0.lcssa = phi float [ %1, %2 ], [ %.07.lcssa, %.lr.ph..critedge.loopexit_crit_edge ], [ %13, %.lr.ph27 ]
  %.lcssa = phi i32 [ %4, %2 ], [ %.lcssa20, %.lr.ph..critedge.loopexit_crit_edge ], [ %15, %.lr.ph27 ]
  %19 = icmp eq i32 %.lcssa, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %.critedge
  %21 = tail call float @car(float noundef %.0.lcssa)
  %22 = tail call float @cdr(float noundef %21)
  br label %37

23:                                               ; preds = %.critedge
  %24 = bitcast float %0 to i32
  %25 = lshr i32 %24, 20
  %26 = load i32, ptr @ATOM, align 4, !tbaa !5
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %28, label %35

28:                                               ; preds = %23
  %29 = load ptr, ptr @stderr, align 8, !tbaa !11
  %30 = tail call i32 @ord(float noundef %0)
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr @cell, i64 %31
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.9, ptr noundef nonnull %32) #2
  %34 = tail call float @err(i32 noundef 3)
  br label %37

35:                                               ; preds = %23
  %36 = tail call float @err(i32 noundef 3)
  br label %37

37:                                               ; preds = %28, %35, %20
  %38 = phi float [ %22, %20 ], [ %34, %28 ], [ %36, %35 ]
  ret float %38
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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 = { nofree 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 #2 = { cold 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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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