; LLVM IR from buzz-lang/Buzz :: src/buzz (buzzrun)

; 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.buzzvm_s = type { ptr, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i16, ptr, ptr, ptr, ptr, i32, i32, ptr, i16, ptr, i32 }
%struct.buzzdebug_s = type { ptr, ptr, ptr, ptr, ptr }
%struct.buzzdebug_entry_s = type { i64, i64, ptr }

@stderr = external global ptr, align 8
@stdout = external global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [64 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage(ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @print(ptr noundef) #0

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

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

; 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 ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  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 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 3
  br i1 %17, label %21, label %18

18:                                               ; preds = %2
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 4
  br i1 %20, label %21, label %25

21:                                               ; preds = %18, %2
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  call void @usage(ptr noundef %24, i32 noundef 0)
  br label %25

25:                                               ; preds = %21, %18
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 3
  br i1 %27, label %28, label %35

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 1
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  store ptr %31, ptr %6, align 8, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 2
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  store ptr %34, ptr %7, align 8, !tbaa !9
  br label %60

35:                                               ; preds = %25
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 2
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  store ptr %38, ptr %6, align 8, !tbaa !9
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %39, i64 3
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  store ptr %41, ptr %7, align 8, !tbaa !9
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds ptr, ptr %42, i64 1
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call i32 @strcmp(ptr noundef %44, ptr noundef @.str.10) #7
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %59

47:                                               ; preds = %35
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i64 1
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.11, ptr noundef %51, ptr noundef %54) #6
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %56, i64 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  call void @usage(ptr noundef %58, i32 noundef 1)
  br label %59

59:                                               ; preds = %47, %35
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %59, %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %61 = load ptr, ptr %6, align 8, !tbaa !9
  %62 = call noalias ptr @fopen(ptr noundef %61, ptr noundef @.str.12)
  store ptr %62, ptr %9, align 8, !tbaa !9
  %63 = load ptr, ptr %9, align 8, !tbaa !9
  %64 = icmp ne ptr %63, null
  br i1 %64, label %67, label %65

65:                                               ; preds = %60
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  call void @perror(ptr noundef %66)
  br label %67

67:                                               ; preds = %65, %60
  %68 = load ptr, ptr %9, align 8, !tbaa !9
  %69 = call i32 @fseek(ptr noundef %68, i64 noundef 0, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %70 = load ptr, ptr %9, align 8, !tbaa !9
  %71 = call i64 @ftell(ptr noundef %70)
  store i64 %71, ptr %10, align 8, !tbaa !11
  %72 = load ptr, ptr %9, align 8, !tbaa !9
  call void @rewind(ptr noundef %72)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %73 = load i64, ptr %10, align 8, !tbaa !11
  %74 = call noalias ptr @malloc(i64 noundef %73) #8
  store ptr %74, ptr %11, align 8, !tbaa !9
  %75 = load ptr, ptr %11, align 8, !tbaa !9
  %76 = load i64, ptr %10, align 8, !tbaa !11
  %77 = load ptr, ptr %9, align 8, !tbaa !9
  %78 = call i64 @fread(ptr noundef %75, i64 noundef 1, i64 noundef %76, ptr noundef %77)
  %79 = load i64, ptr %10, align 8, !tbaa !11
  %80 = icmp ult i64 %78, %79
  br i1 %80, label %81, label %83

81:                                               ; preds = %67
  %82 = load ptr, ptr %6, align 8, !tbaa !9
  call void @perror(ptr noundef %82)
  br label %83

83:                                               ; preds = %81, %67
  %84 = load ptr, ptr %9, align 8, !tbaa !9
  %85 = call i32 @fclose(ptr noundef %84)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %86 = call ptr (...) @buzzdebug_new()
  store ptr %86, ptr %12, align 8, !tbaa !9
  %87 = load ptr, ptr %12, align 8, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = call i32 @buzzdebug_fromfile(ptr noundef %87, ptr noundef %88)
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %93, label %91

91:                                               ; preds = %83
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  call void @perror(ptr noundef %92)
  br label %93

93:                                               ; preds = %91, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %94 = call ptr @buzzvm_new(i16 noundef zeroext 1)
  store ptr %94, ptr %13, align 8, !tbaa !9
  %95 = load ptr, ptr %13, align 8, !tbaa !9
  %96 = load ptr, ptr %11, align 8, !tbaa !9
  %97 = load i64, ptr %10, align 8, !tbaa !11
  %98 = trunc i64 %97 to i32
  %99 = call i32 @buzzvm_set_bcode(ptr noundef %95, ptr noundef %96, i32 noundef %98)
  %100 = load ptr, ptr %13, align 8, !tbaa !9
  %101 = load ptr, ptr %13, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.buzzvm_s, ptr %101, i32 0, i32 9
  %103 = load ptr, ptr %102, align 8, !tbaa !13
  %104 = call zeroext i16 @buzzstrman_register(ptr noundef %103, ptr noundef @.str.13, i32 noundef 1)
  %105 = call i32 @buzzvm_pushs(ptr noundef %100, i16 noundef zeroext %104)
  %106 = load ptr, ptr %13, align 8, !tbaa !9
  %107 = load ptr, ptr %13, align 8, !tbaa !9
  %108 = call i32 @buzzvm_function_register(ptr noundef %107, ptr noundef @print)
  %109 = call i32 @buzzvm_pushc(ptr noundef %106, i32 noundef %108, i32 noundef 0)
  %110 = load ptr, ptr %13, align 8, !tbaa !9
  %111 = call i32 @buzzvm_gstore(ptr noundef %110)
  br label %112

112:                                              ; preds = %119, %93
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %112
  %116 = load ptr, ptr %13, align 8, !tbaa !9
  %117 = load ptr, ptr @stdout, align 8, !tbaa !9
  call void @buzzdebug_stack_dump(ptr noundef %116, i32 noundef 1, ptr noundef %117)
  br label %118

118:                                              ; preds = %115, %112
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %13, align 8, !tbaa !9
  %121 = call i32 @buzzvm_step(ptr noundef %120)
  %122 = icmp eq i32 %121, 1
  br i1 %122, label %112, label %123, !llvm.loop !16

123:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %124 = load ptr, ptr %13, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.buzzvm_s, ptr %124, i32 0, i32 20
  %126 = load i32, ptr %125, align 8, !tbaa !18
  %127 = icmp eq i32 %126, 2
  br i1 %127, label %128, label %138

128:                                              ; preds = %123
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %134

131:                                              ; preds = %128
  %132 = load ptr, ptr %13, align 8, !tbaa !9
  %133 = load ptr, ptr @stdout, align 8, !tbaa !9
  call void @buzzdebug_stack_dump(ptr noundef %132, i32 noundef 1, ptr noundef %133)
  br label %134

134:                                              ; preds = %131, %128
  %135 = load ptr, ptr @stdout, align 8, !tbaa !9
  %136 = load ptr, ptr %6, align 8, !tbaa !9
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.14, ptr noundef %136) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %183

138:                                              ; preds = %123
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %144

141:                                              ; preds = %138
  %142 = load ptr, ptr %13, align 8, !tbaa !9
  %143 = load ptr, ptr @stdout, align 8, !tbaa !9
  call void @buzzdebug_stack_dump(ptr noundef %142, i32 noundef 1, ptr noundef %143)
  br label %144

144:                                              ; preds = %141, %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %145 = load ptr, ptr %12, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.buzzdebug_s, ptr %145, i32 0, i32 1
  %147 = load ptr, ptr %146, align 8, !tbaa !19
  %148 = load ptr, ptr %13, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct.buzzvm_s, ptr %148, i32 0, i32 3
  %150 = call ptr @buzzdict_rawget(ptr noundef %147, ptr noundef %149)
  store ptr %150, ptr %15, align 8, !tbaa !9
  %151 = load ptr, ptr %15, align 8, !tbaa !9
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %172

153:                                              ; preds = %144
  %154 = load ptr, ptr @stderr, align 8, !tbaa !9
  %155 = load ptr, ptr %6, align 8, !tbaa !9
  %156 = load ptr, ptr %15, align 8, !tbaa !9
  %157 = load ptr, ptr %156, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.buzzdebug_entry_s, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !21
  %160 = load ptr, ptr %15, align 8, !tbaa !9
  %161 = load ptr, ptr %160, align 8, !tbaa !9
  %162 = getelementptr inbounds %struct.buzzdebug_entry_s, ptr %161, i32 0, i32 0
  %163 = load i64, ptr %162, align 8, !tbaa !23
  %164 = load ptr, ptr %15, align 8, !tbaa !9
  %165 = load ptr, ptr %164, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct.buzzdebug_entry_s, ptr %165, i32 0, i32 1
  %167 = load i64, ptr %166, align 8, !tbaa !24
  %168 = load ptr, ptr %13, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct.buzzvm_s, ptr %168, i32 0, i32 22
  %170 = load ptr, ptr %169, align 8, !tbaa !25
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %154, ptr noundef @.str.15, ptr noundef %155, ptr noundef %159, i64 noundef %163, i64 noundef %167, ptr noundef %170) #6
  br label %182

172:                                              ; preds = %144
  %173 = load ptr, ptr @stderr, align 8, !tbaa !9
  %174 = load ptr, ptr %6, align 8, !tbaa !9
  %175 = load ptr, ptr %13, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.buzzvm_s, ptr %175, i32 0, i32 3
  %177 = load i32, ptr %176, align 8, !tbaa !26
  %178 = load ptr, ptr %13, align 8, !tbaa !9
  %179 = getelementptr inbounds %struct.buzzvm_s, ptr %178, i32 0, i32 22
  %180 = load ptr, ptr %179, align 8, !tbaa !25
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %173, ptr noundef @.str.16, ptr noundef %174, i32 noundef %177, ptr noundef %180) #6
  br label %182

182:                                              ; preds = %172, %153
  store i32 1, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %183

183:                                              ; preds = %182, %134
  %184 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %184) #6
  call void @buzzdebug_destroy(ptr noundef %12)
  call void @buzzvm_destroy(ptr noundef %13)
  %185 = load i32, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  ret i32 %185
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

declare void @perror(ptr noundef) #4

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #4

declare i64 @ftell(ptr noundef) #4

declare void @rewind(ptr noundef) #4

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

declare i32 @fclose(ptr noundef) #4

declare ptr @buzzdebug_new(...) #4

declare i32 @buzzdebug_fromfile(ptr noundef, ptr noundef) #4

declare ptr @buzzvm_new(i16 noundef zeroext) #4

declare i32 @buzzvm_set_bcode(ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @buzzvm_pushs(ptr noundef, i16 noundef zeroext) #4

declare zeroext i16 @buzzstrman_register(ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @buzzvm_pushc(ptr noundef, i32 noundef, i32 noundef) #4

declare i32 @buzzvm_function_register(ptr noundef, ptr noundef) #4

declare i32 @buzzvm_gstore(ptr noundef) #4

declare void @buzzdebug_stack_dump(ptr noundef, i32 noundef, ptr noundef) #4

declare i32 @buzzvm_step(ptr noundef) #4

declare ptr @buzzdict_rawget(ptr noundef, ptr noundef) #4

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

declare void @buzzdebug_destroy(ptr noundef) #4

declare void @buzzvm_destroy(ptr noundef) #4

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 64}
!14 = !{!"buzzvm_s", !10, i64 0, !6, i64 8, !6, i64 12, !6, 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, !15, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !6, i64 152, !6, i64 156, !10, i64 160, !15, i64 168, !10, i64 176, !6, i64 184}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!14, !6, i64 152}
!19 = !{!20, !10, i64 8}
!20 = !{!"buzzdebug_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!21 = !{!22, !10, i64 16}
!22 = !{!"buzzdebug_entry_s", !12, i64 0, !12, i64 8, !10, i64 16}
!23 = !{!22, !12, i64 0}
!24 = !{!22, !12, i64 8}
!25 = !{!14, !10, i64 160}
!26 = !{!14, !6, i64 16}


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

@stderr = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [64 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @print(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = add i32 %0, -5
  %or.cond = icmp ult i32 %5, -2
  br i1 %or.cond, label %.thread, label %7

.thread:                                          ; preds = %2
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %6, i32 noundef 0)
  br label %14

7:                                                ; preds = %2
  %8 = icmp eq i32 %0, 3
  br i1 %8, label %9, label %14

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  br label %27

14:                                               ; preds = %.thread, %7
  %15 = getelementptr inbounds i8, ptr %1, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %1, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %27, label %22

22:                                               ; preds = %14
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.11, ptr noundef %24, ptr noundef %20) #8
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %26, i32 noundef 1)
  br label %27

27:                                               ; preds = %14, %22, %9
  %28 = phi i1 [ true, %9 ], [ false, %22 ], [ false, %14 ]
  %.042 = phi ptr [ %13, %9 ], [ %18, %22 ], [ %18, %14 ]
  %.0 = phi ptr [ %11, %9 ], [ %16, %22 ], [ %16, %14 ]
  %29 = tail call noalias ptr @fopen(ptr noundef %.0, ptr noundef nonnull @.str.12)
  %.not45 = icmp eq ptr %29, null
  br i1 %.not45, label %30, label %31

30:                                               ; preds = %27
  tail call void @perror(ptr noundef %.0) #9
  br label %31

31:                                               ; preds = %30, %27
  %32 = tail call i32 @fseek(ptr noundef %29, i64 noundef 0, i32 noundef 2)
  %33 = tail call i64 @ftell(ptr noundef %29)
  tail call void @rewind(ptr noundef %29)
  %34 = tail call noalias ptr @malloc(i64 noundef %33) #10
  %35 = tail call i64 @fread(ptr noundef %34, i64 noundef 1, i64 noundef %33, ptr noundef %29)
  %36 = icmp ult i64 %35, %33
  br i1 %36, label %37, label %38

37:                                               ; preds = %31
  tail call void @perror(ptr noundef %.0) #9
  br label %38

38:                                               ; preds = %37, %31
  %39 = tail call i32 @fclose(ptr noundef %29)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #11
  %40 = tail call ptr (...) @buzzdebug_new() #11
  store ptr %40, ptr %3, align 8, !tbaa !5
  %41 = tail call i32 @buzzdebug_fromfile(ptr noundef %40, ptr noundef %.042) #11
  %.not46 = icmp eq i32 %41, 0
  br i1 %.not46, label %42, label %43

42:                                               ; preds = %38
  tail call void @perror(ptr noundef %.042) #9
  br label %43

43:                                               ; preds = %42, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #11
  %44 = tail call ptr @buzzvm_new(i16 noundef zeroext 1) #11
  store ptr %44, ptr %4, align 8, !tbaa !5
  %45 = trunc i64 %33 to i32
  %46 = tail call i32 @buzzvm_set_bcode(ptr noundef %44, ptr noundef %34, i32 noundef %45) #11
  %47 = getelementptr inbounds i8, ptr %44, i64 64
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = tail call zeroext i16 @buzzstrman_register(ptr noundef %48, ptr noundef nonnull @.str.13, i32 noundef 1) #11
  %50 = tail call i32 @buzzvm_pushs(ptr noundef %44, i16 noundef zeroext %49) #11
  %51 = tail call i32 @buzzvm_function_register(ptr noundef %44, ptr noundef nonnull @print) #11
  %52 = tail call i32 @buzzvm_pushc(ptr noundef %44, i32 noundef %51, i32 noundef 0) #11
  %53 = tail call i32 @buzzvm_gstore(ptr noundef %44) #11
  br i1 %28, label %.split.us, label %.split

.split.us:                                        ; preds = %43, %.split.us
  %54 = tail call i32 @buzzvm_step(ptr noundef %44) #11
  %55 = icmp eq i32 %54, 1
  br i1 %55, label %.split.us, label %.split50.us, !llvm.loop !13

.split:                                           ; preds = %43, %.split
  %56 = load ptr, ptr @stdout, align 8, !tbaa !5
  tail call void @buzzdebug_stack_dump(ptr noundef %44, i32 noundef 1, ptr noundef %56) #11
  %57 = tail call i32 @buzzvm_step(ptr noundef %44) #11
  %58 = icmp eq i32 %57, 1
  br i1 %58, label %.split, label %.split50.us, !llvm.loop !13

.split50.us:                                      ; preds = %.split, %.split.us
  %59 = getelementptr inbounds i8, ptr %44, i64 152
  %60 = load i32, ptr %59, align 8, !tbaa !15
  %61 = icmp eq i32 %60, 2
  br i1 %61, label %62, label %68

62:                                               ; preds = %.split50.us
  br i1 %28, label %65, label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr @stdout, align 8, !tbaa !5
  tail call void @buzzdebug_stack_dump(ptr noundef nonnull %44, i32 noundef 1, ptr noundef %64) #11
  br label %65

65:                                               ; preds = %63, %62
  %66 = load ptr, ptr @stdout, align 8, !tbaa !5
  %67 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef nonnull @.str.14, ptr noundef %.0) #11
  br label %92

68:                                               ; preds = %.split50.us
  br i1 %28, label %71, label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr @stdout, align 8, !tbaa !5
  tail call void @buzzdebug_stack_dump(ptr noundef nonnull %44, i32 noundef 1, ptr noundef %70) #11
  br label %71

71:                                               ; preds = %69, %68
  %72 = getelementptr inbounds i8, ptr %40, i64 8
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  %74 = getelementptr inbounds i8, ptr %44, i64 16
  %75 = tail call ptr @buzzdict_rawget(ptr noundef %73, ptr noundef nonnull %74) #11
  %.not48 = icmp eq ptr %75, null
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  br i1 %.not48, label %87, label %77

77:                                               ; preds = %71
  %78 = load ptr, ptr %75, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 16
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = load i64, ptr %78, align 8, !tbaa !21
  %82 = getelementptr inbounds i8, ptr %78, i64 8
  %83 = load i64, ptr %82, align 8, !tbaa !22
  %84 = getelementptr inbounds i8, ptr %44, i64 160
  %85 = load ptr, ptr %84, align 8, !tbaa !23
  %86 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.15, ptr noundef %.0, ptr noundef %80, i64 noundef %81, i64 noundef %83, ptr noundef %85) #8
  br label %92

87:                                               ; preds = %71
  %88 = load i32, ptr %74, align 8, !tbaa !24
  %89 = getelementptr inbounds i8, ptr %44, i64 160
  %90 = load ptr, ptr %89, align 8, !tbaa !23
  %91 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.16, ptr noundef %.0, i32 noundef %88, ptr noundef %90) #8
  br label %92

92:                                               ; preds = %77, %87, %65
  %.041 = phi i32 [ 0, %65 ], [ 1, %87 ], [ 1, %77 ]
  tail call void @free(ptr noundef %34) #11
  call void @buzzdebug_destroy(ptr noundef nonnull %3) #11
  call void @buzzvm_destroy(ptr noundef nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #11
  ret i32 %.041
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

declare ptr @buzzdebug_new(...) local_unnamed_addr #5

declare i32 @buzzdebug_fromfile(ptr noundef, ptr noundef) local_unnamed_addr #5

declare ptr @buzzvm_new(i16 noundef zeroext) local_unnamed_addr #5

declare i32 @buzzvm_set_bcode(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @buzzvm_pushs(ptr noundef, i16 noundef zeroext) local_unnamed_addr #5

declare zeroext i16 @buzzstrman_register(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @buzzvm_pushc(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

declare i32 @buzzvm_function_register(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @buzzvm_gstore(ptr noundef) local_unnamed_addr #5

declare void @buzzdebug_stack_dump(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

declare i32 @buzzvm_step(ptr noundef) local_unnamed_addr #5

declare ptr @buzzdict_rawget(ptr noundef, ptr noundef) local_unnamed_addr #5

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

declare void @buzzdebug_destroy(ptr noundef) local_unnamed_addr #5

declare void @buzzvm_destroy(ptr noundef) local_unnamed_addr #5

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 = { "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 = { 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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { cold nounwind }
attributes #9 = { cold }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 64}
!10 = !{!"buzzvm_s", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !12, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !11, i64 152, !11, i64 156, !6, i64 160, !12, i64 168, !6, i64 176, !11, i64 184}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !11, i64 152}
!16 = !{!17, !6, i64 8}
!17 = !{!"buzzdebug_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!18 = !{!19, !6, i64 16}
!19 = !{!"buzzdebug_entry_s", !20, i64 0, !20, i64 8, !6, i64 16}
!20 = !{!"long", !7, i64 0}
!21 = !{!19, !20, i64 0}
!22 = !{!19, !20, i64 8}
!23 = !{!10, !6, i64 160}
!24 = !{!10, !11, i64 16}


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