; LLVM IR from Robert-van-Engelen/lisp-cheney :: src (lisp-cheney)

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

@CONS = external dso_local global i64, align 8
@out = external dso_local global ptr, align 8
@.str.66 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @not(double noundef) #0

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

declare i32 @putc(i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @printlist(double noundef %0) #0 {
  %2 = alloca double, align 8
  store double %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr @out, align 8, !tbaa !9
  %4 = call i32 @putc(i32 noundef 40, ptr noundef %3)
  br label %5

5:                                                ; preds = %22, %1
  %6 = load double, ptr %2, align 8, !tbaa !5
  %7 = call double @car(double noundef %6)
  call void @print(double noundef %7)
  %8 = load double, ptr %2, align 8, !tbaa !5
  %9 = call double @cdr(double noundef %8)
  store double %9, ptr %2, align 8, !tbaa !5
  %10 = call i32 @not(double noundef %9)
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %5
  br label %25

13:                                               ; preds = %5
  %14 = load i64, ptr %2, align 8, !tbaa !11
  %15 = lshr i64 %14, 48
  %16 = load i64, ptr @CONS, align 8, !tbaa !11
  %17 = icmp ne i64 %15, %16
  br i1 %17, label %18, label %22

18:                                               ; preds = %13
  %19 = load ptr, ptr @out, align 8, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.66) #3
  %21 = load double, ptr %2, align 8, !tbaa !5
  call void @print(double noundef %21)
  br label %25

22:                                               ; preds = %13
  %23 = load ptr, ptr @out, align 8, !tbaa !9
  %24 = call i32 @putc(i32 noundef 32, ptr noundef %23)
  br label %5

25:                                               ; preds = %18, %12
  %26 = load ptr, ptr @out, align 8, !tbaa !9
  %27 = call i32 @putc(i32 noundef 41, ptr noundef %26)
  ret void
}

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

@CONS = external dso_local local_unnamed_addr global i64, align 8
@out = external dso_local local_unnamed_addr global ptr, align 8
@.str.66 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local double @cdr(double 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 i32 @not(double noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @printlist(double noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @out, align 8, !tbaa !5
  %3 = tail call i32 @putc(i32 noundef 40, ptr noundef %2)
  %4 = tail call double @car(double noundef %0)
  tail call void @print(double noundef %4)
  %5 = tail call double @cdr(double noundef %0)
  %6 = tail call i32 @not(double noundef %5)
  %.not5 = icmp eq i32 %6, 0
  br i1 %.not5, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %1, %14
  %7 = phi double [ %17, %14 ], [ %5, %1 ]
  %8 = bitcast double %7 to i64
  %9 = lshr i64 %8, 48
  %10 = load i64, ptr @CONS, align 8, !tbaa !9
  %.not3 = icmp eq i64 %9, %10
  %11 = load ptr, ptr @out, align 8, !tbaa !5
  br i1 %.not3, label %14, label %12

12:                                               ; preds = %.lr.ph
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.66) #2
  tail call void @print(double noundef %7)
  br label %.loopexit

14:                                               ; preds = %.lr.ph
  %15 = tail call i32 @putc(i32 noundef 32, ptr noundef %11)
  %16 = tail call double @car(double noundef %7)
  tail call void @print(double noundef %16)
  %17 = tail call double @cdr(double noundef %7)
  %18 = tail call i32 @not(double noundef %17)
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %.lr.ph, label %.loopexit

.loopexit:                                        ; preds = %14, %1, %12
  %19 = load ptr, ptr @out, align 8, !tbaa !5
  %20 = tail call i32 @putc(i32 noundef 41, ptr noundef %19)
  ret void
}

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


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