; LLVM IR from huhuanming/leetcode :: C/LeetCode (main)

; 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.greatest_run_info = type { i8, i8, i32, i32, i32, i32, i32, %struct.greatest_suite_info, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@greatest_info = external dso_local global %struct.greatest_run_info, align 8
@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind
declare i64 @clock() #0

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @greatest_post_test(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %6 = call i64 @clock() #5
  store i64 %6, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !11
  %7 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !11
  %8 = icmp eq i64 %7, -1
  br i1 %8, label %9, label %12

9:                                                ; preds = %2
  %10 = load ptr, ptr @stdout, align 8, !tbaa !5
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef @.str, ptr noundef @.str.2) #5
  call void @exit(i32 noundef 1) #6
  unreachable

12:                                               ; preds = %2
  %13 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 13), align 8, !tbaa !15
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %19

15:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %16 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 14), align 8, !tbaa !16
  store ptr %16, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 13), align 8, !tbaa !15
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  call void %17(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %19

19:                                               ; preds = %15, %12
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = icmp sle i32 %20, -1
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  call void @greatest_do_fail(ptr noundef %23)
  br label %36

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !9
  %26 = icmp sge i32 %25, 1
  br i1 %26, label %27, label %29

27:                                               ; preds = %24
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  call void @greatest_do_skip(ptr noundef %28)
  br label %35

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %29
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  call void @greatest_do_pass(ptr noundef %33)
  br label %34

34:                                               ; preds = %32, %29
  br label %35

35:                                               ; preds = %34, %27
  br label %36

36:                                               ; preds = %35, %22
  %37 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), align 8, !tbaa !17
  %38 = add i32 %37, 1
  store i32 %38, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), align 8, !tbaa !17
  %39 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 15), align 8, !tbaa !18
  %40 = add i32 %39, 1
  store i32 %40, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 15), align 8, !tbaa !18
  %41 = load i8, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 1), align 1, !tbaa !19
  %42 = zext i8 %41 to i32
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %44, label %57

44:                                               ; preds = %36
  %45 = load ptr, ptr @stdout, align 8, !tbaa !5
  %46 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !11
  %47 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 6), align 8, !tbaa !20
  %48 = sub i64 %46, %47
  %49 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !11
  %50 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), i32 0, i32 6), align 8, !tbaa !20
  %51 = sub nsw i64 %49, %50
  %52 = sitofp i64 %51 to double
  %53 = fdiv double %52, 1.000000e+06
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.3, i64 noundef %48, double noundef %53) #5
  %55 = load ptr, ptr @stdout, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.4) #5
  br label %66

57:                                               ; preds = %36
  %58 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 15), align 8, !tbaa !18
  %59 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 16), align 4, !tbaa !21
  %60 = urem i32 %58, %59
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %65

62:                                               ; preds = %57
  %63 = load ptr, ptr @stdout, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.4) #5
  store i32 0, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 15), align 8, !tbaa !18
  br label %65

65:                                               ; preds = %62, %57
  br label %66

66:                                               ; preds = %65, %44
  %67 = load ptr, ptr @stdout, align 8, !tbaa !5
  %68 = load ptr, ptr @stdout, align 8, !tbaa !5
  %69 = icmp eq ptr %67, %68
  br i1 %69, label %70, label %73

70:                                               ; preds = %66
  %71 = load ptr, ptr @stdout, align 8, !tbaa !5
  %72 = call i32 @fflush(ptr noundef %71)
  br label %73

73:                                               ; preds = %70, %66
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_fail(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_skip(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_pass(ptr noundef) #2

declare i32 @fflush(ptr noundef) #4

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 = { noreturn 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 #5 = { nounwind }
attributes #6 = { noreturn 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, !14, i64 64}
!12 = !{!"greatest_run_info", !7, i64 0, !7, i64 1, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !6, i64 72, !10, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !10, i64 132, !6, i64 136, !6, i64 144, !14, i64 152, !14, i64 160, !7, i64 168}
!13 = !{!"greatest_suite_info", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 112}
!16 = !{!12, !6, i64 120}
!17 = !{!12, !10, i64 24}
!18 = !{!12, !10, i64 128}
!19 = !{!12, !7, i64 1}
!20 = !{!12, !14, i64 56}
!21 = !{!12, !10, i64 132}


; 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.greatest_run_info = type { i8, i8, i32, i32, i32, i32, i32, %struct.greatest_suite_info, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@greatest_info = external dso_local local_unnamed_addr global %struct.greatest_run_info, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind
declare i64 @clock() 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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @greatest_post_test(ptr noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = tail call i64 @clock() #4
  store i64 %3, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 64), align 8, !tbaa !5
  %4 = icmp eq i64 %3, -1
  br i1 %4, label %5, label %8

5:                                                ; preds = %2
  %6 = load ptr, ptr @stdout, align 8, !tbaa !13
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str, ptr noundef nonnull @.str.2) #4
  tail call void @exit(i32 noundef 1) #5
  unreachable

8:                                                ; preds = %2
  %9 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 112), align 8, !tbaa !14
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %12, label %10

10:                                               ; preds = %8
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 120), align 8, !tbaa !15
  tail call void %9(ptr noundef %11) #4
  br label %12

12:                                               ; preds = %10, %8
  %13 = icmp slt i32 %1, 0
  br i1 %13, label %14, label %15

14:                                               ; preds = %12
  tail call void @greatest_do_fail(ptr noundef %0)
  br label %18

15:                                               ; preds = %12
  %.not7 = icmp eq i32 %1, 0
  br i1 %.not7, label %17, label %16

16:                                               ; preds = %15
  tail call void @greatest_do_skip(ptr noundef %0)
  br label %18

17:                                               ; preds = %15
  tail call void @greatest_do_pass(ptr noundef %0)
  br label %18

18:                                               ; preds = %16, %17, %14
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 24), align 8, !tbaa !16
  %20 = add i32 %19, 1
  store i32 %20, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 24), align 8, !tbaa !16
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !17
  %22 = add i32 %21, 1
  store i32 %22, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !17
  %23 = load i8, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 1), align 1, !tbaa !18
  %.not8 = icmp eq i8 %23, 0
  br i1 %.not8, label %34, label %24

24:                                               ; preds = %18
  %25 = load ptr, ptr @stdout, align 8, !tbaa !13
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 64), align 8, !tbaa !5
  %27 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 56), align 8, !tbaa !19
  %28 = sub i64 %26, %27
  %29 = sitofp i64 %28 to double
  %30 = fdiv double %29, 1.000000e+06
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.3, i64 noundef %28, double noundef %30) #4
  %32 = load ptr, ptr @stdout, align 8, !tbaa !13
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.4) #4
  br label %41

34:                                               ; preds = %18
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 132), align 4, !tbaa !20
  %36 = urem i32 %22, %35
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %41

38:                                               ; preds = %34
  %39 = load ptr, ptr @stdout, align 8, !tbaa !13
  %40 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.4) #4
  store i32 0, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !17
  br label %41

41:                                               ; preds = %24, %38, %34
  %42 = load ptr, ptr @stdout, align 8, !tbaa !13
  %43 = tail call i32 @fflush(ptr noundef %42)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_fail(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_skip(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @greatest_do_pass(ptr noundef) local_unnamed_addr #3

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

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 = { 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 = { noreturn 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 #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 }
attributes #5 = { noreturn 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, !11, i64 64}
!6 = !{!"greatest_run_info", !7, i64 0, !7, i64 1, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !10, i64 24, !12, i64 72, !9, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !9, i64 128, !9, i64 132, !12, i64 136, !12, i64 144, !11, i64 152, !11, i64 160, !7, i64 168}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"greatest_suite_info", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!6, !12, i64 112}
!15 = !{!6, !12, i64 120}
!16 = !{!6, !9, i64 24}
!17 = !{!6, !9, i64 128}
!18 = !{!6, !7, i64 1}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !9, i64 132}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass