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

@sp = external dso_local global i32, align 4
@tr = external dso_local global i32, align 4
@.str.64 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [5 x i8], align 1

; 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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: inlinehint nounwind uwtable
declare i32 @getchar() #2

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

10:                                               ; preds = %2
  %11 = load float, ptr %4, align 4, !tbaa !5
  %12 = load float, ptr %5, align 4, !tbaa !5
  %13 = call float @step(float noundef %11, float noundef %12)
  store float %13, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %36

14:                                               ; preds = %2
  %15 = load float, ptr %4, align 4, !tbaa !5
  %16 = load float, ptr %5, align 4, !tbaa !5
  %17 = call float @step(float noundef %15, float noundef %16)
  store float %17, ptr %6, align 4, !tbaa !5
  %18 = load i32, ptr @sp, align 4, !tbaa !9
  %19 = sub i32 10240, %18
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.64, i32 noundef %19)
  %21 = load float, ptr %4, align 4, !tbaa !5
  call void @print(float noundef %21)
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.65)
  %23 = load float, ptr %6, align 4, !tbaa !5
  call void @print(float noundef %23)
  %24 = load i32, ptr @tr, align 4, !tbaa !9
  %25 = icmp ugt i32 %24, 1
  br i1 %25, label %26, label %32

26:                                               ; preds = %14
  br label %27

27:                                               ; preds = %30, %26
  %28 = call i32 @getchar()
  %29 = icmp sge i32 %28, 32
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  br label %27, !llvm.loop !11

31:                                               ; preds = %27
  br label %34

32:                                               ; preds = %14
  %33 = call i32 @putchar(i32 noundef 10)
  br label %34

34:                                               ; preds = %32, %31
  %35 = load float, ptr %6, align 4, !tbaa !5
  store float %35, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %36

36:                                               ; preds = %34, %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %37 = load float, ptr %3, align 4
  ret float %37
}

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

; Function Attrs: nounwind uwtable
declare dso_local float @step(float noundef, float noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { inlinehint 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 #3 = { 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 #4 = { 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"}


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

@sp = external dso_local local_unnamed_addr global i32, align 4
@tr = external dso_local local_unnamed_addr global i32, align 4
@.str.64 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [5 x i8], align 1

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

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local float @eval(float noundef %0, float noundef %1) local_unnamed_addr #2 {
  %3 = load i32, ptr @tr, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  %4 = tail call float @step(float noundef %0, float noundef %1)
  br i1 %.not, label %.loopexit, label %5

5:                                                ; preds = %2
  %6 = load i32, ptr @sp, align 4, !tbaa !5
  %7 = sub i32 10240, %6
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.64, i32 noundef %7)
  tail call void @print(float noundef %0)
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.65)
  tail call void @print(float noundef %4)
  %10 = load i32, ptr @tr, align 4, !tbaa !5
  %11 = icmp ugt i32 %10, 1
  br i1 %11, label %.preheader, label %14

.preheader:                                       ; preds = %5, %.preheader
  %12 = tail call i32 @getchar()
  %13 = icmp sgt i32 %12, 31
  br i1 %13, label %.preheader, label %.loopexit, !llvm.loop !9

14:                                               ; preds = %5
  %15 = tail call i32 @putchar(i32 noundef 10)
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %2, %14
  ret float %4
}

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

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

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { inlinehint nofree 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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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