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

@PRIM = external dso_local global i32, align 4
@MACR = external dso_local global i32, align 4
@NIL = external dso_local global i32, 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 float @car(float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local float @f_type(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
  %7 = call float @car(float noundef %6)
  store float %7, ptr %5, align 4, !tbaa !5
  %8 = load i32, ptr %5, align 4, !tbaa !11
  %9 = lshr i32 %8, 20
  %10 = load i32, ptr @NIL, align 4, !tbaa !11
  %11 = icmp eq i32 %9, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  br label %33

13:                                               ; preds = %2
  %14 = load i32, ptr %5, align 4, !tbaa !11
  %15 = lshr i32 %14, 20
  %16 = load i32, ptr @PRIM, align 4, !tbaa !11
  %17 = icmp uge i32 %15, %16
  br i1 %17, label %18, label %30

18:                                               ; preds = %13
  %19 = load i32, ptr %5, align 4, !tbaa !11
  %20 = lshr i32 %19, 20
  %21 = load i32, ptr @MACR, align 4, !tbaa !11
  %22 = icmp ule i32 %20, %21
  br i1 %22, label %23, label %30

23:                                               ; preds = %18
  %24 = load i32, ptr %5, align 4, !tbaa !11
  %25 = lshr i32 %24, 20
  %26 = load i32, ptr @PRIM, align 4, !tbaa !11
  %27 = sub i32 %25, %26
  %28 = add i32 %27, 1
  %29 = uitofp i32 %28 to double
  br label %31

30:                                               ; preds = %18, %13
  br label %31

31:                                               ; preds = %30, %23
  %32 = phi double [ %29, %23 ], [ 0.000000e+00, %30 ]
  br label %33

33:                                               ; preds = %31, %12
  %34 = phi double [ -1.000000e+00, %12 ], [ %32, %31 ]
  %35 = fptrunc double %34 to float
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret float %35
}

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}


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

@PRIM = external dso_local local_unnamed_addr global i32, align 4
@MACR = external dso_local local_unnamed_addr global i32, align 4
@NIL = external dso_local local_unnamed_addr global i32, align 4

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

; Function Attrs: nounwind uwtable
define dso_local float @f_type(float noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call float @car(float noundef %0)
  %4 = bitcast float %3 to i32
  %5 = lshr i32 %4, 20
  %6 = load i32, ptr @NIL, align 4, !tbaa !5
  %7 = icmp eq i32 %5, %6
  br i1 %7, label %15, label %8

8:                                                ; preds = %2
  %9 = load i32, ptr @PRIM, align 4, !tbaa !5
  %.not = icmp ult i32 %5, %9
  %10 = load i32, ptr @MACR, align 4
  %.not5 = icmp ugt i32 %5, %10
  %or.cond = select i1 %.not, i1 true, i1 %.not5
  br i1 %or.cond, label %15, label %11

11:                                               ; preds = %8
  %12 = add nuw nsw i32 %5, 1
  %13 = sub nsw i32 %12, %9
  %14 = uitofp i32 %13 to float
  br label %15

15:                                               ; preds = %11, %8, %2
  %16 = phi float [ -1.000000e+00, %2 ], [ %14, %11 ], [ 0.000000e+00, %8 ]
  ret float %16
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass