; LLVM IR from certik/mlc :: mlc_clib (display)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@boxtop = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@boxsid = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@shade4 = external hidden global ptr, align 8
@shade3 = external hidden global ptr, align 8
@shade2 = external hidden global ptr, align 8
@shade1 = external hidden global ptr, align 8
@shade0 = external hidden global ptr, align 8
@boxbtm = external hidden global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local void @draw_digit(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr @boxtop, align 8, !tbaa !5
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %74, %1
  %10 = load i32, ptr %3, align 4, !tbaa !9
  %11 = icmp slt i32 %10, 28
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %77

13:                                               ; preds = %9
  %14 = load ptr, ptr @boxsid, align 8, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %68, %13
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 28
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %71

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = mul nsw i32 28, %23
  %25 = add nsw i32 %22, %24
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds float, ptr %21, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !11
  store float %28, ptr %6, align 4, !tbaa !11
  %29 = load float, ptr %6, align 4, !tbaa !11
  %30 = fpext float %29 to double
  %31 = fcmp ogt double %30, 0x3FEFAE147AE147AE
  br i1 %31, label %32, label %36

32:                                               ; preds = %20
  %33 = load ptr, ptr @shade4, align 8, !tbaa !5
  %34 = load ptr, ptr @shade4, align 8, !tbaa !5
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %33, ptr noundef %34)
  br label %67

36:                                               ; preds = %20
  %37 = load float, ptr %6, align 4, !tbaa !11
  %38 = fpext float %37 to double
  %39 = fcmp ogt double %38, 7.500000e-01
  br i1 %39, label %40, label %44

40:                                               ; preds = %36
  %41 = load ptr, ptr @shade3, align 8, !tbaa !5
  %42 = load ptr, ptr @shade3, align 8, !tbaa !5
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %41, ptr noundef %42)
  br label %66

44:                                               ; preds = %36
  %45 = load float, ptr %6, align 4, !tbaa !11
  %46 = fpext float %45 to double
  %47 = fcmp ogt double %46, 5.000000e-01
  br i1 %47, label %48, label %52

48:                                               ; preds = %44
  %49 = load ptr, ptr @shade2, align 8, !tbaa !5
  %50 = load ptr, ptr @shade2, align 8, !tbaa !5
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %49, ptr noundef %50)
  br label %65

52:                                               ; preds = %44
  %53 = load float, ptr %6, align 4, !tbaa !11
  %54 = fpext float %53 to double
  %55 = fcmp ogt double %54, 2.500000e-01
  br i1 %55, label %56, label %60

56:                                               ; preds = %52
  %57 = load ptr, ptr @shade1, align 8, !tbaa !5
  %58 = load ptr, ptr @shade1, align 8, !tbaa !5
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %57, ptr noundef %58)
  br label %64

60:                                               ; preds = %52
  %61 = load ptr, ptr @shade0, align 8, !tbaa !5
  %62 = load ptr, ptr @shade0, align 8, !tbaa !5
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %61, ptr noundef %62)
  br label %64

64:                                               ; preds = %60, %56
  br label %65

65:                                               ; preds = %64, %48
  br label %66

66:                                               ; preds = %65, %40
  br label %67

67:                                               ; preds = %66, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !9
  br label %16, !llvm.loop !13

71:                                               ; preds = %19
  %72 = load ptr, ptr @boxsid, align 8, !tbaa !5
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %72)
  br label %74

74:                                               ; preds = %71
  %75 = load i32, ptr %3, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %3, align 4, !tbaa !9
  br label %9, !llvm.loop !15

77:                                               ; preds = %12
  %78 = load ptr, ptr @boxbtm, align 8, !tbaa !5
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %78)
  ret void
}

declare i32 @printf(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

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 = { "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 }

!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 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@boxtop = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@boxsid = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@shade4 = external hidden local_unnamed_addr global ptr, align 8
@shade3 = external hidden local_unnamed_addr global ptr, align 8
@shade2 = external hidden local_unnamed_addr global ptr, align 8
@shade1 = external hidden local_unnamed_addr global ptr, align 8
@shade0 = external hidden local_unnamed_addr global ptr, align 8
@boxbtm = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nofree nounwind uwtable
define dso_local void @draw_digit(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @boxtop, align 8, !tbaa !5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %2)
  br label %7

4:                                                ; preds = %10
  %5 = load ptr, ptr @boxbtm, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %5)
  ret void

7:                                                ; preds = %1, %10
  %indvars.iv15 = phi i64 [ 0, %1 ], [ %indvars.iv.next16, %10 ]
  %8 = load ptr, ptr @boxsid, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %8)
  %.idx = mul i64 %indvars.iv15, 112
  %invariant.gep = getelementptr i8, ptr %0, i64 %.idx
  br label %13

10:                                               ; preds = %23
  %11 = load ptr, ptr @boxsid, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %11)
  %indvars.iv.next16 = add nuw nsw i64 %indvars.iv15, 1
  %exitcond18.not = icmp eq i64 %indvars.iv.next16, 28
  br i1 %exitcond18.not, label %4, label %7, !llvm.loop !9

13:                                               ; preds = %7, %23
  %indvars.iv = phi i64 [ 0, %7 ], [ %indvars.iv.next, %23 ]
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  %14 = load float, ptr %gep, align 4, !tbaa !11
  %15 = fpext float %14 to double
  %16 = fcmp ogt double %15, 0x3FEFAE147AE147AE
  br i1 %16, label %23, label %17

17:                                               ; preds = %13
  %18 = fcmp ogt float %14, 7.500000e-01
  br i1 %18, label %23, label %19

19:                                               ; preds = %17
  %20 = fcmp ogt float %14, 5.000000e-01
  br i1 %20, label %23, label %21

21:                                               ; preds = %19
  %22 = fcmp ogt float %14, 2.500000e-01
  %shade1.shade0 = select i1 %22, ptr @shade1, ptr @shade0
  br label %23

23:                                               ; preds = %21, %19, %17, %13
  %shade3.sink = phi ptr [ @shade4, %13 ], [ @shade3, %17 ], [ @shade2, %19 ], [ %shade1.shade0, %21 ]
  %24 = load ptr, ptr %shade3.sink, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %24, ptr noundef %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 28
  br i1 %exitcond.not, label %10, label %13, !llvm.loop !13
}

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

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

!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"}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass