; LLVM IR from heyigor/miniBAE :: minibae/Tools/playbae (playbae)

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

@usageString = external dso_local constant [369 x i8], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [49 x i8], align 1
@gWriteToFile = external hidden global i32, align 4
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [25 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 i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca [1024 x i8], align 16
  %14 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %15 = call ptr @BAEMixer_New()
  store ptr %15, ptr %7, align 8, !tbaa !9
  %16 = load ptr, ptr %7, align 8, !tbaa !9
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %165

18:                                               ; preds = %2
  store i16 1, ptr %9, align 2, !tbaa !11
  %19 = load i16, ptr %9, align 2, !tbaa !11
  %20 = sext i16 %19 to i32
  %21 = sub nsw i32 64, %20
  %22 = trunc i32 %21 to i16
  store i16 %22, ptr %8, align 2, !tbaa !11
  %23 = load i16, ptr %8, align 2, !tbaa !11
  %24 = sext i16 %23 to i32
  %25 = sdiv i32 %24, 3
  %26 = trunc i32 %25 to i16
  store i16 %26, ptr %10, align 2, !tbaa !11
  store i32 44100, ptr %14, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %30 = call i32 @PV_ParseCommands(i32 noundef %27, ptr noundef %28, ptr noundef @.str, i32 noundef 1, ptr noundef %29)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %18
  %33 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %34 = call i32 @atoi(ptr noundef %33) #5
  store i32 %34, ptr %14, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %32, %18
  %36 = load i16, ptr %8, align 2, !tbaa !11
  %37 = sext i16 %36 to i32
  %38 = load i16, ptr %9, align 2, !tbaa !11
  %39 = sext i16 %38 to i32
  %40 = load i32, ptr %14, align 4, !tbaa !5
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %37, i32 noundef %39, i32 noundef %40)
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = load i32, ptr %14, align 4, !tbaa !5
  %44 = load i16, ptr %8, align 2, !tbaa !11
  %45 = load i16, ptr %9, align 2, !tbaa !11
  %46 = load i16, ptr %10, align 2, !tbaa !11
  %47 = call i32 @BAEMixer_Open(ptr noundef %42, i32 noundef %43, i32 noundef 2, i64 noundef 3, i16 noundef signext %44, i16 noundef signext %45, i16 noundef signext %46, i8 noundef signext 1)
  store i32 %47, ptr %6, align 4, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %161

50:                                               ; preds = %35
  %51 = load ptr, ptr %7, align 8, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = call i32 @BAEMixer_SetAudioTask(ptr noundef %51, ptr noundef @PV_Task, ptr noundef %52)
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  %55 = call i32 @BAEMixer_SetDefaultReverb(ptr noundef %54, i32 noundef 8)
  %56 = call i64 @BAE_GetSizeOfMemoryUsed()
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %56)
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %61 = call i32 @PV_ParseCommands(i32 noundef %58, ptr noundef %59, ptr noundef @.str.3, i32 noundef 1, ptr noundef %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %71

63:                                               ; preds = %50
  %64 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %64)
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  %67 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %68 = call i32 @BAEMixer_AddBankFromFile(ptr noundef %66, ptr noundef %67, ptr noundef %11)
  store i32 %68, ptr %6, align 4, !tbaa !5
  %69 = call i64 @BAE_GetSizeOfMemoryUsed()
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %69)
  br label %71

71:                                               ; preds = %63, %50
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !9
  %74 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %75 = call i32 @PV_ParseCommands(i32 noundef %72, ptr noundef %73, ptr noundef @.str.6, i32 noundef 1, ptr noundef %74)
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %90

77:                                               ; preds = %71
  %78 = load ptr, ptr %7, align 8, !tbaa !9
  %79 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %80 = call i32 @BAEMixer_StartOutputToFile(ptr noundef %78, ptr noundef %79, i32 noundef 2, i32 noundef 0)
  store i32 %80, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %86

83:                                               ; preds = %77
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %84)
  br label %89

86:                                               ; preds = %77
  store i32 1, ptr @gWriteToFile, align 4, !tbaa !5
  %87 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %87)
  br label %89

89:                                               ; preds = %86, %83
  br label %90

90:                                               ; preds = %89, %71
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = load ptr, ptr %5, align 8, !tbaa !9
  %93 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %94 = call i32 @PV_ParseCommands(i32 noundef %91, ptr noundef %92, ptr noundef @.str.9, i32 noundef 1, ptr noundef %93)
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %101

96:                                               ; preds = %90
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %98 = load ptr, ptr %7, align 8, !tbaa !9
  %99 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %100 = call i32 @PlayPCM(ptr noundef %98, ptr noundef %99, i32 noundef 1)
  store i32 %100, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %96, %90
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = load ptr, ptr %5, align 8, !tbaa !9
  %104 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %105 = call i32 @PV_ParseCommands(i32 noundef %102, ptr noundef %103, ptr noundef @.str.11, i32 noundef 1, ptr noundef %104)
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %112

107:                                              ; preds = %101
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %109 = load ptr, ptr %7, align 8, !tbaa !9
  %110 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %111 = call i32 @PlayPCMStreamed(ptr noundef %109, ptr noundef %110, i32 noundef 1)
  store i32 %111, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %107, %101
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = load ptr, ptr %5, align 8, !tbaa !9
  %115 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %116 = call i32 @PV_ParseCommands(i32 noundef %113, ptr noundef %114, ptr noundef @.str.13, i32 noundef 1, ptr noundef %115)
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %123

118:                                              ; preds = %112
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %120 = load ptr, ptr %7, align 8, !tbaa !9
  %121 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %122 = call i32 @PlayPCM(ptr noundef %120, ptr noundef %121, i32 noundef 2)
  store i32 %122, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %118, %112
  %124 = load i32, ptr %4, align 4, !tbaa !5
  %125 = load ptr, ptr %5, align 8, !tbaa !9
  %126 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %127 = call i32 @PV_ParseCommands(i32 noundef %124, ptr noundef %125, ptr noundef @.str.15, i32 noundef 1, ptr noundef %126)
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %134

129:                                              ; preds = %123
  %130 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %131 = load ptr, ptr %7, align 8, !tbaa !9
  %132 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %133 = call i32 @PlayPCMStreamed(ptr noundef %131, ptr noundef %132, i32 noundef 2)
  store i32 %133, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %129, %123
  %135 = load i32, ptr %4, align 4, !tbaa !5
  %136 = load ptr, ptr %5, align 8, !tbaa !9
  %137 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %138 = call i32 @PV_ParseCommands(i32 noundef %135, ptr noundef %136, ptr noundef @.str.17, i32 noundef 1, ptr noundef %137)
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %140, label %145

140:                                              ; preds = %134
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %142 = load ptr, ptr %7, align 8, !tbaa !9
  %143 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %144 = call i32 @PlayRMF(ptr noundef %142, ptr noundef %143)
  store i32 %144, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %140, %134
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = load ptr, ptr %5, align 8, !tbaa !9
  %148 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %149 = call i32 @PV_ParseCommands(i32 noundef %146, ptr noundef %147, ptr noundef @.str.19, i32 noundef 1, ptr noundef %148)
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %156

151:                                              ; preds = %145
  %152 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %153 = load ptr, ptr %7, align 8, !tbaa !9
  %154 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %155 = call i32 @PlayMidi(ptr noundef %153, ptr noundef %154)
  store i32 %155, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %151, %145
  %157 = load i32, ptr @gWriteToFile, align 4, !tbaa !5
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %160

159:                                              ; preds = %156
  call void @BAEMixer_StopOutputToFile()
  br label %160

160:                                              ; preds = %159, %156
  br label %164

161:                                              ; preds = %35
  %162 = load i32, ptr %6, align 4, !tbaa !5
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %162)
  br label %164

164:                                              ; preds = %161, %160
  br label %167

165:                                              ; preds = %2
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  br label %167

167:                                              ; preds = %165, %164
  %168 = load i32, ptr %12, align 4, !tbaa !5
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %167
  %171 = call i32 (ptr, ...) @printf(ptr noundef @usageString)
  br label %172

172:                                              ; preds = %170, %167
  call void @BAE_WaitMicroseconds(i64 noundef 160000)
  %173 = load ptr, ptr %7, align 8, !tbaa !9
  %174 = call i32 @BAEMixer_Delete(ptr noundef %173)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  ret i32 0
}

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

declare ptr @BAEMixer_New() #2

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

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

declare i32 @BAEMixer_Open(ptr noundef, i32 noundef, i32 noundef, i64 noundef, i16 noundef signext, i16 noundef signext, i16 noundef signext, i8 noundef signext) #2

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

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

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

declare i64 @BAE_GetSizeOfMemoryUsed() #2

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

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

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

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

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

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

declare void @BAEMixer_StopOutputToFile() #2

declare void @BAE_WaitMicroseconds(i64 noundef) #2

declare i32 @BAEMixer_Delete(ptr noundef) #2

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

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 = { inlinehint nounwind willreturn memory(read) 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 #4 = { nounwind }
attributes #5 = { 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, !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 = !{!"short", !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"

@usageString = external dso_local constant [369 x i8], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [49 x i8], align 1
@gWriteToFile = external hidden local_unnamed_addr global i32, align 4
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [25 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 ptr, align 8
  %4 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #5
  %5 = tail call ptr @BAEMixer_New() #5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %68, label %6

6:                                                ; preds = %2
  %7 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str, i32 noundef 1, ptr noundef nonnull %4)
  %.not49 = icmp eq i32 %7, 0
  br i1 %.not49, label %10, label %8

8:                                                ; preds = %6
  %9 = call i32 @atoi(ptr nocapture noundef %4) #6
  br label %10

10:                                               ; preds = %8, %6
  %.0 = phi i32 [ %9, %8 ], [ 44100, %6 ]
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 63, i32 noundef 1, i32 noundef %.0)
  %12 = call i32 @BAEMixer_Open(ptr noundef nonnull %5, i32 noundef %.0, i32 noundef 2, i64 noundef 3, i16 noundef signext 63, i16 noundef signext 1, i16 noundef signext 21, i8 noundef signext 1) #5
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %66

14:                                               ; preds = %10
  %15 = call i32 @BAEMixer_SetAudioTask(ptr noundef nonnull %5, ptr noundef nonnull @PV_Task, ptr noundef nonnull %5) #5
  %16 = call i32 @BAEMixer_SetDefaultReverb(ptr noundef nonnull %5, i32 noundef 8) #5
  %17 = call i64 @BAE_GetSizeOfMemoryUsed() #5
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %17)
  %19 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.3, i32 noundef 1, ptr noundef nonnull %4)
  %.not50 = icmp eq i32 %19, 0
  br i1 %.not50, label %25, label %20

20:                                               ; preds = %14
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %4)
  %22 = call i32 @BAEMixer_AddBankFromFile(ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %3) #5
  %23 = call i64 @BAE_GetSizeOfMemoryUsed() #5
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %23)
  br label %25

25:                                               ; preds = %20, %14
  %26 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.6, i32 noundef 1, ptr noundef nonnull %4)
  %.not51 = icmp eq i32 %26, 0
  br i1 %.not51, label %33, label %27

27:                                               ; preds = %25
  %28 = call i32 @BAEMixer_StartOutputToFile(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 2, i32 noundef 0) #5
  %.not52 = icmp eq i32 %28, 0
  br i1 %.not52, label %31, label %29

29:                                               ; preds = %27
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %28)
  br label %33

31:                                               ; preds = %27
  store i32 1, ptr @gWriteToFile, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %4)
  br label %33

33:                                               ; preds = %29, %31, %25
  %34 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.9, i32 noundef 1, ptr noundef nonnull %4)
  %.not53 = icmp eq i32 %34, 0
  br i1 %.not53, label %38, label %35

35:                                               ; preds = %33
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %37 = call i32 @PlayPCM(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 1)
  br label %38

38:                                               ; preds = %35, %33
  %.045 = phi i32 [ 1, %35 ], [ 0, %33 ]
  %39 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.11, i32 noundef 1, ptr noundef nonnull %4)
  %.not54 = icmp eq i32 %39, 0
  br i1 %.not54, label %43, label %40

40:                                               ; preds = %38
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %42 = call i32 @PlayPCMStreamed(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 1)
  br label %43

43:                                               ; preds = %40, %38
  %.1 = phi i32 [ 1, %40 ], [ %.045, %38 ]
  %44 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.13, i32 noundef 1, ptr noundef nonnull %4)
  %.not55 = icmp eq i32 %44, 0
  br i1 %.not55, label %48, label %45

45:                                               ; preds = %43
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %47 = call i32 @PlayPCM(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 2)
  br label %48

48:                                               ; preds = %45, %43
  %.2 = phi i32 [ 1, %45 ], [ %.1, %43 ]
  %49 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.15, i32 noundef 1, ptr noundef nonnull %4)
  %.not56 = icmp eq i32 %49, 0
  br i1 %.not56, label %53, label %50

50:                                               ; preds = %48
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %52 = call i32 @PlayPCMStreamed(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 2)
  br label %53

53:                                               ; preds = %50, %48
  %.3 = phi i32 [ 1, %50 ], [ %.2, %48 ]
  %54 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.17, i32 noundef 1, ptr noundef nonnull %4)
  %.not57 = icmp eq i32 %54, 0
  br i1 %.not57, label %58, label %55

55:                                               ; preds = %53
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %57 = call i32 @PlayRMF(ptr noundef nonnull %5, ptr noundef nonnull %4)
  br label %58

58:                                               ; preds = %55, %53
  %.4 = phi i32 [ 1, %55 ], [ %.3, %53 ]
  %59 = call i32 @PV_ParseCommands(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.19, i32 noundef 1, ptr noundef nonnull %4)
  %.not58 = icmp eq i32 %59, 0
  br i1 %.not58, label %63, label %60

60:                                               ; preds = %58
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %62 = call i32 @PlayMidi(ptr noundef nonnull %5, ptr noundef nonnull %4)
  br label %63

63:                                               ; preds = %60, %58
  %.5 = phi i32 [ 1, %60 ], [ %.4, %58 ]
  %64 = load i32, ptr @gWriteToFile, align 4, !tbaa !5
  %.not59 = icmp eq i32 %64, 0
  br i1 %.not59, label %70, label %65

65:                                               ; preds = %63
  call void @BAEMixer_StopOutputToFile() #5
  br label %70

66:                                               ; preds = %10
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %12)
  br label %.thread

68:                                               ; preds = %2
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  br label %.thread

70:                                               ; preds = %65, %63
  %71 = icmp eq i32 %.5, 0
  br i1 %71, label %.thread, label %73

.thread:                                          ; preds = %68, %66, %70
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @usageString)
  br label %73

73:                                               ; preds = %.thread, %70
  call void @BAE_WaitMicroseconds(i64 noundef 160000) #5
  %74 = call i32 @BAEMixer_Delete(ptr noundef %5) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  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

declare ptr @BAEMixer_New() local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

declare i32 @BAEMixer_Open(ptr noundef, i32 noundef, i32 noundef, i64 noundef, i16 noundef signext, i16 noundef signext, i16 noundef signext, i8 noundef signext) local_unnamed_addr #2

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

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

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

declare i64 @BAE_GetSizeOfMemoryUsed() local_unnamed_addr #2

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

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

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

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

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

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

declare void @BAEMixer_StopOutputToFile() local_unnamed_addr #2

declare void @BAE_WaitMicroseconds(i64 noundef) local_unnamed_addr #2

declare i32 @BAEMixer_Delete(ptr noundef) local_unnamed_addr #2

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

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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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