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

; 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 }
%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 [12 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 [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [13 x i8], align 1
@stderr = external global ptr, align 8
@.str.20 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1
@root_package = external hidden global ptr, align 8
@manifest_names = external global [0 x 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 ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = 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
  %16 = call i32 @debug_init(ptr noundef @debugger, ptr noundef @.str.1)
  %17 = 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)
  %18 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 1
  store ptr @.str.3, ptr %18, 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_token)
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  call void @command_parse(ptr noundef %7, i32 noundef %19, ptr noundef %20)
  %21 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %22 = load i32, ptr %21, align 8, !tbaa !19
  call void (ptr, ptr, ...) @debug(ptr noundef @debugger, ptr noundef @.str.19, i32 noundef %22)
  %23 = call i32 @curl_global_init(i64 noundef 3)
  %24 = icmp ne i32 0, %23
  br i1 %24, label %25, label %35

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

35:                                               ; preds = %25, %2
  %36 = load ptr, ptr @root_package, align 8, !tbaa !9
  %37 = icmp ne ptr %36, null
  br i1 %37, label %83, label %38

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %57, %38
  %40 = load i32, ptr %11, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds [0 x ptr], ptr @manifest_names, i64 0, i64 %41
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  store ptr %43, ptr %9, align 8, !tbaa !9
  %44 = load ptr, ptr %9, align 8, !tbaa !9
  %45 = call ptr @fs_read(ptr noundef %44)
  store ptr %45, ptr %10, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %39
  %47 = load i32, ptr %11, align 4, !tbaa !5
  %48 = add i32 %47, 1
  store i32 %48, ptr %11, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [0 x ptr], ptr @manifest_names, i64 0, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = icmp ne ptr null, %51
  br i1 %52, label %53, label %57

53:                                               ; preds = %46
  %54 = load ptr, ptr %10, align 8, !tbaa !9
  %55 = icmp ne ptr %54, null
  %56 = xor i1 %55, true
  br label %57

57:                                               ; preds = %53, %46
  %58 = phi i1 [ false, %46 ], [ %56, %53 ]
  br i1 %58, label %39, label %59, !llvm.loop !20

59:                                               ; preds = %57
  %60 = load ptr, ptr %10, align 8, !tbaa !9
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %82

62:                                               ; preds = %59
  %63 = load ptr, ptr %10, align 8, !tbaa !9
  %64 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 3), align 8, !tbaa !13
  %65 = call ptr @clib_package_new(ptr noundef %63, i32 noundef %64)
  store ptr %65, ptr @root_package, align 8, !tbaa !9
  %66 = load ptr, ptr @root_package, align 8, !tbaa !9
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %80

68:                                               ; preds = %62
  %69 = load ptr, ptr @root_package, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.clib_package_t, ptr %69, i32 0, i32 14
  %71 = load ptr, ptr %70, align 8, !tbaa !22
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %80

73:                                               ; preds = %68
  %74 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %75 = icmp ne ptr %74, null
  br i1 %75, label %80, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr @root_package, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.clib_package_t, ptr %77, i32 0, i32 14
  %79 = load ptr, ptr %78, align 8, !tbaa !22
  store ptr %79, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  br label %80

80:                                               ; preds = %76, %73, %68, %62
  %81 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %81) #9
  br label %82

82:                                               ; preds = %80, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %83

83:                                               ; preds = %82, %35
  %84 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %104

86:                                               ; preds = %83
  %87 = load i64, ptr %6, align 8, !tbaa !15
  %88 = call ptr @llvm.stacksave.p0()
  store ptr %88, ptr %12, align 8
  %89 = alloca i8, i64 %87, align 16
  store i64 %87, ptr %13, align 8
  %90 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %91 = call i32 @mkdirp(ptr noundef %90, i32 noundef 511)
  %92 = load i64, ptr %6, align 8, !tbaa !15
  call void @llvm.memset.p0.i64(ptr align 16 %89, i8 0, i64 %92, i1 false)
  %93 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %94 = call ptr @realpath(ptr noundef %93, ptr noundef %89) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %95 = call i64 @strlen(ptr noundef %89) #10
  %96 = add i64 %95, 1
  store i64 %96, ptr %14, align 8, !tbaa !15
  %97 = load i64, ptr %14, align 8, !tbaa !15
  %98 = call noalias ptr @malloc(i64 noundef %97) #11
  store ptr %98, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %99 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %100 = load i64, ptr %14, align 8, !tbaa !15
  call void @llvm.memset.p0.i64(ptr align 1 %99, i8 0, i64 %100, i1 false)
  %101 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  %102 = load i64, ptr %14, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %101, ptr align 16 %89, i64 %102, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  %103 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %103)
  br label %104

104:                                              ; preds = %86, %83
  %105 = call i32 @clib_cache_init(i64 noundef 2592000)
  store i32 1, ptr @package_opts, align 8, !tbaa !25
  %106 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 1), align 8, !tbaa !24
  store ptr %106, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 3), align 8, !tbaa !27
  store i32 0, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 2), align 8, !tbaa !28
  store i32 1, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 1), align 4, !tbaa !29
  %107 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opts, i32 0, i32 2), align 8, !tbaa !30
  store ptr %107, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @package_opts, i32 0, i32 5), align 8, !tbaa !31
  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 %15) #9
  %108 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %109 = load i32, ptr %108, align 8, !tbaa !19
  %110 = icmp eq i32 0, %109
  br i1 %110, label %111, label %113

111:                                              ; preds = %104
  %112 = call i32 @install_local_packages()
  br label %119

113:                                              ; preds = %104
  %114 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 7
  %115 = load i32, ptr %114, align 8, !tbaa !19
  %116 = getelementptr inbounds %struct.command, ptr %7, i32 0, i32 8
  %117 = getelementptr inbounds [32 x ptr], ptr %116, i64 0, i64 0
  %118 = call i32 @install_packages(i32 noundef %115, ptr noundef %117)
  br label %119

119:                                              ; preds = %113, %111
  %120 = phi i32 [ %112, %111 ], [ %118, %113 ]
  store i32 %120, ptr %15, align 4, !tbaa !5
  call void @curl_global_cleanup()
  call void (...) @clib_package_cleanup()
  call void @command_free(ptr noundef %7)
  %121 = load i32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #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 %121
}

; 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_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 @fs_read(ptr noundef) #2

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; 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 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
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}
!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 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !10, i64 112}
!23 = !{!"", !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}
!24 = !{!12, !10, i64 8}
!25 = !{!26, !6, i64 0}
!26 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!27 = !{!26, !10, i64 16}
!28 = !{!26, !6, i64 8}
!29 = !{!26, !6, i64 4}
!30 = !{!12, !10, i64 16}
!31 = !{!26, !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 }
%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 [12 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 [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [13 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.20 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1
@root_package = external hidden local_unnamed_addr global ptr, align 8
@manifest_names = external local_unnamed_addr global [0 x 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) #10
  %5 = tail call i32 @clib_cache_init(i64 noundef 2592000) #10
  call void @llvm.lifetime.start.p0(i64 2112, ptr nonnull %3) #10
  call void @command_init(ptr noundef nonnull %3, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2) #10
  %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) #10
  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) #10
  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) #10
  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) #10
  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_token) #10
  call void @command_parse(ptr noundef nonnull %3, i32 noundef %0, ptr noundef %1) #10
  %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.19, i32 noundef %8) #10
  %9 = call i32 @curl_global_init(i64 noundef 3) #10
  %.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.20, ptr noundef nonnull @.str.21) #10
  %13 = load ptr, ptr @stderr, align 8, !tbaa !16
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.22) #11
  %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.23) #10
  %17 = load ptr, ptr @stderr, align 8, !tbaa !16
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.24) #11
  br label %19

19:                                               ; preds = %10, %2
  %20 = load ptr, ptr @root_package, align 8, !tbaa !16
  %.not21 = icmp eq ptr %20, null
  br i1 %.not21, label %.preheader.preheader, label %41

.preheader.preheader:                             ; preds = %19
  %.pre = load ptr, ptr @manifest_names, align 8, !tbaa !16
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %21 = phi ptr [ %26, %.preheader ], [ %.pre, %.preheader.preheader ]
  %.0 = phi i32 [ %23, %.preheader ], [ 0, %.preheader.preheader ]
  %22 = call ptr @fs_read(ptr noundef %21) #10
  %23 = add i32 %.0, 1
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [0 x ptr], ptr @manifest_names, i64 0, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  %27 = icmp ne ptr %26, null
  %.not22 = icmp eq ptr %22, null
  %28 = select i1 %27, i1 %.not22, i1 false
  br i1 %28, label %.preheader, label %29, !llvm.loop !17

29:                                               ; preds = %.preheader
  br i1 %.not22, label %41, label %30

30:                                               ; preds = %29
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !11
  %32 = call ptr @clib_package_new(ptr noundef nonnull %22, i32 noundef %31) #10
  store ptr %32, ptr @root_package, align 8, !tbaa !16
  %.not23 = icmp eq ptr %32, null
  br i1 %.not23, label %40, label %33

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %32, i64 112
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = icmp eq ptr %35, null
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8
  %38 = icmp ne ptr %37, null
  %or.cond = select i1 %36, i1 true, i1 %38
  br i1 %or.cond, label %40, label %39

39:                                               ; preds = %33
  store ptr %35, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  br label %40

40:                                               ; preds = %39, %33, %30
  call void @free(ptr noundef nonnull %22) #10
  br label %41

41:                                               ; preds = %29, %40, %19
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  %.not24 = icmp eq ptr %42, null
  br i1 %.not24, label %52, label %43

43:                                               ; preds = %41
  %44 = call ptr @llvm.stacksave.p0()
  %45 = alloca [4096 x i8], align 16
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  %47 = call i32 @mkdirp(ptr noundef %46, i32 noundef 511) #10
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4096) %45, i8 0, i64 4096, i1 false)
  %48 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  %49 = call ptr @realpath(ptr noundef %48, ptr noundef nonnull %45) #10
  %50 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %45) #12
  %51 = add i64 %50, 1
  %calloc = call ptr @calloc(i64 1, i64 %51)
  store ptr %calloc, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %calloc, ptr nonnull align 16 %45, i64 %51, i1 false)
  call void @llvm.stackrestore.p0(ptr %44)
  br label %52

52:                                               ; preds = %43, %41
  %53 = call i32 @clib_cache_init(i64 noundef 2592000) #10
  store i32 1, ptr @package_opts, align 8, !tbaa !22
  %54 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !21
  store ptr %54, ptr getelementptr inbounds (i8, ptr @package_opts, i64 16), align 8, !tbaa !24
  store i32 0, ptr getelementptr inbounds (i8, ptr @package_opts, i64 8), align 8, !tbaa !25
  store i32 1, ptr getelementptr inbounds (i8, ptr @package_opts, i64 4), align 4, !tbaa !26
  %55 = load ptr, ptr getelementptr inbounds (i8, ptr @opts, i64 16), align 8, !tbaa !27
  store ptr %55, ptr getelementptr inbounds (i8, ptr @package_opts, i64 32), align 8, !tbaa !28
  call void @clib_package_set_opts(ptr noundef nonnull byval(%struct.clib_package_opts_t) align 8 @package_opts) #10
  %56 = load i32, ptr %7, align 8, !tbaa !15
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %52
  %59 = call i32 @install_local_packages()
  br label %63

60:                                               ; preds = %52
  %61 = getelementptr inbounds i8, ptr %3, i64 1848
  %62 = call i32 @install_packages(i32 noundef %56, ptr noundef nonnull %61)
  br label %63

63:                                               ; preds = %60, %58
  %64 = phi i32 [ %59, %58 ], [ %62, %60 ]
  call void @curl_global_cleanup() #10
  call void (...) @clib_package_cleanup() #10
  call void @command_free(ptr noundef nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 2112, ptr nonnull %3) #10
  ret i32 %64
}

; 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_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 @fs_read(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; 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 ptr @llvm.stacksave.p0() #5

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) #6

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

; 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) #8

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

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 #9

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 nounwind willreturn allockind("free") 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #10 = { nounwind }
attributes #11 = { cold nounwind }
attributes #12 = { 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}
!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 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !7, i64 112}
!20 = !{!"", !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}
!21 = !{!6, !7, i64 8}
!22 = !{!23, !10, i64 0}
!23 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32}
!24 = !{!23, !7, i64 16}
!25 = !{!23, !10, i64 8}
!26 = !{!23, !10, i64 4}
!27 = !{!6, !7, i64 16}
!28 = !{!23, !7, i64 32}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass