; LLVM IR from ponylang/ponyc :: src/libponyc/pkg (use)

; 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.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@__func__.use_command = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 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 uwtable
define dso_local i32 @use_command(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [4 x ptr], align 16
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  br label %15

14:                                               ; preds = %2
  call void @ponyint_assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i64 noundef 163, ptr noundef @__func__.use_command)
  br label %15

15:                                               ; preds = %14, %13
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  br label %20

19:                                               ; preds = %15
  call void @ponyint_assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i64 noundef 164, ptr noundef @__func__.use_command)
  br label %20

20:                                               ; preds = %19, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #3
  store ptr %6, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds ptr, ptr %9, i64 1
  store ptr %7, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds ptr, ptr %9, i64 2
  store ptr %8, ptr %22, align 8, !tbaa !5
  %23 = getelementptr inbounds ptr, ptr %9, i64 3
  store ptr null, ptr %23, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 0
  call void @ast_get_children(ptr noundef %24, i64 noundef 3, ptr noundef %25)
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #3
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %20
  br label %30

29:                                               ; preds = %20
  call void @ponyint_assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i64 noundef 167, ptr noundef @__func__.use_command)
  br label %30

30:                                               ; preds = %29, %28
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  br label %35

34:                                               ; preds = %30
  call void @ponyint_assert_fail(ptr noundef @.str.5, ptr noundef @.str.2, i64 noundef 168, ptr noundef @__func__.use_command)
  br label %35

35:                                               ; preds = %34, %33
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = call i32 @ast_id(ptr noundef %36)
  switch i32 %37, label %53 [
    i32 5, label %38
    i32 142, label %47
  ]

38:                                               ; preds = %35
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = call zeroext i1 @uri_command(ptr noundef %39, ptr noundef %40, ptr noundef %41, ptr noundef %42, ptr noundef %43)
  br i1 %44, label %46, label %45

45:                                               ; preds = %38
  store i32 2, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %55

46:                                               ; preds = %38
  br label %54

47:                                               ; preds = %35
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = call zeroext i1 @ffi_command(ptr noundef %48, ptr noundef %49)
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 2, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %55

52:                                               ; preds = %47
  br label %54

53:                                               ; preds = %35
  call void @ponyint_assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i64 noundef 185, ptr noundef @__func__.use_command)
  store i32 2, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %55

54:                                               ; preds = %52, %46
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %55

55:                                               ; preds = %54, %53, %51, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %56 = load i32, ptr %3, align 4
  ret i32 %56
}

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) #2

declare i32 @ast_id(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @uri_command(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @ffi_command(ptr noundef, ptr noundef) #1

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


; 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.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@__func__.use_command = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @use_command(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [4 x ptr], align 16
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %2
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i64 noundef 163, ptr noundef nonnull @__func__.use_command) #3
  br label %8

8:                                                ; preds = %2, %7
  %.not6 = icmp eq ptr %1, null
  br i1 %.not6, label %9, label %10

9:                                                ; preds = %8
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i64 noundef 164, ptr noundef nonnull @__func__.use_command) #3
  br label %10

10:                                               ; preds = %8, %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #3
  store ptr %3, ptr %6, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %4, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr %5, ptr %12, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %6, i64 24
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @ast_get_children(ptr noundef %0, i64 noundef 3, ptr noundef nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %.not7 = icmp eq ptr %14, null
  br i1 %.not7, label %15, label %16

15:                                               ; preds = %10
  call void @ponyint_assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i64 noundef 167, ptr noundef nonnull @__func__.use_command) #3
  br label %16

16:                                               ; preds = %10, %15
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %.not8 = icmp eq ptr %17, null
  br i1 %.not8, label %18, label %19

18:                                               ; preds = %16
  call void @ponyint_assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i64 noundef 168, ptr noundef nonnull @__func__.use_command) #3
  br label %19

19:                                               ; preds = %16, %18
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call i32 @ast_id(ptr noundef %20) #3
  switch i32 %21, label %30 [
    i32 5, label %22
    i32 142, label %27
  ]

22:                                               ; preds = %19
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call zeroext i1 @uri_command(ptr noundef %1, ptr noundef %0, ptr noundef %23, ptr noundef %24, ptr noundef %25)
  br i1 %26, label %31, label %32

27:                                               ; preds = %19
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call zeroext i1 @ffi_command(ptr noundef %1, ptr noundef %28)
  br i1 %29, label %31, label %32

30:                                               ; preds = %19
  call void @ponyint_assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i64 noundef 185, ptr noundef nonnull @__func__.use_command) #3
  br label %32

31:                                               ; preds = %27, %22
  br label %32

32:                                               ; preds = %27, %22, %31, %30
  %.0 = phi i32 [ 2, %30 ], [ 0, %31 ], [ 2, %22 ], [ 2, %27 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i32 %.0
}

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ast_id(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @uri_command(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @ffi_command(ptr noundef, ptr noundef) local_unnamed_addr #1

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


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