; 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.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [31 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
declare dso_local i32 @greatest_all_passed() #2

; Function Attrs: nounwind uwtable
declare dso_local void @runSuit() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %2
  br label %7

7:                                                ; preds = %6
  call void @llvm.memset.p0.i64(ptr align 8 @greatest_info, i8 0, i64 368, i1 false)
  store i32 72, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 16), align 4, !tbaa !11
  %8 = call i64 @clock() #4
  store i64 %8, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 19), align 8, !tbaa !15
  %9 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 19), align 8, !tbaa !15
  %10 = icmp eq i64 %9, -1
  br i1 %10, label %11, label %14

11:                                               ; preds = %7
  %12 = load ptr, ptr @stdout, align 8, !tbaa !9
  %13 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef @.str, ptr noundef @.str.19) #4
  call void @exit(i32 noundef 1) #5
  unreachable

14:                                               ; preds = %7
  br label %15

15:                                               ; preds = %14
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  call void @greatest_parse_args(i32 noundef %16, ptr noundef %17)
  br label %18

18:                                               ; preds = %15
  call void @runSuit()
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = load i8, ptr @greatest_info, align 8, !tbaa !16
  %22 = zext i8 %21 to i32
  %23 = and i32 %22, 2
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %62, label %25

25:                                               ; preds = %20
  call void @update_counts_and_reset_suite()
  %26 = call i64 @clock() #4
  store i64 %26, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 20), align 8, !tbaa !17
  %27 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 20), align 8, !tbaa !17
  %28 = icmp eq i64 %27, -1
  br i1 %28, label %29, label %32

29:                                               ; preds = %25
  %30 = load ptr, ptr @stdout, align 8, !tbaa !9
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str, ptr noundef @.str.20) #4
  call void @exit(i32 noundef 1) #5
  unreachable

32:                                               ; preds = %25
  %33 = load ptr, ptr @stdout, align 8, !tbaa !9
  %34 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 2), align 4, !tbaa !18
  %35 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 2), align 4, !tbaa !18
  %36 = icmp eq i32 %35, 1
  %37 = zext i1 %36 to i64
  %38 = select i1 %36, ptr @.str.6, ptr @.str.12
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.21, i32 noundef %34, ptr noundef %38) #4
  %40 = load ptr, ptr @stdout, align 8, !tbaa !9
  %41 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 20), align 8, !tbaa !17
  %42 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 19), align 8, !tbaa !15
  %43 = sub i64 %41, %42
  %44 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 20), align 8, !tbaa !17
  %45 = load i64, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 19), align 8, !tbaa !15
  %46 = sub nsw i64 %44, %45
  %47 = sitofp i64 %46 to double
  %48 = fdiv double %47, 1.000000e+06
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.3, i64 noundef %43, double noundef %48) #4
  %50 = load ptr, ptr @stdout, align 8, !tbaa !9
  %51 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 6), align 4, !tbaa !19
  %52 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 6), align 4, !tbaa !19
  %53 = icmp eq i32 %52, 1
  %54 = zext i1 %53 to i64
  %55 = select i1 %53, ptr @.str.6, ptr @.str.12
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.22, i32 noundef %51, ptr noundef %55) #4
  %57 = load ptr, ptr @stdout, align 8, !tbaa !9
  %58 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 3), align 8, !tbaa !20
  %59 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 4), align 4, !tbaa !21
  %60 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), align 8, !tbaa !22
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.23, i32 noundef %58, i32 noundef %59, i32 noundef %60) #4
  br label %62

62:                                               ; preds = %32, %20
  br label %63

63:                                               ; preds = %62
  %64 = call i32 @greatest_all_passed()
  %65 = icmp ne i32 %64, 0
  %66 = zext i1 %65 to i64
  %67 = select i1 %65, i32 0, i32 1
  store i32 %67, ptr %3, align 4
  br label %68

68:                                               ; preds = %63
  %69 = load i32, ptr %3, align 4
  ret i32 %69
}

; Function Attrs: nounwind uwtable
declare hidden void @greatest_parse_args(i32 noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare hidden void @update_counts_and_reset_suite() #2

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 nounwind willreturn memory(argmem: write) }
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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 132}
!12 = !{!"greatest_run_info", !7, i64 0, !7, i64 1, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !13, i64 24, !10, i64 72, !6, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !6, i64 128, !6, i64 132, !10, i64 136, !10, i64 144, !14, i64 152, !14, i64 160, !7, i64 168}
!13 = !{!"greatest_suite_info", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !14, i64 152}
!16 = !{!12, !7, i64 0}
!17 = !{!12, !14, i64 160}
!18 = !{!12, !6, i64 4}
!19 = !{!12, !6, i64 20}
!20 = !{!12, !6, i64 8}
!21 = !{!12, !6, i64 12}
!22 = !{!12, !6, i64 16}


; 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.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [31 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
declare dso_local i32 @greatest_all_passed() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @runSuit() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(368) @greatest_info, i8 0, i64 368, i1 false)
  store i32 72, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 132), align 4, !tbaa !5
  %3 = tail call i64 @clock() #5
  store i64 %3, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 152), align 8, !tbaa !13
  %4 = icmp eq i64 %3, -1
  br i1 %4, label %5, label %8

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

8:                                                ; preds = %2
  tail call void @greatest_parse_args(i32 noundef %0, ptr noundef %1)
  tail call void @runSuit()
  %9 = load i8, ptr @greatest_info, align 8, !tbaa !15
  %10 = and i8 %9, 2
  %.not = icmp eq i8 %10, 0
  br i1 %.not, label %11, label %39

11:                                               ; preds = %8
  tail call void @update_counts_and_reset_suite()
  %12 = tail call i64 @clock() #5
  store i64 %12, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 160), align 8, !tbaa !16
  %13 = icmp eq i64 %12, -1
  %14 = load ptr, ptr @stdout, align 8, !tbaa !14
  br i1 %13, label %15, label %17

15:                                               ; preds = %11
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str, ptr noundef nonnull @.str.20) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

17:                                               ; preds = %11
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 4), align 4, !tbaa !17
  %19 = icmp eq i32 %18, 1
  %20 = select i1 %19, ptr @.str.6, ptr @.str.12
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.21, i32 noundef %18, ptr noundef nonnull %20) #5
  %22 = load ptr, ptr @stdout, align 8, !tbaa !14
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 160), align 8, !tbaa !16
  %24 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 152), align 8, !tbaa !13
  %25 = sub i64 %23, %24
  %26 = sitofp i64 %25 to double
  %27 = fdiv double %26, 1.000000e+06
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.3, i64 noundef %25, double noundef %27) #5
  %29 = load ptr, ptr @stdout, align 8, !tbaa !14
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 20), align 4, !tbaa !18
  %31 = icmp eq i32 %30, 1
  %32 = select i1 %31, ptr @.str.6, ptr @.str.12
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.22, i32 noundef %30, ptr noundef nonnull %32) #5
  %34 = load ptr, ptr @stdout, align 8, !tbaa !14
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 8), align 8, !tbaa !19
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 12), align 4, !tbaa !20
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 16), align 8, !tbaa !21
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.23, i32 noundef %35, i32 noundef %36, i32 noundef %37) #5
  br label %39

39:                                               ; preds = %8, %17
  %40 = tail call i32 @greatest_all_passed()
  %.not2 = icmp eq i32 %40, 0
  %41 = zext i1 %.not2 to i32
  ret i32 %41
}

; Function Attrs: nounwind uwtable
declare hidden void @greatest_parse_args(i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
declare hidden void @update_counts_and_reset_suite() local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !9, i64 132}
!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 = !{!6, !11, i64 152}
!14 = !{!12, !12, i64 0}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !11, i64 160}
!17 = !{!6, !9, i64 4}
!18 = !{!6, !9, i64 20}
!19 = !{!6, !9, i64 8}
!20 = !{!6, !9, i64 12}
!21 = !{!6, !9, i64 16}


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