; LLVM IR from rolinh/dfc :: src (util)

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

%struct.maxwidths = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@stderr = external global ptr, align 8
@max = external global %struct.maxwidths, align 4
@Tflag = external global i32, align 4
@bflag = external global i32, align 4
@wflag = external global i32, align 4
@dflag = external global i32, align 4
@iflag = external global i32, align 4
@Mflag = external global i32, align 4
@oflag = external global i32, align 4
@.str.17 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [70 x i8], align 1

; 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

declare i32 @fputs(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @auto_adjust(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %5 = load i32, ptr @max, align 4, !tbaa !9
  %6 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 1), align 4, !tbaa !11
  %7 = add nsw i32 %5, %6
  %8 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 2), align 4, !tbaa !12
  %9 = add nsw i32 %7, %8
  %10 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 3), align 4, !tbaa !13
  %11 = add nsw i32 %9, %10
  %12 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 4), align 4, !tbaa !14
  %13 = add nsw i32 %11, %12
  %14 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 5), align 4, !tbaa !15
  %15 = add nsw i32 %13, %14
  %16 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 6), align 4, !tbaa !16
  %17 = add nsw i32 %15, %16
  %18 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 7), align 4, !tbaa !17
  %19 = add nsw i32 %17, %18
  %20 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 8), align 4, !tbaa !18
  %21 = add nsw i32 %19, %20
  %22 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 9), align 4, !tbaa !19
  %23 = add nsw i32 %21, %22
  %24 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 10), align 4, !tbaa !20
  %25 = add nsw i32 %23, %24
  store i32 %25, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = icmp sgt i32 %26, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %1
  store i32 1, ptr %4, align 4
  br label %120

30:                                               ; preds = %1
  %31 = load ptr, ptr @stderr, align 8, !tbaa !21
  %32 = call i32 @fputs(ptr noundef @.str.17, ptr noundef %31)
  %33 = load i32, ptr @bflag, align 4, !tbaa !5
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %54, label %35

35:                                               ; preds = %30
  %36 = load i32, ptr @wflag, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %46

38:                                               ; preds = %35
  store i32 0, ptr @wflag, align 4, !tbaa !5
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sub nsw i32 %39, 30
  store i32 %40, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = icmp sge i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  store i32 1, ptr %4, align 4
  br label %120

45:                                               ; preds = %38
  br label %46

46:                                               ; preds = %45, %35
  store i32 1, ptr @bflag, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 22
  store i32 %48, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = icmp sge i32 %49, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %46
  store i32 1, ptr %4, align 4
  br label %120

53:                                               ; preds = %46
  br label %54

54:                                               ; preds = %53, %30
  %55 = load i32, ptr @dflag, align 4, !tbaa !5
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %66

57:                                               ; preds = %54
  store i32 0, ptr @dflag, align 4, !tbaa !5
  %58 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 4), align 4, !tbaa !14
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sub nsw i32 %59, %58
  store i32 %60, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = icmp sge i32 %61, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %57
  store i32 1, ptr %4, align 4
  br label %120

65:                                               ; preds = %57
  br label %66

66:                                               ; preds = %65, %54
  %67 = load i32, ptr @Tflag, align 4, !tbaa !5
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %78

69:                                               ; preds = %66
  store i32 0, ptr @Tflag, align 4, !tbaa !5
  %70 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 1), align 4, !tbaa !11
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sub nsw i32 %71, %70
  store i32 %72, ptr %3, align 4, !tbaa !5
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = icmp sge i32 %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  store i32 1, ptr %4, align 4
  br label %120

77:                                               ; preds = %69
  br label %78

78:                                               ; preds = %77, %66
  %79 = load i32, ptr @Mflag, align 4, !tbaa !5
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %90, label %81

81:                                               ; preds = %78
  store i32 1, ptr @Mflag, align 4, !tbaa !5
  %82 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 9), align 4, !tbaa !19
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = sub nsw i32 %83, %82
  store i32 %84, ptr %3, align 4, !tbaa !5
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = icmp sge i32 %85, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  store i32 1, ptr %4, align 4
  br label %120

89:                                               ; preds = %81
  br label %90

90:                                               ; preds = %89, %78
  %91 = load i32, ptr @iflag, align 4, !tbaa !5
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %105

93:                                               ; preds = %90
  store i32 0, ptr @iflag, align 4, !tbaa !5
  %94 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 7), align 4, !tbaa !17
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = sub nsw i32 %95, %94
  store i32 %96, ptr %3, align 4, !tbaa !5
  %97 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 8), align 4, !tbaa !18
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = sub nsw i32 %98, %97
  store i32 %99, ptr %3, align 4, !tbaa !5
  %100 = load i32, ptr %2, align 4, !tbaa !5
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = icmp sge i32 %100, %101
  br i1 %102, label %103, label %104

103:                                              ; preds = %93
  store i32 1, ptr %4, align 4
  br label %120

104:                                              ; preds = %93
  br label %105

105:                                              ; preds = %104, %90
  %106 = load i32, ptr @oflag, align 4, !tbaa !5
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %117

108:                                              ; preds = %105
  store i32 0, ptr @oflag, align 4, !tbaa !5
  %109 = load i32, ptr getelementptr inbounds (%struct.maxwidths, ptr @max, i32 0, i32 10), align 4, !tbaa !20
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = sub nsw i32 %110, %109
  store i32 %111, ptr %3, align 4, !tbaa !5
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = load i32, ptr %3, align 4, !tbaa !5
  %114 = icmp sge i32 %112, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %108
  store i32 1, ptr %4, align 4
  br label %120

116:                                              ; preds = %108
  br label %117

117:                                              ; preds = %116, %105
  %118 = load ptr, ptr @stderr, align 8, !tbaa !21
  %119 = call i32 @fputs(ptr noundef @.str.18, ptr noundef %118)
  store i32 0, ptr %4, align 4
  br label %120

120:                                              ; preds = %117, %115, %103, %88, %76, %64, %52, %44, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %121 = load i32, ptr %4, align 4
  switch i32 %121, label %123 [
    i32 0, label %122
    i32 1, label %122
  ]

122:                                              ; preds = %120, %120
  ret void

123:                                              ; preds = %120
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"maxwidths", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 12}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 20}
!16 = !{!10, !6, i64 24}
!17 = !{!10, !6, i64 28}
!18 = !{!10, !6, i64 32}
!19 = !{!10, !6, i64 36}
!20 = !{!10, !6, i64 40}
!21 = !{!22, !22, i64 0}
!22 = !{!"any pointer", !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"

%struct.maxwidths = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@max = external local_unnamed_addr global %struct.maxwidths, align 4
@Tflag = external local_unnamed_addr global i32, align 4
@bflag = external local_unnamed_addr global i32, align 4
@wflag = external local_unnamed_addr global i32, align 4
@dflag = external local_unnamed_addr global i32, align 4
@iflag = external local_unnamed_addr global i32, align 4
@Mflag = external local_unnamed_addr global i32, align 4
@oflag = external local_unnamed_addr global i32, align 4
@.str.17 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [70 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @auto_adjust(i32 noundef %0) local_unnamed_addr #1 {
  %2 = load <8 x i32>, ptr @max, align 4, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 32), align 4, !tbaa !9
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 36), align 4, !tbaa !11
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 40), align 4, !tbaa !12
  %6 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %2)
  %op.rdx = add i32 %6, %3
  %op.rdx47 = add i32 %4, %5
  %op.rdx48 = add i32 %op.rdx, %op.rdx47
  %7 = icmp slt i32 %op.rdx48, %0
  br i1 %7, label %48, label %8

8:                                                ; preds = %1
  %9 = load ptr, ptr @stderr, align 8, !tbaa !13
  %10 = tail call i32 @fputs(ptr noundef nonnull @.str.17, ptr noundef %9) #3
  %11 = load i32, ptr @bflag, align 4, !tbaa !5
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %18

12:                                               ; preds = %8
  %13 = load i32, ptr @wflag, align 4, !tbaa !5
  %.not32 = icmp eq i32 %13, 0
  br i1 %.not32, label %16, label %14

14:                                               ; preds = %12
  store i32 0, ptr @wflag, align 4, !tbaa !5
  %15 = add nsw i32 %op.rdx48, -30
  %.not33 = icmp sgt i32 %15, %0
  br i1 %.not33, label %16, label %48

16:                                               ; preds = %14, %12
  %.0 = phi i32 [ %15, %14 ], [ %op.rdx48, %12 ]
  store i32 1, ptr @bflag, align 4, !tbaa !5
  %17 = add nsw i32 %.0, -22
  %.not34 = icmp sgt i32 %17, %0
  br i1 %.not34, label %18, label %48

18:                                               ; preds = %16, %8
  %.1 = phi i32 [ %op.rdx48, %8 ], [ %17, %16 ]
  %19 = load i32, ptr @dflag, align 4, !tbaa !5
  %.not35 = icmp eq i32 %19, 0
  br i1 %.not35, label %23, label %20

20:                                               ; preds = %18
  store i32 0, ptr @dflag, align 4, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 16), align 4, !tbaa !15
  %22 = sub nsw i32 %.1, %21
  %.not36 = icmp sgt i32 %22, %0
  br i1 %.not36, label %23, label %48

23:                                               ; preds = %20, %18
  %.2 = phi i32 [ %22, %20 ], [ %.1, %18 ]
  %24 = load i32, ptr @Tflag, align 4, !tbaa !5
  %.not37 = icmp eq i32 %24, 0
  br i1 %.not37, label %28, label %25

25:                                               ; preds = %23
  store i32 0, ptr @Tflag, align 4, !tbaa !5
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 4), align 4, !tbaa !16
  %27 = sub nsw i32 %.2, %26
  %.not38 = icmp sgt i32 %27, %0
  br i1 %.not38, label %28, label %48

28:                                               ; preds = %25, %23
  %.3 = phi i32 [ %27, %25 ], [ %.2, %23 ]
  %29 = load i32, ptr @Mflag, align 4, !tbaa !5
  %.not39 = icmp eq i32 %29, 0
  br i1 %.not39, label %30, label %33

30:                                               ; preds = %28
  store i32 1, ptr @Mflag, align 4, !tbaa !5
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 36), align 4, !tbaa !11
  %32 = sub nsw i32 %.3, %31
  %.not40 = icmp sgt i32 %32, %0
  br i1 %.not40, label %33, label %48

33:                                               ; preds = %30, %28
  %.4 = phi i32 [ %.3, %28 ], [ %32, %30 ]
  %34 = load i32, ptr @iflag, align 4, !tbaa !5
  %.not41 = icmp eq i32 %34, 0
  br i1 %.not41, label %40, label %35

35:                                               ; preds = %33
  store i32 0, ptr @iflag, align 4, !tbaa !5
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 28), align 4, !tbaa !17
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 32), align 4, !tbaa !9
  %38 = add i32 %36, %37
  %39 = sub i32 %.4, %38
  %.not42 = icmp sgt i32 %39, %0
  br i1 %.not42, label %40, label %48

40:                                               ; preds = %35, %33
  %.5 = phi i32 [ %39, %35 ], [ %.4, %33 ]
  %41 = load i32, ptr @oflag, align 4, !tbaa !5
  %.not43 = icmp eq i32 %41, 0
  br i1 %.not43, label %45, label %42

42:                                               ; preds = %40
  store i32 0, ptr @oflag, align 4, !tbaa !5
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @max, i64 40), align 4, !tbaa !12
  %44 = sub nsw i32 %.5, %43
  %.not44 = icmp sgt i32 %44, %0
  br i1 %.not44, label %45, label %48

45:                                               ; preds = %42, %40
  %46 = load ptr, ptr @stderr, align 8, !tbaa !13
  %47 = tail call i32 @fputs(ptr noundef nonnull @.str.18, ptr noundef %46) #3
  br label %48

48:                                               ; preds = %42, %35, %30, %25, %20, %16, %14, %1, %45
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v8i32(<8 x 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 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { cold }

!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"}
!9 = !{!10, !6, i64 32}
!10 = !{!"maxwidths", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40}
!11 = !{!10, !6, i64 36}
!12 = !{!10, !6, i64 40}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 4}
!17 = !{!10, !6, i64 28}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass