; LLVM IR from conradlee/network-community-benchmark :: comm_algs/louvain/main_community.ll (Z10parse_argsiPPc)

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

@filename = external dso_local global ptr, align 8
@type = external dso_local global i32, align 4
@precision = external dso_local global double, align 8
@timet = external dso_local global double, align 8
@display_level = external dso_local global i32, align 4
@k1 = external dso_local global i32, align 4
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5usagePcS_(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10parse_argsiPPc(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  %6 = load i32, ptr %3, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 2
  br i1 %7, label %8, label %12

8:                                                ; preds = %2
  %9 = load ptr, ptr %4, align 8, !tbaa !9
  %10 = getelementptr inbounds ptr, ptr %9, i64 0
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_Z5usagePcS_(ptr noundef %11, ptr noundef @.str.8)
  br label %12

12:                                               ; preds = %8, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %98, %12
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %101

18:                                               ; preds = %13
  %19 = load ptr, ptr %4, align 8, !tbaa !9
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds ptr, ptr %19, i64 %21
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %23, i64 0
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = sext i8 %25 to i32
  %27 = icmp eq i32 %26, 45
  br i1 %27, label %28, label %83

28:                                               ; preds = %18
  %29 = load ptr, ptr %4, align 8, !tbaa !9
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds ptr, ptr %29, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %33, i64 1
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = sext i8 %35 to i32
  switch i32 %36, label %78 [
    i32 119, label %37
    i32 113, label %38
    i32 116, label %48
    i32 108, label %58
    i32 107, label %68
  ]

37:                                               ; preds = %28
  store i32 0, ptr @type, align 4, !tbaa !5
  br label %82

38:                                               ; preds = %28
  %39 = load ptr, ptr %4, align 8, !tbaa !9
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds ptr, ptr %39, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call double @atof(ptr noundef %44) #4
  store double %45, ptr @precision, align 8, !tbaa !12
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !5
  br label %82

48:                                               ; preds = %28
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %49, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call double @atof(ptr noundef %54) #4
  store double %55, ptr @timet, align 8, !tbaa !12
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %5, align 4, !tbaa !5
  br label %82

58:                                               ; preds = %28
  %59 = load ptr, ptr %4, align 8, !tbaa !9
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %59, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = call i32 @atoi(ptr noundef %64) #4
  store i32 %65, ptr @display_level, align 4, !tbaa !5
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %5, align 4, !tbaa !5
  br label %82

68:                                               ; preds = %28
  %69 = load ptr, ptr %4, align 8, !tbaa !9
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds ptr, ptr %69, i64 %72
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = call i32 @atoi(ptr noundef %74) #4
  store i32 %75, ptr @k1, align 4, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %82

78:                                               ; preds = %28
  %79 = load ptr, ptr %4, align 8, !tbaa !9
  %80 = getelementptr inbounds ptr, ptr %79, i64 0
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  call void @_Z5usagePcS_(ptr noundef %81, ptr noundef @.str.9)
  br label %82

82:                                               ; preds = %78, %68, %58, %48, %38, %37
  br label %97

83:                                               ; preds = %18
  %84 = load ptr, ptr @filename, align 8, !tbaa !9
  %85 = icmp eq ptr %84, null
  br i1 %85, label %86, label %92

86:                                               ; preds = %83
  %87 = load ptr, ptr %4, align 8, !tbaa !9
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds ptr, ptr %87, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  store ptr %91, ptr @filename, align 8, !tbaa !9
  br label %96

92:                                               ; preds = %83
  %93 = load ptr, ptr %4, align 8, !tbaa !9
  %94 = getelementptr inbounds ptr, ptr %93, i64 0
  %95 = load ptr, ptr %94, align 8, !tbaa !9
  call void @_Z5usagePcS_(ptr noundef %95, ptr noundef @.str.10)
  br label %96

96:                                               ; preds = %92, %86
  br label %97

97:                                               ; preds = %96, %82
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !5
  br label %13, !llvm.loop !14

101:                                              ; preds = %17
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare double @atof(ptr noundef nonnull) #2

; Function Attrs: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #2

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind willreturn memory(read) 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 }
attributes #4 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

@filename = external dso_local local_unnamed_addr global ptr, align 8
@type = external dso_local local_unnamed_addr global i32, align 4
@precision = external dso_local local_unnamed_addr global double, align 8
@timet = external dso_local local_unnamed_addr global double, align 8
@display_level = external dso_local local_unnamed_addr global i32, align 4
@k1 = external dso_local local_unnamed_addr global i32, align 4
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5usagePcS_(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10parse_argsiPPc(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = icmp slt i32 %0, 2
  br i1 %3, label %4, label %.lr.ph

4:                                                ; preds = %2
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @_Z5usagePcS_(ptr noundef %5, ptr noundef nonnull @.str.8)
  br label %._crit_edge

._crit_edge:                                      ; preds = %47, %4
  ret void

.lr.ph:                                           ; preds = %2, %47
  %.024 = phi i32 [ %48, %47 ], [ 1, %2 ]
  %6 = sext i32 %.024 to i64
  %7 = getelementptr inbounds ptr, ptr %1, i64 %6
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = load i8, ptr %8, align 1, !tbaa !9
  %10 = icmp eq i8 %9, 45
  br i1 %10, label %11, label %41

11:                                               ; preds = %.lr.ph
  %12 = getelementptr inbounds i8, ptr %8, i64 1
  %13 = load i8, ptr %12, align 1, !tbaa !9
  switch i8 %13, label %39 [
    i8 119, label %14
    i8 113, label %15
    i8 116, label %21
    i8 108, label %27
    i8 107, label %33
  ]

14:                                               ; preds = %11
  store i32 0, ptr @type, align 4, !tbaa !10
  br label %47

15:                                               ; preds = %11
  %16 = add nsw i32 %.024, 1
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds ptr, ptr %1, i64 %17
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = tail call double @atof(ptr noundef %19) #2
  store double %20, ptr @precision, align 8, !tbaa !12
  br label %47

21:                                               ; preds = %11
  %22 = add nsw i32 %.024, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds ptr, ptr %1, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = tail call double @atof(ptr noundef %25) #2
  store double %26, ptr @timet, align 8, !tbaa !12
  br label %47

27:                                               ; preds = %11
  %28 = add nsw i32 %.024, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %1, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = tail call i32 @atoi(ptr nocapture noundef %31) #2
  store i32 %32, ptr @display_level, align 4, !tbaa !10
  br label %47

33:                                               ; preds = %11
  %34 = add nsw i32 %.024, 1
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %1, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = tail call i32 @atoi(ptr nocapture noundef %37) #2
  store i32 %38, ptr @k1, align 4, !tbaa !10
  br label %47

39:                                               ; preds = %11
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @_Z5usagePcS_(ptr noundef %40, ptr noundef nonnull @.str.9)
  br label %47

41:                                               ; preds = %.lr.ph
  %42 = load ptr, ptr @filename, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store ptr %8, ptr @filename, align 8, !tbaa !5
  br label %47

45:                                               ; preds = %41
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @_Z5usagePcS_(ptr noundef %46, ptr noundef nonnull @.str.10)
  br label %47

47:                                               ; preds = %39, %33, %27, %21, %15, %14, %45, %44
  %.1 = phi i32 [ %.024, %39 ], [ %34, %33 ], [ %28, %27 ], [ %22, %21 ], [ %16, %15 ], [ %.024, %14 ], [ %.024, %44 ], [ %.024, %45 ]
  %48 = add nsw i32 %.1, 1
  %49 = icmp slt i32 %48, %0
  br i1 %49, label %.lr.ph, label %._crit_edge, !llvm.loop !14
}

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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