; LLVM IR from clibs/clib :: src (clib-install)

; 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.debug_t = type { ptr, i32, i32, ptr }
%struct.options = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.clib_package_opts_t = type { i32, i32, i32, ptr, i32, ptr }
%struct.command = type { ptr, ptr, ptr, ptr, ptr, i32, [32 x %struct.command_option_t], i32, [32 x ptr], ptr }
%struct.command_option_t = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.clib_package_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@debugger = external dso_local global %struct.debug_t, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@opts = external hidden global %struct.options, align 8
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [13 x i8], align 1
@stderr = external global ptr, align 8
@.str.38 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [2 x i8], align 1
@root_package = external hidden global ptr, align 8
@package_opts = external hidden global %struct.clib_package_opts_t, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %struct.command, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr @.str, ptr @opts, align 8, !tbaa !11
  store i32 1, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 3), align 8, !tbaa !13
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 4), align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  store i64 4096, ptr %6, align 8, !tbaa !15
  %13 = call i32 @debug_init(ptr noundef @debugger, ptr noundef @.str.1)
  %14 = call i32 @clib_cache_init(i64 noundef 2592000)
  call void @llvm.lifetime.start.p0(i64 2112, ptr %7) #9
  call void @command_init(ptr noundef %7, ptr noundef @.str.1, ptr noundef @.str.2)
  %15 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 1
  store ptr @.str.3, ptr %15, align 8, !tbaa !17
  call void @command_option(ptr noundef %7, ptr noundef @.str.4, ptr noundef @.str.5, ptr noundef @.str.6, ptr noundef @setopt_dir)
  call void @command_option(ptr noundef %7, ptr noundef @.str.7, ptr noundef @.str.8, ptr noundef @.str.9, ptr noundef @setopt_prefix)
  call void @command_option(ptr noundef %7, ptr noundef @.str.10, ptr noundef @.str.11, ptr noundef @.str.12, ptr noundef @setopt_quiet)
  call void @command_option(ptr noundef %7, ptr noundef @.str.13, ptr noundef @.str.14, ptr noundef @.str.15, ptr noundef @setopt_dev)
  call void @command_option(ptr noundef %7, ptr noundef @.str.16, ptr noundef @.str.17, ptr noundef @.str.18, ptr noundef @setopt_save)
  call void @command_option(ptr noundef %7, ptr noundef @.str.19, ptr noundef @.str.20, ptr noundef @.str.21, ptr noundef @setopt_savedev)
  call void @command_option(ptr noundef %7, ptr noundef @.str.22, ptr noundef @.str.23, ptr noundef @.str.24, ptr noundef @setopt_nosave)
  call void @command_option(ptr noundef %7, ptr noundef @.str.25, ptr noundef @.str.26, ptr noundef @.str.27, ptr noundef @setopt_force)
  call void @command_option(ptr noundef %7, ptr noundef @.str.28, ptr noundef @.str.29, ptr noundef @.str.30, ptr noundef @setopt_skip_cache)
  call void @command_option(ptr noundef %7, ptr noundef @.str.31, ptr noundef @.str.32, ptr noundef @.str.33, ptr noundef @setopt_global)
  call void @command_option(ptr noundef %7, ptr noundef @.str.34, ptr noundef @.str.35, ptr noundef @.str.36, ptr noundef @setopt_token)
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  call void @command_parse(ptr noundef %7, i32 noundef %16, ptr noundef %17)
  %18 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %19 = load i32, ptr %18, align 8, !tbaa !19
  call void (ptr, ptr, ...) @debug(ptr noundef @debugger, ptr noundef @.str.37, i32 noundef %19)
  %20 = call i32 @curl_global_init(i64 noundef 3)
  %21 = icmp ne i32 0, %20
  br i1 %21, label %22, label %32

22:                                               ; preds = %2
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = call i32 (i32, ptr, ptr, ...) @cc_fprintf(i32 noundef 2, ptr noundef %23, ptr noundef @.str.38, ptr noundef @.str.39)
  %25 = load ptr, ptr @stderr, align 8, !tbaa !9
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.40) #9
  %27 = load ptr, ptr @stderr, align 8, !tbaa !9
  %28 = call i32 (i32, ptr, ptr, ...) @cc_fprintf(i32 noundef 9, ptr noundef %27, ptr noundef @.str.41)
  %29 = load ptr, ptr @stderr, align 8, !tbaa !9
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef @.str.42) #9
  store i32 %30, ptr %8, align 4, !tbaa !5
  %31 = load i32, ptr %8, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %22, %2
  %33 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 3), align 8, !tbaa !13
  %34 = call ptr @clib_package_load_local_manifest(i32 noundef %33)
  store ptr %34, ptr @root_package, align 8, !tbaa !9
  %35 = load ptr, ptr @root_package, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %49

37:                                               ; preds = %32
  %38 = load ptr, ptr @root_package, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.clib_package_t, ptr %38, i32 0, i32 14
  %40 = load ptr, ptr %39, align 8, !tbaa !20
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %49

42:                                               ; preds = %37
  %43 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %44 = icmp ne ptr %43, null
  br i1 %44, label %49, label %45

45:                                               ; preds = %42
  %46 = load ptr, ptr @root_package, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.clib_package_t, ptr %46, i32 0, i32 14
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  store ptr %48, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  br label %49

49:                                               ; preds = %45, %42, %37, %32
  %50 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %70

52:                                               ; preds = %49
  %53 = load i64, ptr %6, align 8, !tbaa !15
  %54 = call ptr @llvm.stacksave.p0()
  store ptr %54, ptr %9, align 8
  %55 = alloca i8, i64 %53, align 16
  store i64 %53, ptr %10, align 8
  %56 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %57 = call i32 @mkdirp(ptr noundef %56, i32 noundef 511)
  %58 = load i64, ptr %6, align 8, !tbaa !15
  call void @llvm.memset.p0.i64(ptr align 16 %55, i8 0, i64 %58, i1 false)
  %59 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %60 = call ptr @realpath(ptr noundef %59, ptr noundef %55) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %61 = call i64 @strlen(ptr noundef %55) #10
  %62 = add i64 %61, 1
  store i64 %62, ptr %11, align 8, !tbaa !15
  %63 = load i64, ptr %11, align 8, !tbaa !15
  %64 = call noalias ptr @malloc(i64 noundef %63) #11
  store ptr %64, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %65 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %66 = load i64, ptr %11, align 8, !tbaa !15
  call void @llvm.memset.p0.i64(ptr align 1 %65, i8 0, i64 %66, i1 false)
  %67 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  %68 = load i64, ptr %11, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %67, ptr align 16 %55, i64 %68, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  %69 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %69)
  br label %70

70:                                               ; preds = %52, %49
  %71 = call i32 @clib_cache_init(i64 noundef 2592000)
  %72 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 9), align 8, !tbaa !23
  store i32 %72, ptr @package_opts, align 8, !tbaa !24
  %73 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !22
  store ptr %73, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 3), align 8, !tbaa !26
  %74 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 8), align 4, !tbaa !27
  store i32 %74, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 2), align 8, !tbaa !28
  %75 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 7), align 8, !tbaa !29
  store i32 %75, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 1), align 4, !tbaa !30
  %76 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 2), align 8, !tbaa !31
  store ptr %76, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 5), align 8, !tbaa !32
  call void @clib_package_set_opts(ptr noundef byval(%struct.clib_package_opts_t) align 8 @package_opts)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %77 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %78 = load i32, ptr %77, align 8, !tbaa !19
  %79 = icmp eq i32 0, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %70
  %81 = call i32 @install_local_packages()
  br label %88

82:                                               ; preds = %70
  %83 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %84 = load i32, ptr %83, align 8, !tbaa !19
  %85 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 8
  %86 = getelementptr inbounds [32 x ptr], ptr %85, i64 0, i64 0
  %87 = call i32 @install_packages(i32 noundef %84, ptr noundef %86)
  br label %88

88:                                               ; preds = %82, %80
  %89 = phi i32 [ %81, %80 ], [ %87, %82 ]
  store i32 %89, ptr %12, align 4, !tbaa !5
  call void @curl_global_cleanup()
  call void (...) @clib_package_cleanup()
  call void @command_free(ptr noundef %7)
  %90 = load i32, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 2112, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  ret i32 %90
}

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

declare i32 @debug_init(ptr noundef, ptr noundef) #2

declare i32 @clib_cache_init(i64 noundef) #2

declare void @command_init(ptr noundef, ptr noundef, ptr noundef) #2

declare void @command_option(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @setopt_dir(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_prefix(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_quiet(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_dev(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_save(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_savedev(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_nosave(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_force(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_skip_cache(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_global(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_token(ptr noundef) #0

declare void @command_parse(ptr noundef, i32 noundef, ptr noundef) #2

declare void @debug(ptr noundef, ptr noundef, ...) #2

declare i32 @curl_global_init(i64 noundef) #2

declare i32 @cc_fprintf(i32 noundef, ptr noundef, ptr noundef, ...) #2

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

declare ptr @clib_package_load_local_manifest(i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

declare i32 @mkdirp(ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind
declare ptr @realpath(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #7

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

declare void @clib_package_set_opts(ptr noundef byval(%struct.clib_package_opts_t) align 8) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @install_packages(i32 noundef, ptr noundef) #0

declare void @curl_global_cleanup() #2

declare void @clib_package_cleanup(...) #2

declare void @command_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @install_local_packages() #0

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 = { "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 "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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn 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 #7 = { nounwind allocsize(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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"options", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48}
!13 = !{!12, !6, i64 24}
!14 = !{!12, !6, i64 28}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !10, i64 8}
!18 = !{!"command", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !7, i64 48, !6, i64 1840, !7, i64 1848, !10, i64 2104}
!19 = !{!18, !6, i64 1840}
!20 = !{!21, !10, i64 112}
!21 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !6, i64 152}
!22 = !{!12, !10, i64 8}
!23 = !{!12, !6, i64 48}
!24 = !{!25, !6, i64 0}
!25 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!26 = !{!25, !10, i64 16}
!27 = !{!12, !6, i64 44}
!28 = !{!25, !6, i64 8}
!29 = !{!12, !6, i64 40}
!30 = !{!25, !6, i64 4}
!31 = !{!12, !10, i64 16}
!32 = !{!25, !10, i64 32}


; 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.debug_t = type { ptr, i32, i32, ptr }
%struct.options = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.clib_package_opts_t = type { i32, i32, i32, ptr, i32, ptr }
%struct.command = type { ptr, ptr, ptr, ptr, ptr, i32, [32 x %struct.command_option_t], i32, [32 x ptr], ptr }
%struct.command_option_t = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }

@debugger = external dso_local global %struct.debug_t, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@opts = external hidden local_unnamed_addr global %struct.options, align 8
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [13 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.38 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [2 x i8], align 1
@root_package = external hidden local_unnamed_addr global ptr, align 8
@package_opts = external hidden global %struct.clib_package_opts_t, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.command, align 8
  store ptr @.str, ptr @opts, align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !11
  store i32 0, ptr getelementptr inbounds (i8, ptr @opts, i64 28), align 4, !tbaa !12
  %4 = tail call i32 @debug_init(ptr noundef nonnull @debugger, ptr noundef nonnull @.str.1) #9
  %5 = tail call i32 @clib_cache_init(i64 noundef 2592000) #9
  call void @llvm.lifetime.start.p0(i64 2112, ptr nonnull %3) #9
  call void @command_init(ptr noundef nonnull %3, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2) #9
  %6 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr @.str.3, ptr %6, align 8, !tbaa !13
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, ptr noundef nonnull @setopt_dir) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, ptr noundef nonnull @setopt_prefix) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, ptr noundef nonnull @setopt_quiet) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, ptr noundef nonnull @setopt_dev) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.18, ptr noundef nonnull @setopt_save) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, ptr noundef nonnull @setopt_savedev) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.24, ptr noundef nonnull @setopt_nosave) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.27, ptr noundef nonnull @setopt_force) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.28, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, ptr noundef nonnull @setopt_skip_cache) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.31, ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.33, ptr noundef nonnull @setopt_global) #9
  call void @command_option(ptr noundef nonnull %3, ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.36, ptr noundef nonnull @setopt_token) #9
  call void @command_parse(ptr noundef nonnull %3, i32 noundef %0, ptr noundef %1) #9
  %7 = getelementptr inbounds i8, ptr %3, i64 1840
  %8 = load i32, ptr %7, align 8, !tbaa !15
  call void (ptr, ptr, ...) @debug(ptr noundef nonnull @debugger, ptr noundef nonnull @.str.37, i32 noundef %8) #9
  %9 = call i32 @curl_global_init(i64 noundef 3) #9
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %19, label %10

10:                                               ; preds = %2
  %11 = load ptr, ptr @stderr, align 8, !tbaa !16
  %12 = call i32 (i32, ptr, ptr, ...) @cc_fprintf(i32 noundef 2, ptr noundef %11, ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.39) #9
  %13 = load ptr, ptr @stderr, align 8, !tbaa !16
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.40) #10
  %15 = load ptr, ptr @stderr, align 8, !tbaa !16
  %16 = call i32 (i32, ptr, ptr, ...) @cc_fprintf(i32 noundef 9, ptr noundef %15, ptr noundef nonnull @.str.41) #9
  %17 = load ptr, ptr @stderr, align 8, !tbaa !16
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.42) #10
  br label %19

19:                                               ; preds = %10, %2
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !11
  %21 = call ptr @clib_package_load_local_manifest(i32 noundef %20) #9
  store ptr %21, ptr @root_package, align 8, !tbaa !16
  %.not12 = icmp eq ptr %21, null
  br i1 %.not12, label %thread-pre-split, label %22

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %21, i64 112
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = icmp eq ptr %24, null
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8
  %27 = icmp ne ptr %26, null
  %or.cond = select i1 %25, i1 true, i1 %27
  br i1 %or.cond, label %28, label %.thread

.thread:                                          ; preds = %22
  store ptr %24, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  br label %30

thread-pre-split:                                 ; preds = %19
  %.pr = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  br label %28

28:                                               ; preds = %thread-pre-split, %22
  %29 = phi ptr [ %.pr, %thread-pre-split ], [ %26, %22 ]
  %.not13 = icmp eq ptr %29, null
  br i1 %.not13, label %39, label %30

30:                                               ; preds = %.thread, %28
  %31 = call ptr @llvm.stacksave.p0()
  %32 = alloca [4096 x i8], align 16
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  %34 = call i32 @mkdirp(ptr noundef %33, i32 noundef 511) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4096) %32, i8 0, i64 4096, i1 false)
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  %36 = call ptr @realpath(ptr noundef %35, ptr noundef nonnull %32) #9
  %37 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %32) #11
  %38 = add i64 %37, 1
  %calloc = call ptr @calloc(i64 1, i64 %38)
  store ptr %calloc, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %calloc, ptr nonnull align 16 %32, i64 %38, i1 false)
  call void @llvm.stackrestore.p0(ptr %31)
  br label %39

39:                                               ; preds = %30, %28
  %40 = call i32 @clib_cache_init(i64 noundef 2592000) #9
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 48), align 8, !tbaa !20
  store i32 %41, ptr @package_opts, align 8, !tbaa !21
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !19
  store ptr %42, ptr getelementptr inbounds (i8, ptr @package_opts, i64 16), align 8, !tbaa !23
  %43 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @opts, i64 40), align 8, !tbaa !24
  store <2 x i32> %43, ptr getelementptr inbounds (i8, ptr @package_opts, i64 4), align 4, !tbaa !24
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 16), align 8, !tbaa !25
  store ptr %44, ptr getelementptr inbounds (i8, ptr @package_opts, i64 32), align 8, !tbaa !26
  call void @clib_package_set_opts(ptr noundef nonnull byval(%struct.clib_package_opts_t) align 8 @package_opts) #9
  %45 = load i32, ptr %7, align 8, !tbaa !15
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %49

47:                                               ; preds = %39
  %48 = call i32 @install_local_packages()
  br label %52

49:                                               ; preds = %39
  %50 = getelementptr inbounds i8, ptr %3, i64 1848
  %51 = call i32 @install_packages(i32 noundef %45, ptr noundef nonnull %50)
  br label %52

52:                                               ; preds = %49, %47
  %53 = phi i32 [ %48, %47 ], [ %51, %49 ]
  call void @curl_global_cleanup() #9
  call void (...) @clib_package_cleanup() #9
  call void @command_free(ptr noundef nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 2112, ptr nonnull %3) #9
  ret i32 %53
}

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

declare i32 @debug_init(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @clib_cache_init(i64 noundef) local_unnamed_addr #2

declare void @command_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @command_option(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @setopt_dir(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_prefix(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_quiet(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_dev(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_save(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_savedev(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_nosave(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_force(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_skip_cache(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_global(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @setopt_token(ptr noundef) #0

declare void @command_parse(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @debug(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

declare i32 @curl_global_init(i64 noundef) local_unnamed_addr #2

declare i32 @cc_fprintf(i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare ptr @clib_package_load_local_manifest(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

declare i32 @mkdirp(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

declare void @clib_package_set_opts(ptr noundef byval(%struct.clib_package_opts_t) align 8) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @install_packages(i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @curl_global_cleanup() local_unnamed_addr #2

declare void @clib_package_cleanup(...) local_unnamed_addr #2

declare void @command_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @install_local_packages() local_unnamed_addr #0

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #8

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 nocallback nofree nosync nounwind willreturn }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { 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, !7, i64 0}
!6 = !{!"options", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !10, i64 28}
!13 = !{!14, !7, i64 8}
!14 = !{!"command", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !8, i64 48, !10, i64 1840, !8, i64 1848, !7, i64 2104}
!15 = !{!14, !10, i64 1840}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !7, i64 112}
!18 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !10, i64 152}
!19 = !{!6, !7, i64 8}
!20 = !{!6, !10, i64 48}
!21 = !{!22, !10, i64 0}
!22 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32}
!23 = !{!22, !7, i64 16}
!24 = !{!10, !10, i64 0}
!25 = !{!6, !7, i64 16}
!26 = !{!22, !7, i64 32}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass