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

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

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@stderr = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [83 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @config_file() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [4096 x i8], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4096, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %7 = call ptr @getenv(ptr noundef @.str) #3
  store ptr %7, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %35

10:                                               ; preds = %0
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = sext i8 %12 to i32
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %35

15:                                               ; preds = %10
  %16 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %16, i64 noundef 4096, ptr noundef @.str.1, ptr noundef %17) #3
  store i32 %18, ptr %5, align 4, !tbaa !10
  %19 = load i32, ptr %5, align 4, !tbaa !10
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store ptr null, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

22:                                               ; preds = %15
  %23 = load i32, ptr %5, align 4, !tbaa !10
  %24 = sext i32 %23 to i64
  %25 = icmp uge i64 %24, 4096
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  br label %84

27:                                               ; preds = %22
  %28 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %29 = call i32 @access(ptr noundef %28, i32 noundef 0) #3
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %27
  %32 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %33 = call noalias ptr @strdup(ptr noundef %32) #3
  store ptr %33, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

34:                                               ; preds = %27
  br label %35

35:                                               ; preds = %34, %10, %0
  %36 = call ptr @getenv(ptr noundef @.str.2) #3
  store ptr %36, ptr %3, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %83

39:                                               ; preds = %35
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = sext i8 %41 to i32
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %83

44:                                               ; preds = %39
  %45 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %45, i64 noundef 4096, ptr noundef @.str.3, ptr noundef %46) #3
  store i32 %47, ptr %5, align 4, !tbaa !10
  %48 = load i32, ptr %5, align 4, !tbaa !10
  %49 = icmp slt i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %44
  store ptr null, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

51:                                               ; preds = %44
  %52 = load i32, ptr %5, align 4, !tbaa !10
  %53 = sext i32 %52 to i64
  %54 = icmp uge i64 %53, 4096
  br i1 %54, label %55, label %56

55:                                               ; preds = %51
  br label %84

56:                                               ; preds = %51
  %57 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %58 = call i32 @access(ptr noundef %57, i32 noundef 0) #3
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %63

60:                                               ; preds = %56
  %61 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %62 = call noalias ptr @strdup(ptr noundef %61) #3
  store ptr %62, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

63:                                               ; preds = %56
  %64 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %64, i64 noundef 4096, ptr noundef @.str.4, ptr noundef %65) #3
  store i32 %66, ptr %5, align 4, !tbaa !10
  %67 = load i32, ptr %5, align 4, !tbaa !10
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %63
  store ptr null, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

70:                                               ; preds = %63
  %71 = load i32, ptr %5, align 4, !tbaa !10
  %72 = sext i32 %71 to i64
  %73 = icmp uge i64 %72, 4096
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %84

75:                                               ; preds = %70
  %76 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %77 = call i32 @access(ptr noundef %76, i32 noundef 0) #3
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %82

79:                                               ; preds = %75
  %80 = getelementptr inbounds [4096 x i8], ptr %4, i64 0, i64 0
  %81 = call noalias ptr @strdup(ptr noundef %80) #3
  store ptr %81, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

82:                                               ; preds = %75
  br label %83

83:                                               ; preds = %82, %39, %35
  store ptr null, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

84:                                               ; preds = %74, %55, %26
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.5, i64 noundef 4096) #3
  store ptr null, ptr %1, align 8
  store i32 1, ptr %6, align 4
  br label %87

87:                                               ; preds = %84, %83, %79, %69, %60, %50, %31, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4096, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %88 = load ptr, ptr %1, align 8
  ret ptr %88
}

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

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind
declare i32 @access(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #2

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

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

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

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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"

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [83 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local noalias ptr @config_file() local_unnamed_addr #0 {
  %1 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %1) #5
  %2 = tail call ptr @getenv(ptr noundef nonnull @.str) #5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %15, label %3

3:                                                ; preds = %0
  %4 = load i8, ptr %2, align 1, !tbaa !5
  %.not18 = icmp eq i8 %4, 0
  br i1 %.not18, label %15, label %5

5:                                                ; preds = %3
  %6 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %1, i64 noundef 4096, ptr noundef nonnull @.str.1, ptr noundef nonnull %2) #5
  %7 = icmp slt i32 %6, 0
  br i1 %7, label %42, label %8

8:                                                ; preds = %5
  %9 = icmp ugt i32 %6, 4095
  br i1 %9, label %39, label %10

10:                                               ; preds = %8
  %11 = call i32 @access(ptr noundef nonnull %1, i32 noundef 0) #5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  %14 = call noalias ptr @strdup(ptr noundef nonnull %1) #5
  br label %42

15:                                               ; preds = %10, %3, %0
  %16 = tail call ptr @getenv(ptr noundef nonnull @.str.2) #5
  %.not19 = icmp eq ptr %16, null
  br i1 %.not19, label %42, label %17

17:                                               ; preds = %15
  %18 = load i8, ptr %16, align 1, !tbaa !5
  %.not20 = icmp eq i8 %18, 0
  br i1 %.not20, label %42, label %19

19:                                               ; preds = %17
  %20 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %1, i64 noundef 4096, ptr noundef nonnull @.str.3, ptr noundef nonnull %16) #5
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %42, label %22

22:                                               ; preds = %19
  %23 = icmp ugt i32 %20, 4095
  br i1 %23, label %39, label %24

24:                                               ; preds = %22
  %25 = call i32 @access(ptr noundef nonnull %1, i32 noundef 0) #5
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %24
  %28 = call noalias ptr @strdup(ptr noundef nonnull %1) #5
  br label %42

29:                                               ; preds = %24
  %30 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %1, i64 noundef 4096, ptr noundef nonnull @.str.4, ptr noundef nonnull %16) #5
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %42, label %32

32:                                               ; preds = %29
  %33 = icmp ugt i32 %30, 4095
  br i1 %33, label %39, label %34

34:                                               ; preds = %32
  %35 = call i32 @access(ptr noundef nonnull %1, i32 noundef 0) #5
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %42

37:                                               ; preds = %34
  %38 = call noalias ptr @strdup(ptr noundef nonnull %1) #5
  br label %42

39:                                               ; preds = %32, %22, %8
  %40 = load ptr, ptr @stderr, align 8, !tbaa !8
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.5, i64 noundef 4096) #6
  br label %42

42:                                               ; preds = %15, %17, %34, %29, %19, %5, %39, %37, %27, %13
  %.0 = phi ptr [ null, %39 ], [ %14, %13 ], [ %28, %27 ], [ %38, %37 ], [ null, %5 ], [ null, %19 ], [ null, %29 ], [ null, %34 ], [ null, %17 ], [ null, %15 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %1) #5
  ret ptr %.0
}

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

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #4

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind memory(read) "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 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


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