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

@STRG = external dso_local global i32, align 4
@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
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@out = external dso_local global ptr, align 8

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local float @f_write(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) #3
  br label %6

6:                                                ; preds = %28, %2
  %7 = load i32, ptr %3, align 4, !tbaa !11
  %8 = lshr i32 %7, 20
  %9 = load i32, ptr @NIL, align 4, !tbaa !11
  %10 = icmp ne i32 %8, %9
  br i1 %10, label %11, label %31

11:                                               ; preds = %6
  %12 = load float, ptr %3, align 4, !tbaa !5
  %13 = call float @car(float noundef %12)
  store float %13, ptr %5, align 4, !tbaa !5
  %14 = load i32, ptr %5, align 4, !tbaa !11
  %15 = lshr i32 %14, 20
  %16 = load i32, ptr @STRG, align 4, !tbaa !11
  %17 = icmp eq i32 %15, %16
  br i1 %17, label %18, label %25

18:                                               ; preds = %11
  %19 = load ptr, ptr @out, align 8, !tbaa !9
  %20 = load float, ptr %5, align 4, !tbaa !5
  %21 = call i32 @ord(float noundef %20)
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr @cell, i64 %22
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.11, ptr noundef %23) #3
  br label %27

25:                                               ; preds = %11
  %26 = load float, ptr %5, align 4, !tbaa !5
  call void @print(float noundef %26)
  br label %27

27:                                               ; preds = %25, %18
  br label %28

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

31:                                               ; preds = %6
  %32 = load float, ptr @nil, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret float %32
}

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 "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 = !{!"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"

@STRG = external dso_local local_unnamed_addr global i32, align 4
@NIL = external dso_local local_unnamed_addr global i32, align 4
@cell = external dso_local global [10240 x float], align 16
@nil = external dso_local local_unnamed_addr global float, align 4
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@out = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local i32 @ord(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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local float @f_write(float noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = bitcast float %0 to i32
  %4 = lshr i32 %3, 20
  %5 = load i32, ptr @NIL, align 4, !tbaa !5
  %.not5 = icmp eq i32 %4, %5
  br i1 %.not5, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %18
  %.06 = phi float [ %19, %18 ], [ %0, %2 ]
  %6 = tail call float @car(float noundef %.06)
  %7 = bitcast float %6 to i32
  %8 = lshr i32 %7, 20
  %9 = load i32, ptr @STRG, align 4, !tbaa !5
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %11, label %17

11:                                               ; preds = %.lr.ph
  %12 = load ptr, ptr @out, align 8, !tbaa !9
  %13 = tail call i32 @ord(float noundef %6)
  %14 = zext i32 %13 to i64
  %15 = getelementptr inbounds i8, ptr @cell, i64 %14
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.11, ptr noundef nonnull %15) #2
  br label %18

17:                                               ; preds = %.lr.ph
  tail call void @print(float noundef %6)
  br label %18

18:                                               ; preds = %11, %17
  %19 = tail call float @cdr(float noundef %.06)
  %20 = bitcast float %19 to i32
  %21 = lshr i32 %20, 20
  %22 = load i32, ptr @NIL, align 4, !tbaa !5
  %.not = icmp eq i32 %21, %22
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %18, %2
  %23 = load float, ptr @nil, align 4, !tbaa !13
  ret float %23
}

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


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