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

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

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

; Function Attrs: nounwind uwtable
define dso_local float @f_letrec(float noundef %0, ptr noundef %1) #1 {
  %3 = alloca float, align 4
  %4 = alloca ptr, align 8
  %5 = 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
  %6 = load float, ptr %3, align 4, !tbaa !5
  store float %6, ptr %5, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %20, %2
  %8 = load float, ptr %5, align 4, !tbaa !5
  %9 = call i32 @more(float noundef %8)
  %10 = icmp ne i32 %9, 0
  br i1 %10, label %11, label %23

11:                                               ; preds = %7
  %12 = load float, ptr %5, align 4, !tbaa !5
  %13 = call float @car(float noundef %12)
  %14 = call float @car(float noundef %13)
  %15 = load float, ptr @nil, align 4, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !9
  %17 = load float, ptr %16, align 4, !tbaa !5
  %18 = call float @pair(float noundef %14, float noundef %15, float noundef %17)
  %19 = load ptr, ptr %4, align 8, !tbaa !9
  store float %18, ptr %19, align 4, !tbaa !5
  br label %20

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

23:                                               ; preds = %7
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = load float, ptr %24, align 4, !tbaa !5
  store float %25, ptr %5, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %45, %23
  %27 = load float, ptr %3, align 4, !tbaa !5
  %28 = call i32 @more(float noundef %27)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %50

30:                                               ; preds = %26
  %31 = load float, ptr %3, align 4, !tbaa !5
  %32 = call float @car(float noundef %31)
  %33 = call float @cdr(float noundef %32)
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = call float @f_begin(float noundef %33, ptr noundef %34)
  %36 = load ptr, ptr %4, align 8, !tbaa !9
  %37 = load float, ptr %36, align 4, !tbaa !5
  %38 = call float @eval(float noundef %35, float noundef %37)
  %39 = load float, ptr %5, align 4, !tbaa !5
  %40 = call float @car(float noundef %39)
  %41 = call i32 @ord(float noundef %40)
  %42 = add i32 %41, 1
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [10240 x float], ptr @cell, i64 0, i64 %43
  store float %38, ptr %44, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %30
  %46 = load float, ptr %5, align 4, !tbaa !5
  %47 = call float @cdr(float noundef %46)
  store float %47, ptr %5, align 4, !tbaa !5
  %48 = load float, ptr %3, align 4, !tbaa !5
  %49 = call float @cdr(float noundef %48)
  store float %49, ptr %3, align 4, !tbaa !5
  br label %26, !llvm.loop !13

50:                                               ; preds = %26
  %51 = load i32, ptr %3, align 4, !tbaa !14
  %52 = lshr i32 %51, 20
  %53 = load i32, ptr @NIL, align 4, !tbaa !14
  %54 = icmp eq i32 %52, %53
  br i1 %54, label %55, label %57

55:                                               ; preds = %50
  %56 = load float, ptr @nil, align 4, !tbaa !5
  br label %60

57:                                               ; preds = %50
  %58 = load float, ptr %3, align 4, !tbaa !5
  %59 = call float @car(float noundef %58)
  br label %60

60:                                               ; preds = %57, %55
  %61 = phi float [ %56, %55 ], [ %59, %57 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret float %61
}

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

@NIL = 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 float @pair(float noundef, 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 i32 @more(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
declare dso_local float @f_begin(float noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local float @f_letrec(float noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @more(float noundef %0)
  %.not17 = icmp eq i32 %3, 0
  br i1 %.not17, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.018 = phi float [ %9, %.lr.ph ], [ %0, %2 ]
  %4 = tail call float @car(float noundef %.018)
  %5 = tail call float @car(float noundef %4)
  %6 = load float, ptr @nil, align 4, !tbaa !5
  %7 = load float, ptr %1, align 4, !tbaa !5
  %8 = tail call float @pair(float noundef %5, float noundef %6, float noundef %7)
  store float %8, ptr %1, align 4, !tbaa !5
  %9 = tail call float @cdr(float noundef %.018)
  %10 = tail call i32 @more(float noundef %9)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %2
  %11 = load float, ptr %1, align 4, !tbaa !5
  %12 = tail call i32 @more(float noundef %0)
  %.not1619 = icmp eq i32 %12, 0
  br i1 %.not1619, label %._crit_edge24, label %.lr.ph23

.lr.ph23:                                         ; preds = %._crit_edge, %.lr.ph23
  %.121 = phi float [ %23, %.lr.ph23 ], [ %11, %._crit_edge ]
  %.01520 = phi float [ %24, %.lr.ph23 ], [ %0, %._crit_edge ]
  %13 = tail call float @car(float noundef %.01520)
  %14 = tail call float @cdr(float noundef %13)
  %15 = tail call float @f_begin(float noundef %14, ptr noundef nonnull %1)
  %16 = load float, ptr %1, align 4, !tbaa !5
  %17 = tail call float @eval(float noundef %15, float noundef %16)
  %18 = tail call float @car(float noundef %.121)
  %19 = tail call i32 @ord(float noundef %18)
  %20 = add i32 %19, 1
  %21 = zext i32 %20 to i64
  %22 = getelementptr inbounds [10240 x float], ptr @cell, i64 0, i64 %21
  store float %17, ptr %22, align 4, !tbaa !5
  %23 = tail call float @cdr(float noundef %.121)
  %24 = tail call float @cdr(float noundef %.01520)
  %25 = tail call i32 @more(float noundef %24)
  %.not16 = icmp eq i32 %25, 0
  br i1 %.not16, label %._crit_edge24, label %.lr.ph23, !llvm.loop !11

._crit_edge24:                                    ; preds = %.lr.ph23, %._crit_edge
  %.015.lcssa = phi float [ %0, %._crit_edge ], [ %24, %.lr.ph23 ]
  %26 = bitcast float %.015.lcssa to i32
  %27 = lshr i32 %26, 20
  %28 = load i32, ptr @NIL, align 4, !tbaa !12
  %29 = icmp eq i32 %27, %28
  br i1 %29, label %30, label %32

30:                                               ; preds = %._crit_edge24
  %31 = load float, ptr @nil, align 4, !tbaa !5
  br label %34

32:                                               ; preds = %._crit_edge24
  %33 = tail call float @car(float noundef %.015.lcssa)
  br label %34

34:                                               ; preds = %32, %30
  %35 = phi float [ %31, %30 ], [ %33, %32 ]
  ret float %35
}

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


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