; LLVM IR from EarlGray/language-incubator :: fp/secd (secd)

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

@stderr = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_nil(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @cell_index(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @get_car(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @not_nil(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_cons(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @list_next(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @atom_eq(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @list_eq(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call i32 @is_cons(ptr noundef %9)
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %19, label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i64 @cell_index(ptr noundef %14)
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef @.str.41, i64 noundef %15) #4
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.9) #4
  store i32 0, ptr %3, align 4
  br label %96

19:                                               ; preds = %2
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = icmp eq ptr %20, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %19
  store i32 1, ptr %3, align 4
  br label %96

24:                                               ; preds = %19
  br label %25

25:                                               ; preds = %92, %24
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call i32 @not_nil(ptr noundef %26)
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %93

29:                                               ; preds = %25
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = call i32 @is_cons(ptr noundef %30)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %37, label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call i32 @atom_eq(ptr noundef %34, ptr noundef %35)
  store i32 %36, ptr %3, align 4
  br label %96

37:                                               ; preds = %29
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call i32 @is_nil(ptr noundef %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  store i32 0, ptr %3, align 4
  br label %96

42:                                               ; preds = %37
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = call i32 @is_cons(ptr noundef %43)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 0, ptr %3, align 4
  br label %96

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call ptr @get_car(ptr noundef %48)
  store ptr %49, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = call ptr @get_car(ptr noundef %50)
  store ptr %51, ptr %7, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = call i32 @not_nil(ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %79

55:                                               ; preds = %47
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = call i32 @is_nil(ptr noundef %56)
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %55
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %90

60:                                               ; preds = %55
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call i32 @is_cons(ptr noundef %61)
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %71

64:                                               ; preds = %60
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = call i32 @list_eq(ptr noundef %65, ptr noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %64
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %90

70:                                               ; preds = %64
  br label %78

71:                                               ; preds = %60
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call i32 @atom_eq(ptr noundef %72, ptr noundef %73)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %77, label %76

76:                                               ; preds = %71
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %90

77:                                               ; preds = %71
  br label %78

78:                                               ; preds = %77, %70
  br label %85

79:                                               ; preds = %47
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = call i32 @not_nil(ptr noundef %80)
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %79
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %90

84:                                               ; preds = %79
  br label %85

85:                                               ; preds = %84, %78
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = call ptr @list_next(ptr noundef %86)
  store ptr %87, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = call ptr @list_next(ptr noundef %88)
  store ptr %89, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %8, align 4
  br label %90

90:                                               ; preds = %85, %83, %76, %69, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %91 = load i32, ptr %8, align 4
  switch i32 %91, label %98 [
    i32 0, label %92
    i32 1, label %96
  ]

92:                                               ; preds = %90
  br label %25, !llvm.loop !9

93:                                               ; preds = %25
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = call i32 @is_nil(ptr noundef %94)
  store i32 %95, ptr %3, align 4
  br label %96

96:                                               ; preds = %93, %90, %46, %41, %33, %23, %12
  %97 = load i32, ptr %3, align 4
  ret i32 %97

98:                                               ; preds = %90
  unreachable
}

attributes #0 = { 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_nil(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @cell_index(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @get_car(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @not_nil(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_cons(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @list_next(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @atom_eq(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @list_eq(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = tail call i32 @is_cons(ptr noundef %0)
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %4, label %10

4:                                                ; preds = %2
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i64 @cell_index(ptr noundef %0)
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.41, i64 noundef %6) #3
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.9) #3
  br label %.thread

10:                                               ; preds = %2
  %11 = icmp eq ptr %0, %1
  br i1 %11, label %.thread, label %.preheader

.preheader:                                       ; preds = %10
  %12 = tail call i32 @not_nil(ptr noundef %0)
  %.not3149 = icmp eq i32 %12, 0
  br i1 %.not3149, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %34
  %.02551 = phi ptr [ %35, %34 ], [ %0, %.preheader ]
  %.02750 = phi ptr [ %36, %34 ], [ %1, %.preheader ]
  %13 = tail call i32 @is_cons(ptr noundef %.02551)
  %.not32 = icmp eq i32 %13, 0
  br i1 %.not32, label %14, label %16

14:                                               ; preds = %.lr.ph
  %15 = tail call i32 @atom_eq(ptr noundef %.02551, ptr noundef %.02750)
  br label %.thread

16:                                               ; preds = %.lr.ph
  %17 = tail call i32 @is_nil(ptr noundef %.02750)
  %.not33 = icmp eq i32 %17, 0
  br i1 %.not33, label %18, label %.thread

18:                                               ; preds = %16
  %19 = tail call i32 @is_cons(ptr noundef %.02750)
  %.not34 = icmp eq i32 %19, 0
  br i1 %.not34, label %.thread, label %20

20:                                               ; preds = %18
  %21 = tail call ptr @get_car(ptr noundef %.02551)
  %22 = tail call ptr @get_car(ptr noundef %.02750)
  %23 = tail call i32 @not_nil(ptr noundef %21)
  %.not35 = icmp eq i32 %23, 0
  br i1 %.not35, label %32, label %24

24:                                               ; preds = %20
  %25 = tail call i32 @is_nil(ptr noundef %22)
  %.not37 = icmp eq i32 %25, 0
  br i1 %.not37, label %26, label %.thread

26:                                               ; preds = %24
  %27 = tail call i32 @is_cons(ptr noundef %21)
  %.not38 = icmp eq i32 %27, 0
  br i1 %.not38, label %30, label %28

28:                                               ; preds = %26
  %29 = tail call i32 @list_eq(ptr noundef %21, ptr noundef %22)
  %.not40 = icmp eq i32 %29, 0
  br i1 %.not40, label %.thread, label %34

30:                                               ; preds = %26
  %31 = tail call i32 @atom_eq(ptr noundef %21, ptr noundef %22)
  %.not39 = icmp eq i32 %31, 0
  br i1 %.not39, label %.thread, label %34

32:                                               ; preds = %20
  %33 = tail call i32 @not_nil(ptr noundef %22)
  %.not36 = icmp eq i32 %33, 0
  br i1 %.not36, label %34, label %.thread

34:                                               ; preds = %30, %28, %32
  %35 = tail call ptr @list_next(ptr noundef %.02551)
  %36 = tail call ptr @list_next(ptr noundef %.02750)
  %37 = tail call i32 @not_nil(ptr noundef %35)
  %.not31 = icmp eq i32 %37, 0
  br i1 %.not31, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %34, %.preheader
  %.027.lcssa = phi ptr [ %1, %.preheader ], [ %36, %34 ]
  %38 = tail call i32 @is_nil(ptr noundef %.027.lcssa)
  br label %.thread

.thread:                                          ; preds = %32, %30, %28, %24, %18, %16, %10, %._crit_edge, %14, %4
  %.2 = phi i32 [ %15, %14 ], [ %38, %._crit_edge ], [ 0, %4 ], [ 1, %10 ], [ 0, %16 ], [ 0, %18 ], [ 0, %24 ], [ 0, %28 ], [ 0, %30 ], [ 0, %32 ]
  ret i32 %.2
}

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 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" }
attributes #3 = { cold 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"}


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