; LLVM IR from marcinbor85/microshell :: src/src (ush_autocomp_utils)

; 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.ush_object = type { ptr, i32, i32, i32, ptr, i64, i64, i32, i64, i64, i64, i8, ptr, ptr, ptr, %struct.ush_node_object, ptr, ptr, ptr, i64, i64, ptr, i64, i32, i32, ptr, ptr, ptr, i64, i64, i64 }
%struct.ush_node_object = type { ptr, i64, ptr, ptr, ptr, ptr }
%struct.ush_file_descriptor = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ush_autocomp_process_file_index(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.ush_object, ptr %5, i32 0, i32 19
  %7 = load i64, ptr %6, align 8, !tbaa !9
  switch i64 %7, label %124 [
    i64 0, label %8
    i64 1, label %76
    i64 2, label %89
  ]

8:                                                ; preds = %2
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ush_object, ptr %9, i32 0, i32 23
  %11 = load i32, ptr %10, align 8, !tbaa !15
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %18, label %13

13:                                               ; preds = %8
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ush_object, ptr %14, i32 0, i32 23
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %18, label %43

18:                                               ; preds = %13, %8
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ush_object, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 8, !tbaa !16
  %22 = icmp eq i32 %21, 21
  br i1 %22, label %23, label %31

23:                                               ; preds = %18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ush_file_descriptor, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !17
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ush_object, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !16
  call void @ush_write_pointer(ptr noundef %24, ptr noundef %27, i32 noundef %30)
  br label %31

31:                                               ; preds = %23, %18
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ush_object, ptr %32, i32 0, i32 19
  store i64 1, ptr %33, align 8, !tbaa !9
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ush_object, ptr %34, i32 0, i32 28
  %36 = load i64, ptr %35, align 8, !tbaa !19
  %37 = add i64 %36, 1
  store i64 %37, ptr %35, align 8, !tbaa !19
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ush_file_descriptor, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ush_object, ptr %41, i32 0, i32 26
  store ptr %40, ptr %42, align 8, !tbaa !20
  br label %75

43:                                               ; preds = %13
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ush_object, ptr %44, i32 0, i32 23
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %48, label %73

48:                                               ; preds = %43
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ush_object, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !16
  %52 = icmp eq i32 %51, 21
  br i1 %52, label %53, label %61

53:                                               ; preds = %48
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ush_object, ptr %55, i32 0, i32 27
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ush_object, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !16
  call void @ush_write_pointer(ptr noundef %54, ptr noundef %57, i32 noundef %60)
  br label %61

61:                                               ; preds = %53, %48
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ush_object, ptr %62, i32 0, i32 19
  store i64 1, ptr %63, align 8, !tbaa !9
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ush_object, ptr %64, i32 0, i32 28
  %66 = load i64, ptr %65, align 8, !tbaa !19
  %67 = add i64 %66, 1
  store i64 %67, ptr %65, align 8, !tbaa !19
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ush_object, ptr %68, i32 0, i32 27
  %70 = load ptr, ptr %69, align 8, !tbaa !21
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ush_object, ptr %71, i32 0, i32 26
  store ptr %70, ptr %72, align 8, !tbaa !20
  br label %74

73:                                               ; preds = %43
  br label %74

74:                                               ; preds = %73, %61
  br label %75

75:                                               ; preds = %74, %31
  br label %125

76:                                               ; preds = %2
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ush_object, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !16
  %80 = icmp eq i32 %79, 21
  br i1 %80, label %81, label %86

81:                                               ; preds = %76
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ush_object, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !16
  call void @ush_write_pointer(ptr noundef %82, ptr noundef @.str, i32 noundef %85)
  br label %86

86:                                               ; preds = %81, %76
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ush_object, ptr %87, i32 0, i32 19
  store i64 2, ptr %88, align 8, !tbaa !9
  br label %125

89:                                               ; preds = %2
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ush_object, ptr %90, i32 0, i32 23
  %92 = load i32, ptr %91, align 8, !tbaa !15
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %99, label %94

94:                                               ; preds = %89
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ush_object, ptr %95, i32 0, i32 23
  %97 = load i32, ptr %96, align 8, !tbaa !15
  %98 = icmp eq i32 %97, 1
  br i1 %98, label %99, label %106

99:                                               ; preds = %94, %89
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ush_object, ptr %100, i32 0, i32 20
  %102 = load i64, ptr %101, align 8, !tbaa !22
  %103 = add i64 %102, 1
  store i64 %103, ptr %101, align 8, !tbaa !22
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ush_object, ptr %104, i32 0, i32 19
  store i64 0, ptr %105, align 8, !tbaa !9
  br label %123

106:                                              ; preds = %94
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.ush_object, ptr %107, i32 0, i32 23
  %109 = load i32, ptr %108, align 8, !tbaa !15
  %110 = icmp eq i32 %109, 2
  br i1 %110, label %111, label %121

111:                                              ; preds = %106
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.ush_object, ptr %112, i32 0, i32 16
  %114 = load ptr, ptr %113, align 8, !tbaa !23
  %115 = getelementptr inbounds %struct.ush_node_object, ptr %114, i32 0, i32 5
  %116 = load ptr, ptr %115, align 8, !tbaa !24
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ush_object, ptr %117, i32 0, i32 16
  store ptr %116, ptr %118, align 8, !tbaa !23
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ush_object, ptr %119, i32 0, i32 19
  store i64 0, ptr %120, align 8, !tbaa !9
  br label %122

121:                                              ; preds = %106
  br label %122

122:                                              ; preds = %121, %111
  br label %123

123:                                              ; preds = %122, %99
  br label %125

124:                                              ; preds = %2
  br label %125

125:                                              ; preds = %124, %123, %86, %75
  ret void
}

declare void @ush_write_pointer(ptr noundef, ptr noundef, i32 noundef) #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 = { "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" }

!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, !12, i64 184}
!10 = !{!"ush_object", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !12, i64 32, !12, i64 40, !11, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !13, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !14, i64 112, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !12, i64 192, !6, i64 200, !12, i64 208, !11, i64 216, !11, i64 220, !6, i64 224, !6, i64 232, !6, i64 240, !12, i64 248, !12, i64 256, !12, i64 264}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!"ush_node_object", !6, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!10, !11, i64 216}
!16 = !{!10, !11, i64 8}
!17 = !{!18, !6, i64 0}
!18 = !{!"ush_file_descriptor", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!19 = !{!10, !12, i64 248}
!20 = !{!10, !6, i64 232}
!21 = !{!10, !6, i64 240}
!22 = !{!10, !12, i64 192}
!23 = !{!10, !6, i64 160}
!24 = !{!14, !6, i64 40}


; 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 [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ush_autocomp_process_file_index(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 184
  %4 = load i64, ptr %3, align 8, !tbaa !5
  switch i64 %4, label %52 [
    i64 0, label %5
    i64 1, label %34
    i64 2, label %40
  ]

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 216
  %7 = load i32, ptr %6, align 8, !tbaa !14
  switch i32 %7, label %52 [
    i32 0, label %8
    i32 1, label %8
    i32 2, label %20
  ]

8:                                                ; preds = %5, %5
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !15
  %11 = icmp eq i32 %10, 21
  br i1 %11, label %12, label %14

12:                                               ; preds = %8
  %13 = load ptr, ptr %1, align 8, !tbaa !16
  tail call void @ush_write_pointer(ptr noundef nonnull %0, ptr noundef %13, i32 noundef 21) #2
  br label %14

14:                                               ; preds = %12, %8
  store i64 1, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 248
  %16 = load i64, ptr %15, align 8, !tbaa !18
  %17 = add i64 %16, 1
  store i64 %17, ptr %15, align 8, !tbaa !18
  %18 = load ptr, ptr %1, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr %18, ptr %19, align 8, !tbaa !19
  br label %52

20:                                               ; preds = %5
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !15
  %23 = icmp eq i32 %22, 21
  br i1 %23, label %24, label %27

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 240
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @ush_write_pointer(ptr noundef nonnull %0, ptr noundef %26, i32 noundef 21) #2
  br label %27

27:                                               ; preds = %24, %20
  store i64 1, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 248
  %29 = load i64, ptr %28, align 8, !tbaa !18
  %30 = add i64 %29, 1
  store i64 %30, ptr %28, align 8, !tbaa !18
  %31 = getelementptr inbounds i8, ptr %0, i64 240
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  %33 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr %32, ptr %33, align 8, !tbaa !19
  br label %52

34:                                               ; preds = %2
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !15
  %37 = icmp eq i32 %36, 21
  br i1 %37, label %38, label %39

38:                                               ; preds = %34
  tail call void @ush_write_pointer(ptr noundef nonnull %0, ptr noundef nonnull @.str, i32 noundef 21) #2
  br label %39

39:                                               ; preds = %38, %34
  store i64 2, ptr %3, align 8, !tbaa !5
  br label %52

40:                                               ; preds = %2
  %41 = getelementptr inbounds i8, ptr %0, i64 216
  %42 = load i32, ptr %41, align 8, !tbaa !14
  switch i32 %42, label %52 [
    i32 0, label %43
    i32 1, label %43
    i32 2, label %47
  ]

43:                                               ; preds = %40, %40
  %44 = getelementptr inbounds i8, ptr %0, i64 192
  %45 = load i64, ptr %44, align 8, !tbaa !21
  %46 = add i64 %45, 1
  store i64 %46, ptr %44, align 8, !tbaa !21
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %52

47:                                               ; preds = %40
  %48 = getelementptr inbounds i8, ptr %0, i64 160
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  %50 = getelementptr inbounds i8, ptr %49, i64 40
  %51 = load ptr, ptr %50, align 8, !tbaa !23
  store ptr %51, ptr %48, align 8, !tbaa !22
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %40, %5, %2, %43, %47, %14, %27, %39
  ret void
}

declare void @ush_write_pointer(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #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 = { "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 }

!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 184}
!6 = !{!"ush_object", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 24, !11, i64 32, !11, i64 40, !10, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !12, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !13, i64 112, !7, i64 160, !7, i64 168, !7, i64 176, !11, i64 184, !11, i64 192, !7, i64 200, !11, i64 208, !10, i64 216, !10, i64 220, !7, i64 224, !7, i64 232, !7, i64 240, !11, i64 248, !11, i64 256, !11, i64 264}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!"ush_node_object", !7, i64 0, !11, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!14 = !{!6, !10, i64 216}
!15 = !{!6, !10, i64 8}
!16 = !{!17, !7, i64 0}
!17 = !{!"ush_file_descriptor", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!18 = !{!6, !11, i64 248}
!19 = !{!6, !7, i64 232}
!20 = !{!6, !7, i64 240}
!21 = !{!6, !11, i64 192}
!22 = !{!6, !7, i64 160}
!23 = !{!13, !7, i64 40}


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