; LLVM IR from marcobambini/gravity :: src/cli (gravity)

; 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.gravity_delegate_t = type { ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.gravity_value_t = type { ptr, %union.anon }
%union.anon = type { i64 }

@__const.main.delegate = external hidden unnamed_addr constant %struct.gravity_delegate_t, align 8
@input_file = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [72 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@output_file = external hidden global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@quiet_flag = external hidden global i8, align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1

; 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 i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.gravity_delegate_t, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca %struct.gravity_value_t, align 8
  %17 = alloca double, align 8
  %18 = alloca [512 x i8], align 16
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = call i32 @parse_args(i32 noundef %19, ptr noundef %20)
  store i32 %21, ptr %6, align 4, !tbaa !5
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 4
  br i1 %23, label %24, label %25

24:                                               ; preds = %2
  call void @gravity_repl()
  br label %25

25:                                               ; preds = %24, %2
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 5
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  call void @gravity_unittest()
  br label %29

29:                                               ; preds = %28, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 192, ptr %9) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 @__const.main.delegate, i64 192, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %30 = call ptr @gravity_vm_new(ptr noundef %9)
  store ptr %30, ptr %10, align 8, !tbaa !9
  %31 = load ptr, ptr %10, align 8, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  call void @gravity_env_register_args(ptr noundef %31, i32 noundef %32, ptr noundef %33)
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %42, label %36

36:                                               ; preds = %29
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = icmp eq i32 %37, 2
  br i1 %38, label %42, label %39

39:                                               ; preds = %36
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp eq i32 %40, 3
  br i1 %41, label %42, label %114

42:                                               ; preds = %39, %36, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr null, ptr %12, align 8, !tbaa !9
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 3
  br i1 %44, label %45, label %49

45:                                               ; preds = %42
  %46 = load ptr, ptr @input_file, align 8, !tbaa !9
  store ptr %46, ptr %12, align 8, !tbaa !9
  %47 = load ptr, ptr @input_file, align 8, !tbaa !9
  %48 = call i64 @strlen(ptr noundef %47) #8
  store i64 %48, ptr %11, align 8, !tbaa !11
  br label %52

49:                                               ; preds = %42
  %50 = load ptr, ptr @input_file, align 8, !tbaa !9
  %51 = call ptr @file_read(ptr noundef %50, ptr noundef %11)
  store ptr %51, ptr %12, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %49, %45
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = load i64, ptr %11, align 8, !tbaa !11
  %57 = icmp ne i64 %56, 0
  br i1 %57, label %65, label %58

58:                                               ; preds = %55, %52
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = icmp eq i32 %59, 3
  %61 = zext i1 %60 to i64
  %62 = select i1 %60, ptr @.str.1, ptr @.str.2
  %63 = load ptr, ptr @input_file, align 8, !tbaa !9
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %62, ptr noundef %63)
  store i32 2, ptr %15, align 4
  br label %111

65:                                               ; preds = %55
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = icmp eq i32 %66, 3
  br i1 %67, label %68, label %84

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %69 = load i64, ptr %11, align 8, !tbaa !11
  %70 = add i64 %69, 1024
  %71 = call ptr @gravity_calloc(ptr noundef null, i64 noundef 1, i64 noundef %70)
  store ptr %71, ptr %13, align 8, !tbaa !9
  %72 = load ptr, ptr %13, align 8, !tbaa !9
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %75

74:                                               ; preds = %68
  br label %76

75:                                               ; preds = %68
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 451, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

76:                                               ; preds = %74
  %77 = load ptr, ptr %13, align 8, !tbaa !9
  %78 = load i64, ptr %11, align 8, !tbaa !11
  %79 = add i64 %78, 1024
  %80 = load ptr, ptr @input_file, align 8, !tbaa !9
  %81 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %77, i64 noundef %79, ptr noundef @.str.5, ptr noundef %80) #7
  %82 = sext i32 %81 to i64
  store i64 %82, ptr %11, align 8, !tbaa !11
  %83 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %83, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %84

84:                                               ; preds = %76, %65
  %85 = call ptr @gravity_compiler_create(ptr noundef %9)
  store ptr %85, ptr %8, align 8, !tbaa !9
  %86 = load ptr, ptr %8, align 8, !tbaa !9
  %87 = load ptr, ptr %12, align 8, !tbaa !9
  %88 = load i64, ptr %11, align 8, !tbaa !11
  %89 = call ptr @gravity_compiler_run(ptr noundef %86, ptr noundef %87, i64 noundef %88, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext true)
  store ptr %89, ptr %7, align 8, !tbaa !9
  %90 = load ptr, ptr %7, align 8, !tbaa !9
  %91 = icmp ne ptr %90, null
  br i1 %91, label %93, label %92

92:                                               ; preds = %84
  store i32 2, ptr %15, align 4
  br label %111

93:                                               ; preds = %84
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %108

96:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #7
  %97 = load ptr, ptr %8, align 8, !tbaa !9
  %98 = load ptr, ptr %7, align 8, !tbaa !9
  %99 = load ptr, ptr @output_file, align 8, !tbaa !9
  %100 = call zeroext i1 @gravity_compiler_serialize_infile(ptr noundef %97, ptr noundef %98, ptr noundef %99)
  %101 = zext i1 %100 to i8
  store i8 %101, ptr %14, align 1, !tbaa !13
  %102 = load i8, ptr %14, align 1, !tbaa !13, !range !15, !noundef !16
  %103 = trunc i8 %102 to i1
  br i1 %103, label %107, label %104

104:                                              ; preds = %96
  %105 = load ptr, ptr @output_file, align 8, !tbaa !9
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %105)
  br label %107

107:                                              ; preds = %104, %96
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #7
  br label %111

108:                                              ; preds = %93
  %109 = load ptr, ptr %8, align 8, !tbaa !9
  %110 = load ptr, ptr %10, align 8, !tbaa !9
  call void @gravity_compiler_transfer(ptr noundef %109, ptr noundef %110)
  store i32 0, ptr %15, align 4
  br label %111

111:                                              ; preds = %108, %107, %92, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %112 = load i32, ptr %15, align 4
  switch i32 %112, label %171 [
    i32 0, label %113
    i32 2, label %160
  ]

113:                                              ; preds = %111
  br label %128

114:                                              ; preds = %39
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = icmp eq i32 %115, 1
  br i1 %116, label %117, label %127

117:                                              ; preds = %114
  %118 = load ptr, ptr %10, align 8, !tbaa !9
  %119 = load ptr, ptr @input_file, align 8, !tbaa !9
  %120 = call ptr @gravity_vm_loadfile(ptr noundef %118, ptr noundef %119)
  store ptr %120, ptr %7, align 8, !tbaa !9
  %121 = load ptr, ptr %7, align 8, !tbaa !9
  %122 = icmp ne ptr %121, null
  br i1 %122, label %126, label %123

123:                                              ; preds = %117
  %124 = load ptr, ptr @input_file, align 8, !tbaa !9
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %124)
  br label %160

126:                                              ; preds = %117
  br label %127

127:                                              ; preds = %126, %114
  br label %128

128:                                              ; preds = %127, %113
  %129 = load ptr, ptr %7, align 8, !tbaa !9
  %130 = icmp ne ptr %129, null
  br i1 %130, label %131, label %132

131:                                              ; preds = %128
  br label %133

132:                                              ; preds = %128
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.4, i32 noundef 483, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

133:                                              ; preds = %131
  %134 = load ptr, ptr %10, align 8, !tbaa !9
  %135 = load ptr, ptr %7, align 8, !tbaa !9
  %136 = call zeroext i1 @gravity_vm_runmain(ptr noundef %134, ptr noundef %135)
  br i1 %136, label %137, label %159

137:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #7
  %138 = load ptr, ptr %10, align 8, !tbaa !9
  %139 = call { ptr, i64 } @gravity_vm_result(ptr noundef %138)
  %140 = getelementptr inbounds { ptr, i64 }, ptr %16, i32 0, i32 0
  %141 = extractvalue { ptr, i64 } %139, 0
  store ptr %141, ptr %140, align 8
  %142 = getelementptr inbounds { ptr, i64 }, ptr %16, i32 0, i32 1
  %143 = extractvalue { ptr, i64 } %139, 1
  store i64 %143, ptr %142, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %144 = load ptr, ptr %10, align 8, !tbaa !9
  %145 = call double @gravity_vm_time(ptr noundef %144)
  store double %145, ptr %17, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 512, ptr %18) #7
  %146 = load ptr, ptr %10, align 8, !tbaa !9
  %147 = getelementptr inbounds [512 x i8], ptr %18, i64 0, i64 0
  %148 = getelementptr inbounds { ptr, i64 }, ptr %16, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8
  %150 = getelementptr inbounds { ptr, i64 }, ptr %16, i32 0, i32 1
  %151 = load i64, ptr %150, align 8
  call void @gravity_value_dump(ptr noundef %146, ptr %149, i64 %151, ptr noundef %147, i16 noundef zeroext 512)
  %152 = load i8, ptr @quiet_flag, align 1, !tbaa !13, !range !15, !noundef !16
  %153 = trunc i8 %152 to i1
  br i1 %153, label %158, label %154

154:                                              ; preds = %137
  %155 = getelementptr inbounds [512 x i8], ptr %18, i64 0, i64 0
  %156 = load double, ptr %17, align 8, !tbaa !17
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef %155, double noundef %156)
  br label %158

158:                                              ; preds = %154, %137
  call void @llvm.lifetime.end.p0(i64 512, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #7
  br label %159

159:                                              ; preds = %158, %133
  br label %160

160:                                              ; preds = %159, %123, %111
  %161 = load ptr, ptr %8, align 8, !tbaa !9
  %162 = icmp ne ptr %161, null
  br i1 %162, label %163, label %165

163:                                              ; preds = %160
  %164 = load ptr, ptr %8, align 8, !tbaa !9
  call void @gravity_compiler_free(ptr noundef %164)
  br label %165

165:                                              ; preds = %163, %160
  %166 = load ptr, ptr %10, align 8, !tbaa !9
  %167 = icmp ne ptr %166, null
  br i1 %167, label %168, label %170

168:                                              ; preds = %165
  %169 = load ptr, ptr %10, align 8, !tbaa !9
  call void @gravity_vm_free(ptr noundef %169)
  br label %170

170:                                              ; preds = %168, %165
  call void @gravity_core_free()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %171

171:                                              ; preds = %170, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 192, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %172 = load i32, ptr %3, align 4
  ret i32 %172
}

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

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

; Function Attrs: nounwind uwtable
declare hidden void @gravity_repl() #0

; Function Attrs: nounwind uwtable
declare hidden void @gravity_unittest() #0

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

declare ptr @gravity_vm_new(ptr noundef) #3

declare void @gravity_env_register_args(ptr noundef, i32 noundef, ptr noundef) #3

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

declare ptr @file_read(ptr noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #3

declare ptr @gravity_calloc(ptr noundef, i64 noundef, i64 noundef) #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

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

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

declare ptr @gravity_compiler_create(ptr noundef) #3

declare ptr @gravity_compiler_run(ptr noundef, ptr noundef, i64 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) #3

declare zeroext i1 @gravity_compiler_serialize_infile(ptr noundef, ptr noundef, ptr noundef) #3

declare void @gravity_compiler_transfer(ptr noundef, ptr noundef) #3

declare ptr @gravity_vm_loadfile(ptr noundef, ptr noundef) #3

declare zeroext i1 @gravity_vm_runmain(ptr noundef, ptr noundef) #3

declare { ptr, i64 } @gravity_vm_result(ptr noundef) #3

declare double @gravity_vm_time(ptr noundef) #3

declare void @gravity_value_dump(ptr noundef, ptr, i64, ptr noundef, i16 noundef zeroext) #3

declare void @gravity_compiler_free(ptr noundef) #3

declare void @gravity_vm_free(ptr noundef) #3

declare void @gravity_core_free() #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 #5 = { noreturn 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn 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 = !{!"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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.gravity_delegate_t = type { ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@__const.main.delegate = external hidden unnamed_addr constant %struct.gravity_delegate_t, align 8
@input_file = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [72 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@output_file = external hidden local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@quiet_flag = external hidden local_unnamed_addr global i8, align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.gravity_delegate_t, align 8
  %4 = alloca i64, align 8
  %5 = alloca [512 x i8], align 16
  %6 = tail call i32 @parse_args(i32 noundef %0, ptr noundef %1)
  switch i32 %6, label %10 [
    i32 4, label %7
    i32 5, label %8
  ]

7:                                                ; preds = %2
  tail call void @gravity_repl()
  br label %.thread

8:                                                ; preds = %2
  tail call void @gravity_unittest()
  br label %.thread

.thread:                                          ; preds = %7, %8
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(192) %3, ptr noundef nonnull align 8 dereferenceable(192) @__const.main.delegate, i64 192, i1 false)
  %9 = call ptr @gravity_vm_new(ptr noundef nonnull %3) #7
  call void @gravity_env_register_args(ptr noundef %9, i32 noundef %0, ptr noundef %1) #7
  br label %52

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(192) %3, ptr noundef nonnull align 8 dereferenceable(192) @__const.main.delegate, i64 192, i1 false)
  %11 = call ptr @gravity_vm_new(ptr noundef nonnull %3) #7
  call void @gravity_env_register_args(ptr noundef %11, i32 noundef %0, ptr noundef %1) #7
  %12 = icmp eq i32 %6, 0
  switch i32 %6, label %52 [
    i32 3, label %13
    i32 2, label %13
    i32 0, label %13
    i32 1, label %47
  ]

13:                                               ; preds = %10, %10, %10
  %14 = icmp eq i32 %6, 3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store i64 0, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr @input_file, align 8, !tbaa !9
  br i1 %14, label %16, label %.thread64

16:                                               ; preds = %13
  %17 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %15) #8
  store i64 %17, ptr %4, align 8, !tbaa !5
  %18 = icmp ne ptr %15, null
  %19 = icmp ne i64 %17, 0
  %or.cond5 = select i1 %18, i1 %19, i1 false
  br i1 %or.cond5, label %28, label %24

.thread64:                                        ; preds = %13
  %20 = call ptr @file_read(ptr noundef %15, ptr noundef nonnull %4) #7
  %21 = icmp ne ptr %20, null
  %22 = load i64, ptr %4, align 8
  %23 = icmp ne i64 %22, 0
  %or.cond566 = select i1 %21, i1 %23, i1 false
  br i1 %or.cond566, label %.thread68, label %.thread64._crit_edge

.thread64._crit_edge:                             ; preds = %.thread64
  %.pre = load ptr, ptr @input_file, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %.thread64._crit_edge, %16
  %25 = phi ptr [ %.pre, %.thread64._crit_edge ], [ %15, %16 ]
  %26 = phi ptr [ @.str.2, %.thread64._crit_edge ], [ @.str.1, %16 ]
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %26, ptr noundef %25)
  br label %.thread71

28:                                               ; preds = %16
  %29 = add i64 %17, 1024
  %30 = call ptr @gravity_calloc(ptr noundef null, i64 noundef 1, i64 noundef %29) #7
  %.not58 = icmp eq ptr %30, null
  br i1 %.not58, label %31, label %32

31:                                               ; preds = %28
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 451, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
  unreachable

32:                                               ; preds = %28
  %33 = load ptr, ptr @input_file, align 8, !tbaa !9
  %34 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull %30, i64 noundef %29, ptr noundef nonnull @.str.5, ptr noundef %33) #7
  %35 = sext i32 %34 to i64
  store i64 %35, ptr %4, align 8, !tbaa !5
  br label %.thread68

.thread68:                                        ; preds = %.thread64, %32
  %.151 = phi ptr [ %30, %32 ], [ %20, %.thread64 ]
  %36 = call ptr @gravity_compiler_create(ptr noundef nonnull %3) #7
  %37 = load i64, ptr %4, align 8, !tbaa !5
  %38 = call ptr @gravity_compiler_run(ptr noundef %36, ptr noundef nonnull %.151, i64 noundef %37, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext true) #7
  %.not59 = icmp eq ptr %38, null
  br i1 %.not59, label %.thread71, label %39

39:                                               ; preds = %.thread68
  br i1 %12, label %40, label %46

40:                                               ; preds = %39
  %41 = load ptr, ptr @output_file, align 8, !tbaa !9
  %42 = call zeroext i1 @gravity_compiler_serialize_infile(ptr noundef %36, ptr noundef nonnull %38, ptr noundef %41) #7
  br i1 %42, label %.thread71, label %43

43:                                               ; preds = %40
  %44 = load ptr, ptr @output_file, align 8, !tbaa !9
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef %44)
  br label %.thread71

.thread71:                                        ; preds = %24, %.thread68, %43, %40
  %.047.ph = phi ptr [ %36, %40 ], [ %36, %43 ], [ %36, %.thread68 ], [ null, %24 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %65

46:                                               ; preds = %39
  call void @gravity_compiler_transfer(ptr noundef %36, ptr noundef %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %53

47:                                               ; preds = %10
  %48 = load ptr, ptr @input_file, align 8, !tbaa !9
  %49 = call ptr @gravity_vm_loadfile(ptr noundef %11, ptr noundef %48) #7
  %.not = icmp eq ptr %49, null
  br i1 %.not, label %.thread81, label %53

.thread81:                                        ; preds = %47
  %50 = load ptr, ptr @input_file, align 8, !tbaa !9
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %50)
  br label %67

52:                                               ; preds = %10, %.thread
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.4, i32 noundef 483, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
  unreachable

53:                                               ; preds = %47, %46
  %.148 = phi ptr [ %36, %46 ], [ null, %47 ]
  %.1 = phi ptr [ %38, %46 ], [ %49, %47 ]
  %54 = call zeroext i1 @gravity_vm_runmain(ptr noundef %11, ptr noundef nonnull %.1) #7
  br i1 %54, label %55, label %65

55:                                               ; preds = %53
  %56 = call { ptr, i64 } @gravity_vm_result(ptr noundef %11) #7
  %57 = extractvalue { ptr, i64 } %56, 0
  %58 = extractvalue { ptr, i64 } %56, 1
  %59 = call double @gravity_vm_time(ptr noundef %11) #7
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %5) #7
  call void @gravity_value_dump(ptr noundef %11, ptr %57, i64 %58, ptr noundef nonnull %5, i16 noundef zeroext 512) #7
  %60 = load i8, ptr @quiet_flag, align 1, !tbaa !11, !range !13, !noundef !14
  %61 = trunc nuw i8 %60 to i1
  br i1 %61, label %64, label %62

62:                                               ; preds = %55
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull %5, double noundef %59)
  br label %64

64:                                               ; preds = %62, %55
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %5) #7
  br label %65

65:                                               ; preds = %.thread71, %53, %64
  %.2 = phi ptr [ %.148, %64 ], [ %.148, %53 ], [ %.047.ph, %.thread71 ]
  %.not61 = icmp eq ptr %.2, null
  br i1 %.not61, label %67, label %66

66:                                               ; preds = %65
  call void @gravity_compiler_free(ptr noundef nonnull %.2) #7
  br label %67

67:                                               ; preds = %.thread81, %66, %65
  %.not62 = icmp eq ptr %11, null
  br i1 %.not62, label %69, label %68

68:                                               ; preds = %67
  call void @gravity_vm_free(ptr noundef nonnull %11) #7
  br label %69

69:                                               ; preds = %68, %67
  call void @gravity_core_free() #7
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %3) #7
  ret i32 0
}

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

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

; Function Attrs: nounwind uwtable
declare hidden void @gravity_repl() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @gravity_unittest() local_unnamed_addr #0

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

declare ptr @gravity_vm_new(ptr noundef) local_unnamed_addr #3

declare void @gravity_env_register_args(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

declare ptr @file_read(ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare ptr @gravity_calloc(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

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

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

declare ptr @gravity_compiler_create(ptr noundef) local_unnamed_addr #3

declare ptr @gravity_compiler_run(ptr noundef, ptr noundef, i64 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #3

declare zeroext i1 @gravity_compiler_serialize_infile(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @gravity_compiler_transfer(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @gravity_vm_loadfile(ptr noundef, ptr noundef) local_unnamed_addr #3

declare zeroext i1 @gravity_vm_runmain(ptr noundef, ptr noundef) local_unnamed_addr #3

declare { ptr, i64 } @gravity_vm_result(ptr noundef) local_unnamed_addr #3

declare double @gravity_vm_time(ptr noundef) local_unnamed_addr #3

declare void @gravity_value_dump(ptr noundef, ptr, i64, ptr noundef, i16 noundef zeroext) local_unnamed_addr #3

declare void @gravity_compiler_free(ptr noundef) local_unnamed_addr #3

declare void @gravity_vm_free(ptr noundef) local_unnamed_addr #3

declare void @gravity_core_free() local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #5 = { 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 #6 = { noreturn 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn 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 = !{!"long", !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, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


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