; LLVM IR from kostya/crystal-benchmarks-game :: meteor (meteor)

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

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @shift(i8 noundef signext, i8 noundef signext) #0

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @out_of_bounds(i8 noundef signext, i8 noundef signext) #0

; Function Attrs: nounwind uwtable
define dso_local void @fill_contiguous_space(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = load i32, ptr %4, align 4, !tbaa !9
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds i8, ptr %5, i64 %7
  %9 = load i8, ptr %8, align 1, !tbaa !11
  %10 = sext i8 %9 to i32
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  br label %83

13:                                               ; preds = %2
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %14, i64 %16
  store i8 1, ptr %17, align 1, !tbaa !11
  %18 = load i32, ptr %4, align 4, !tbaa !9
  %19 = trunc i32 %18 to i8
  %20 = call signext i8 @out_of_bounds(i8 noundef signext %19, i8 noundef signext 0)
  %21 = icmp ne i8 %20, 0
  br i1 %21, label %28, label %22

22:                                               ; preds = %13
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load i32, ptr %4, align 4, !tbaa !9
  %25 = trunc i32 %24 to i8
  %26 = call signext i8 @shift(i8 noundef signext %25, i8 noundef signext 0)
  %27 = sext i8 %26 to i32
  call void @fill_contiguous_space(ptr noundef %23, i32 noundef %27)
  br label %28

28:                                               ; preds = %22, %13
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = trunc i32 %29 to i8
  %31 = call signext i8 @out_of_bounds(i8 noundef signext %30, i8 noundef signext 2)
  %32 = icmp ne i8 %31, 0
  br i1 %32, label %39, label %33

33:                                               ; preds = %28
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = trunc i32 %35 to i8
  %37 = call signext i8 @shift(i8 noundef signext %36, i8 noundef signext 2)
  %38 = sext i8 %37 to i32
  call void @fill_contiguous_space(ptr noundef %34, i32 noundef %38)
  br label %39

39:                                               ; preds = %33, %28
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = trunc i32 %40 to i8
  %42 = call signext i8 @out_of_bounds(i8 noundef signext %41, i8 noundef signext 4)
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %50, label %44

44:                                               ; preds = %39
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = trunc i32 %46 to i8
  %48 = call signext i8 @shift(i8 noundef signext %47, i8 noundef signext 4)
  %49 = sext i8 %48 to i32
  call void @fill_contiguous_space(ptr noundef %45, i32 noundef %49)
  br label %50

50:                                               ; preds = %44, %39
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = trunc i32 %51 to i8
  %53 = call signext i8 @out_of_bounds(i8 noundef signext %52, i8 noundef signext 6)
  %54 = icmp ne i8 %53, 0
  br i1 %54, label %61, label %55

55:                                               ; preds = %50
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !9
  %58 = trunc i32 %57 to i8
  %59 = call signext i8 @shift(i8 noundef signext %58, i8 noundef signext 6)
  %60 = sext i8 %59 to i32
  call void @fill_contiguous_space(ptr noundef %56, i32 noundef %60)
  br label %61

61:                                               ; preds = %55, %50
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = trunc i32 %62 to i8
  %64 = call signext i8 @out_of_bounds(i8 noundef signext %63, i8 noundef signext 8)
  %65 = icmp ne i8 %64, 0
  br i1 %65, label %72, label %66

66:                                               ; preds = %61
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !9
  %69 = trunc i32 %68 to i8
  %70 = call signext i8 @shift(i8 noundef signext %69, i8 noundef signext 8)
  %71 = sext i8 %70 to i32
  call void @fill_contiguous_space(ptr noundef %67, i32 noundef %71)
  br label %72

72:                                               ; preds = %66, %61
  %73 = load i32, ptr %4, align 4, !tbaa !9
  %74 = trunc i32 %73 to i8
  %75 = call signext i8 @out_of_bounds(i8 noundef signext %74, i8 noundef signext 10)
  %76 = icmp ne i8 %75, 0
  br i1 %76, label %83, label %77

77:                                               ; preds = %72
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = load i32, ptr %4, align 4, !tbaa !9
  %80 = trunc i32 %79 to i8
  %81 = call signext i8 @shift(i8 noundef signext %80, i8 noundef signext 10)
  %82 = sext i8 %81 to i32
  call void @fill_contiguous_space(ptr noundef %78, i32 noundef %82)
  br label %83

83:                                               ; preds = %77, %72, %12
  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" }

!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 = !{!"int", !7, i64 0}
!11 = !{!7, !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"

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @shift(i8 noundef signext, i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @out_of_bounds(i8 noundef signext, i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @fill_contiguous_space(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = sext i32 %1 to i64
  %4 = getelementptr inbounds i8, ptr %0, i64 %3
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = icmp eq i8 %5, 1
  br i1 %6, label %tailrecurse._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %7 = trunc i32 %1 to i8
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %tailrecurse
  %8 = phi ptr [ %37, %tailrecurse ], [ %4, %.lr.ph.preheader ]
  %.tr2627 = phi i8 [ %35, %tailrecurse ], [ %7, %.lr.ph.preheader ]
  store i8 1, ptr %8, align 1, !tbaa !5
  %9 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 0)
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %10, label %13

10:                                               ; preds = %.lr.ph
  %11 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 0)
  %12 = sext i8 %11 to i32
  tail call void @fill_contiguous_space(ptr noundef nonnull %0, i32 noundef %12)
  br label %13

13:                                               ; preds = %10, %.lr.ph
  %14 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 2)
  %.not21 = icmp eq i8 %14, 0
  br i1 %.not21, label %15, label %18

15:                                               ; preds = %13
  %16 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 2)
  %17 = sext i8 %16 to i32
  tail call void @fill_contiguous_space(ptr noundef nonnull %0, i32 noundef %17)
  br label %18

18:                                               ; preds = %15, %13
  %19 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 4)
  %.not22 = icmp eq i8 %19, 0
  br i1 %.not22, label %20, label %23

20:                                               ; preds = %18
  %21 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 4)
  %22 = sext i8 %21 to i32
  tail call void @fill_contiguous_space(ptr noundef nonnull %0, i32 noundef %22)
  br label %23

23:                                               ; preds = %20, %18
  %24 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 6)
  %.not23 = icmp eq i8 %24, 0
  br i1 %.not23, label %25, label %28

25:                                               ; preds = %23
  %26 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 6)
  %27 = sext i8 %26 to i32
  tail call void @fill_contiguous_space(ptr noundef nonnull %0, i32 noundef %27)
  br label %28

28:                                               ; preds = %25, %23
  %29 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 8)
  %.not24 = icmp eq i8 %29, 0
  br i1 %.not24, label %30, label %33

30:                                               ; preds = %28
  %31 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 8)
  %32 = sext i8 %31 to i32
  tail call void @fill_contiguous_space(ptr noundef nonnull %0, i32 noundef %32)
  br label %33

33:                                               ; preds = %30, %28
  %34 = tail call signext i8 @out_of_bounds(i8 noundef signext %.tr2627, i8 noundef signext 10)
  %.not25 = icmp eq i8 %34, 0
  br i1 %.not25, label %tailrecurse, label %tailrecurse._crit_edge

tailrecurse:                                      ; preds = %33
  %35 = tail call signext i8 @shift(i8 noundef signext %.tr2627, i8 noundef signext 10)
  %36 = sext i8 %35 to i64
  %37 = getelementptr inbounds i8, ptr %0, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = icmp eq i8 %38, 1
  br i1 %39, label %tailrecurse._crit_edge, label %.lr.ph

tailrecurse._crit_edge:                           ; preds = %33, %tailrecurse, %2
  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" }

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


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass