; LLVM IR from stivalaa/EstimNetDirected :: src (configparser)

; 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.config_param_s = type { ptr, i32, i64, ptr }

@stderr = external global ptr, align 8
@.str.26 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [45 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

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

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

10:                                               ; preds = %128, %3
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = icmp ult i32 %11, %12
  br i1 %13, label %14, label %131

14:                                               ; preds = %10
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds %struct.config_param_s, ptr %16, i64 %18
  %20 = getelementptr inbounds %struct.config_param_s, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds %struct.config_param_s, ptr %22, i64 %24
  %26 = getelementptr inbounds %struct.config_param_s, ptr %25, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.52, ptr noundef %21, ptr noundef %27) #3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds %struct.config_param_s, ptr %29, i64 %31
  %33 = getelementptr inbounds %struct.config_param_s, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !15
  switch i32 %34, label %118 [
    i32 1, label %35
    i32 2, label %47
    i32 3, label %59
    i32 4, label %74
    i32 5, label %103
    i32 6, label %106
  ]

35:                                               ; preds = %14
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds %struct.config_param_s, ptr %38, i64 %40
  %42 = getelementptr inbounds %struct.config_param_s, ptr %41, i32 0, i32 2
  %43 = load i64, ptr %42, align 8, !tbaa !16
  %44 = getelementptr inbounds i8, ptr %37, i64 %43
  %45 = load double, ptr %44, align 8, !tbaa !17
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.53, double noundef %45) #3
  br label %127

47:                                               ; preds = %14
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds %struct.config_param_s, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct.config_param_s, ptr %53, i32 0, i32 2
  %55 = load i64, ptr %54, align 8, !tbaa !16
  %56 = getelementptr inbounds i8, ptr %49, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.54, i32 noundef %57) #3
  br label %127

59:                                               ; preds = %14
  %60 = load ptr, ptr @stderr, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds %struct.config_param_s, ptr %62, i64 %64
  %66 = getelementptr inbounds %struct.config_param_s, ptr %65, i32 0, i32 2
  %67 = load i64, ptr %66, align 8, !tbaa !16
  %68 = getelementptr inbounds i8, ptr %61, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  %71 = zext i1 %70 to i64
  %72 = select i1 %70, ptr @.str.56, ptr @.str.57
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.55, ptr noundef %72) #3
  br label %127

74:                                               ; preds = %14
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str.58) #3
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %struct.config_param_s, ptr %78, i64 %80
  %82 = getelementptr inbounds %struct.config_param_s, ptr %81, i32 0, i32 2
  %83 = load i64, ptr %82, align 8, !tbaa !16
  %84 = getelementptr inbounds i8, ptr %77, i64 %83
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %99

87:                                               ; preds = %74
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load i32, ptr %7, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds %struct.config_param_s, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.config_param_s, ptr %93, i32 0, i32 2
  %95 = load i64, ptr %94, align 8, !tbaa !16
  %96 = getelementptr inbounds i8, ptr %89, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.59, ptr noundef %97) #3
  br label %102

99:                                               ; preds = %74
  %100 = load ptr, ptr @stderr, align 8, !tbaa !5
  %101 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %100, ptr noundef @.str.26) #3
  br label %102

102:                                              ; preds = %99, %87
  br label %127

103:                                              ; preds = %14
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef @.str.60) #3
  br label %127

106:                                              ; preds = %14
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds %struct.config_param_s, ptr %109, i64 %111
  %113 = getelementptr inbounds %struct.config_param_s, ptr %112, i32 0, i32 2
  %114 = load i64, ptr %113, align 8, !tbaa !16
  %115 = getelementptr inbounds i8, ptr %108, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !19
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef @.str.61, i64 noundef %116) #3
  br label %127

118:                                              ; preds = %14
  %119 = load ptr, ptr @stderr, align 8, !tbaa !5
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = zext i32 %121 to i64
  %123 = getelementptr inbounds %struct.config_param_s, ptr %120, i64 %122
  %124 = getelementptr inbounds %struct.config_param_s, ptr %123, i32 0, i32 1
  %125 = load i32, ptr %124, align 8, !tbaa !15
  %126 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef @.str.62, i32 noundef %125) #3
  br label %127

127:                                              ; preds = %118, %106, %103, %102, %59, %47, %35
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %7, align 4, !tbaa !9
  %130 = add i32 %129, 1
  store i32 %130, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !20

131:                                              ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !6, i64 0}
!12 = !{!"config_param_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 24}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !13, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!13, !13, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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"

%struct.config_param_s = type { ptr, i32, i64, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.26 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [45 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @dump_config_names(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = load ptr, ptr @stderr, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.51) #2
  %.not31 = icmp eq i32 %2, 0
  br i1 %.not31, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %wide.trip.count = zext i32 %2 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %55
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %55 ]
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.config_param_s, ptr %1, i64 %indvars.iv
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %7, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.52, ptr noundef %8, ptr noundef %10) #2
  %12 = getelementptr inbounds i8, ptr %7, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !14
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  switch i32 %13, label %53 [
    i32 1, label %15
    i32 2, label %21
    i32 3, label %27
    i32 4, label %34
    i32 5, label %45
    i32 6, label %47
  ]

15:                                               ; preds = %.lr.ph
  %16 = getelementptr inbounds i8, ptr %7, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %0, i64 %17
  %19 = load double, ptr %18, align 8, !tbaa !16
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.53, double noundef %19) #2
  br label %55

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds i8, ptr %7, i64 16
  %23 = load i64, ptr %22, align 8, !tbaa !15
  %24 = getelementptr inbounds i8, ptr %0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !18
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.54, i32 noundef %25) #2
  br label %55

27:                                               ; preds = %.lr.ph
  %28 = getelementptr inbounds i8, ptr %7, i64 16
  %29 = load i64, ptr %28, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !18
  %.not29 = icmp eq i32 %31, 0
  %32 = select i1 %.not29, ptr @.str.57, ptr @.str.56
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.55, ptr noundef nonnull %32) #2
  br label %55

34:                                               ; preds = %.lr.ph
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.58) #2
  %36 = getelementptr inbounds i8, ptr %7, i64 16
  %37 = load i64, ptr %36, align 8, !tbaa !15
  %38 = getelementptr inbounds i8, ptr %0, i64 %37
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %.not = icmp eq ptr %39, null
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  br i1 %.not, label %43, label %41

41:                                               ; preds = %34
  %42 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.59, ptr noundef nonnull %39) #2
  br label %55

43:                                               ; preds = %34
  %44 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.26) #2
  br label %55

45:                                               ; preds = %.lr.ph
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.60) #2
  br label %55

47:                                               ; preds = %.lr.ph
  %48 = getelementptr inbounds i8, ptr %7, i64 16
  %49 = load i64, ptr %48, align 8, !tbaa !15
  %50 = getelementptr inbounds i8, ptr %0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !19
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.61, i64 noundef %51) #2
  br label %55

53:                                               ; preds = %.lr.ph
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.62, i32 noundef %13) #2
  br label %55

55:                                               ; preds = %15, %21, %27, %45, %47, %53, %43, %41
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %55, %3
  ret void
}

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 = { cold 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, !6, i64 0}
!10 = !{!"config_param_s", !6, i64 0, !11, i64 8, !12, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !12, i64 16}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!11, !11, i64 0}
!19 = !{!12, !12, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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