; LLVM IR from jgaeddert/liquid-dsp :: examples (modem_ber_example)

; 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.modulation_type_s = type { ptr, ptr, i32, i32 }

@__const.main.filename = external hidden unnamed_addr constant [20 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@modulation_types = external constant [53 x %struct.modulation_type_s], align 16
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca [20 x i8], align 16
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca { float, float }, align 4
  %22 = alloca float, align 4
  %23 = alloca ptr, align 8
  %24 = alloca float, align 4
  %25 = alloca i32, align 4
  %26 = alloca { float, float }, align 4
  %27 = alloca i32, align 4
  %28 = alloca float, 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) #7
  store i32 40, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store float -5.000000e+00, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store float 4.000000e+01, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store float 1.000000e+00, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1000000, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr %11) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 @__const.main.filename, i64 20, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  br label %29

29:                                               ; preds = %51, %2
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = call i32 @getopt(i32 noundef %30, ptr noundef %31, ptr noundef @.str.3) #7
  store i32 %32, ptr %12, align 4, !tbaa !5
  %33 = icmp ne i32 %32, -1
  br i1 %33, label %34, label %52

34:                                               ; preds = %29
  %35 = load i32, ptr %12, align 4, !tbaa !5
  switch i32 %35, label %50 [
    i32 104, label %36
    i32 109, label %37
  ]

36:                                               ; preds = %34
  call void @usage()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %191

37:                                               ; preds = %34
  %38 = load ptr, ptr @optarg, align 8, !tbaa !9
  %39 = call i32 @liquid_getopt_str2mod(ptr noundef %38)
  store i32 %39, ptr %6, align 4, !tbaa !5
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %49

42:                                               ; preds = %37
  %43 = load ptr, ptr @stderr, align 8, !tbaa !9
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 0
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = load ptr, ptr @optarg, align 8, !tbaa !9
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.4, ptr noundef %46, ptr noundef %47) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %191

49:                                               ; preds = %37
  br label %51

50:                                               ; preds = %34
  call void @exit(i32 noundef 1) #8
  unreachable

51:                                               ; preds = %49
  br label %29, !llvm.loop !13

52:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = call ptr @modem_create(i32 noundef %53)
  store ptr %54, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = call ptr @modem_create(i32 noundef %55)
  store ptr %56, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %57 = load ptr, ptr %14, align 8, !tbaa !9
  %58 = call i32 @modem_get_bps(ptr noundef %57)
  store i32 %58, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %59 = load i32, ptr %16, align 4, !tbaa !5
  %60 = shl i32 1, %59
  store i32 %60, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds [53 x %struct.modulation_type_s], ptr @modulation_types, i64 0, i64 %62
  %64 = getelementptr inbounds %struct.modulation_type_s, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %65)
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef @.str.7, ptr noundef @.str.8, ptr noundef @.str.9, ptr noundef @.str.10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %68 = load float, ptr %7, align 4, !tbaa !11
  store float %68, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %69 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 0
  %70 = call noalias ptr @fopen(ptr noundef %69, ptr noundef @.str.11)
  store ptr %70, ptr %23, align 8, !tbaa !9
  %71 = load ptr, ptr %23, align 8, !tbaa !9
  %72 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 0
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.12, ptr noundef %72) #7
  %74 = load ptr, ptr %23, align 8, !tbaa !9
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds [53 x %struct.modulation_type_s], ptr @modulation_types, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.modulation_type_s, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.13, ptr noundef %79) #7
  br label %81

81:                                               ; preds = %177, %52
  br label %82

82:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %83 = load float, ptr %22, align 4, !tbaa !11
  %84 = fneg float %83
  %85 = fdiv float %84, 2.000000e+01
  %86 = call float @powf(float noundef 1.000000e+01, float noundef %85) #7
  store float %86, ptr %24, align 4, !tbaa !11
  %87 = load ptr, ptr %14, align 8, !tbaa !9
  %88 = call i32 @modem_reset(ptr noundef %87)
  %89 = load ptr, ptr %15, align 8, !tbaa !9
  %90 = call i32 @modem_reset(ptr noundef %89)
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %135, %82
  %92 = load i32, ptr %18, align 4, !tbaa !5
  %93 = load i32, ptr %10, align 4, !tbaa !5
  %94 = icmp ult i32 %92, %93
  br i1 %94, label %95, label %138

95:                                               ; preds = %91
  %96 = call i32 @rand() #7
  %97 = load i32, ptr %17, align 4, !tbaa !5
  %98 = urem i32 %96, %97
  store i32 %98, ptr %19, align 4, !tbaa !5
  %99 = load ptr, ptr %14, align 8, !tbaa !9
  %100 = load i32, ptr %19, align 4, !tbaa !5
  %101 = call i32 @modem_modulate(ptr noundef %99, i32 noundef %100, ptr noundef %21)
  %102 = load float, ptr %24, align 4, !tbaa !11
  %103 = call float (...) @randnf()
  %104 = call float (...) @randnf()
  %105 = fmul float 0.000000e+00, %104
  %106 = fmul float 1.000000e+00, %104
  %107 = fadd float %103, %105
  %108 = fmul float %102, %107
  %109 = fmul float %102, %106
  %110 = call float @sqrtf(float noundef 2.000000e+00) #7
  %111 = fdiv float %108, %110
  %112 = fdiv float %109, %110
  %113 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 0
  %114 = load float, ptr %113, align 4
  %115 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 1
  %116 = load float, ptr %115, align 4
  %117 = fadd float %114, %111
  %118 = fadd float %116, %112
  %119 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 0
  %120 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 1
  store float %117, ptr %119, align 4
  store float %118, ptr %120, align 4
  %121 = load ptr, ptr %15, align 8, !tbaa !9
  %122 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 0
  %123 = load float, ptr %122, align 4
  %124 = getelementptr inbounds { float, float }, ptr %21, i32 0, i32 1
  %125 = load float, ptr %124, align 4
  %126 = getelementptr inbounds { float, float }, ptr %26, i32 0, i32 0
  %127 = getelementptr inbounds { float, float }, ptr %26, i32 0, i32 1
  store float %123, ptr %126, align 4
  store float %125, ptr %127, align 4
  %128 = load <2 x float>, ptr %26, align 4
  %129 = call i32 @modem_demodulate(ptr noundef %121, <2 x float> noundef %128, ptr noundef %20)
  %130 = load i32, ptr %19, align 4, !tbaa !5
  %131 = load i32, ptr %20, align 4, !tbaa !5
  %132 = call i32 @count_bit_errors(i32 noundef %130, i32 noundef %131)
  %133 = load i32, ptr %25, align 4, !tbaa !5
  %134 = add i32 %133, %132
  store i32 %134, ptr %25, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %95
  %136 = load i32, ptr %18, align 4, !tbaa !5
  %137 = add i32 %136, 1
  store i32 %137, ptr %18, align 4, !tbaa !5
  br label %91, !llvm.loop !17

138:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %139 = load i32, ptr %16, align 4, !tbaa !5
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = mul i32 %139, %140
  store i32 %141, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %142 = load i32, ptr %25, align 4, !tbaa !5
  %143 = uitofp i32 %142 to float
  %144 = load i32, ptr %27, align 4, !tbaa !5
  %145 = uitofp i32 %144 to float
  %146 = fdiv float %143, %145
  store float %146, ptr %28, align 4, !tbaa !11
  %147 = load float, ptr %22, align 4, !tbaa !11
  %148 = fpext float %147 to double
  %149 = load i32, ptr %25, align 4, !tbaa !5
  %150 = load i32, ptr %27, align 4, !tbaa !5
  %151 = load float, ptr %28, align 4, !tbaa !11
  %152 = fpext float %151 to double
  %153 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, double noundef %148, i32 noundef %149, i32 noundef %150, double noundef %152)
  %154 = load i32, ptr %25, align 4, !tbaa !5
  %155 = icmp ugt i32 %154, 0
  br i1 %155, label %156, label %163

156:                                              ; preds = %138
  %157 = load ptr, ptr %23, align 8, !tbaa !9
  %158 = load float, ptr %22, align 4, !tbaa !11
  %159 = fpext float %158 to double
  %160 = load float, ptr %28, align 4, !tbaa !11
  %161 = fpext float %160 to double
  %162 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %157, ptr noundef @.str.15, double noundef %159, double noundef %161) #7
  br label %163

163:                                              ; preds = %156, %138
  %164 = load float, ptr %9, align 4, !tbaa !11
  %165 = load float, ptr %22, align 4, !tbaa !11
  %166 = fadd float %165, %164
  store float %166, ptr %22, align 4, !tbaa !11
  %167 = load float, ptr %22, align 4, !tbaa !11
  %168 = load float, ptr %8, align 4, !tbaa !11
  %169 = fcmp ogt float %167, %168
  br i1 %169, label %173, label %170

170:                                              ; preds = %163
  %171 = load i32, ptr %25, align 4, !tbaa !5
  %172 = icmp eq i32 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %170, %163
  store i32 6, ptr %13, align 4
  br label %175

174:                                              ; preds = %170
  store i32 0, ptr %13, align 4
  br label %175

175:                                              ; preds = %174, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  %176 = load i32, ptr %13, align 4
  switch i32 %176, label %193 [
    i32 0, label %177
    i32 6, label %178
  ]

177:                                              ; preds = %175
  br label %81

178:                                              ; preds = %175
  %179 = load ptr, ptr %23, align 8, !tbaa !9
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %179, ptr noundef @.str.16) #7
  %181 = load ptr, ptr %23, align 8, !tbaa !9
  %182 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %181, ptr noundef @.str.17) #7
  %183 = load ptr, ptr %23, align 8, !tbaa !9
  %184 = call i32 @fclose(ptr noundef %183)
  %185 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 0
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, ptr noundef %185)
  %187 = load ptr, ptr %14, align 8, !tbaa !9
  %188 = call i32 @modem_destroy(ptr noundef %187)
  %189 = load ptr, ptr %15, align 8, !tbaa !9
  %190 = call i32 @modem_destroy(ptr noundef %189)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %191

191:                                              ; preds = %178, %42, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %192 = load i32, ptr %3, align 4
  ret i32 %192

193:                                              ; preds = %175
  unreachable
}

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

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #5

declare i32 @liquid_getopt_str2mod(ptr noundef) #1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

declare ptr @modem_create(i32 noundef) #1

declare i32 @modem_get_bps(ptr noundef) #1

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

; Function Attrs: nounwind
declare float @powf(float noundef, float noundef) #5

declare i32 @modem_reset(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @rand() #5

declare i32 @modem_modulate(ptr noundef, i32 noundef, ptr noundef) #1

declare float @randnf(...) #1

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #5

declare i32 @modem_demodulate(ptr noundef, <2 x float> noundef, ptr noundef) #1

declare i32 @count_bit_errors(i32 noundef, i32 noundef) #1

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

declare i32 @fclose(ptr noundef) #1

declare i32 @modem_destroy(ptr noundef) #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 = { "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 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"modulation_type_s", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20}
!17 = distinct !{!17, !14}


; 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.modulation_type_s = type { ptr, ptr, i32, i32 }

@__const.main.filename = external hidden unnamed_addr constant [20 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@modulation_types = external local_unnamed_addr constant [53 x %struct.modulation_type_s], align 16
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [20 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca { float, float }, align 8
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %3) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %3, ptr noundef nonnull align 16 dereferenceable(20) @__const.main.filename, i64 20, i1 false)
  br label %6

6:                                                ; preds = %9, %2
  %.052 = phi i32 [ 40, %2 ], [ %11, %9 ]
  %7 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.3) #9
  switch i32 %7, label %18 [
    i32 -1, label %19
    i32 104, label %8
    i32 109, label %9
  ]

8:                                                ; preds = %6
  tail call void @usage()
  br label %74

9:                                                ; preds = %6
  %10 = load ptr, ptr @optarg, align 8, !tbaa !5
  %11 = tail call i32 @liquid_getopt_str2mod(ptr noundef %10) #9
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %6, !llvm.loop !9

13:                                               ; preds = %9
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = load ptr, ptr @optarg, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.4, ptr noundef %15, ptr noundef %16) #10
  br label %74

18:                                               ; preds = %6
  tail call void @exit(i32 noundef 1) #11
  unreachable

19:                                               ; preds = %6
  %20 = tail call ptr @modem_create(i32 noundef %.052) #9
  %21 = tail call ptr @modem_create(i32 noundef %.052) #9
  %22 = tail call i32 @modem_get_bps(ptr noundef %20) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %23 = zext i32 %.052 to i64
  %24 = getelementptr inbounds [53 x %struct.modulation_type_s], ptr @modulation_types, i64 0, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %25)
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.10)
  %28 = call noalias ptr @fopen(ptr noundef nonnull %3, ptr noundef nonnull @.str.11)
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.12, ptr noundef nonnull %3) #9
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.13, ptr noundef %25) #9
  %31 = mul i32 %22, 1000000
  %notmask = shl nsw i32 -1, %22
  %32 = xor i32 %notmask, -1
  %33 = uitofp i32 %31 to float
  br label %34

34:                                               ; preds = %66, %19
  %.056.int = phi i32 [ -5, %19 ], [ %.int, %66 ]
  %indvar.conv = sitofp i32 %.056.int to float
  %35 = fdiv float %indvar.conv, -2.000000e+01
  %36 = call float @powf(float noundef 1.000000e+01, float noundef %35) #9
  %37 = call i32 @modem_reset(ptr noundef %20) #9
  %38 = call i32 @modem_reset(ptr noundef %21) #9
  %39 = insertelement <2 x float> poison, float %36, i64 0
  %40 = shufflevector <2 x float> %39, <2 x float> poison, <2 x i32> zeroinitializer
  br label %41

41:                                               ; preds = %34, %41
  %.05365 = phi i32 [ 0, %34 ], [ %58, %41 ]
  %.05564 = phi i32 [ 0, %34 ], [ %59, %41 ]
  %42 = call i32 @rand() #9
  %43 = and i32 %42, %32
  %44 = call i32 @modem_modulate(ptr noundef %20, i32 noundef %43, ptr noundef nonnull %5) #9
  %45 = call float (...) @randnf() #9
  %46 = call float (...) @randnf() #9
  %47 = fmul float %46, 0.000000e+00
  %48 = fadd float %45, %47
  %49 = insertelement <2 x float> poison, float %48, i64 0
  %50 = insertelement <2 x float> %49, float %46, i64 1
  %51 = fmul <2 x float> %40, %50
  %52 = fdiv <2 x float> %51, <float 0x3FF6A09E60000000, float 0x3FF6A09E60000000>
  %53 = load <2 x float>, ptr %5, align 8
  %54 = fadd <2 x float> %53, %52
  store <2 x float> %54, ptr %5, align 8
  %55 = call i32 @modem_demodulate(ptr noundef %21, <2 x float> noundef %54, ptr noundef nonnull %4) #9
  %56 = load i32, ptr %4, align 4, !tbaa !14
  %57 = call i32 @count_bit_errors(i32 noundef %43, i32 noundef %56) #9
  %58 = add i32 %57, %.05365
  %59 = add nuw nsw i32 %.05564, 1
  %exitcond.not = icmp eq i32 %59, 1000000
  br i1 %exitcond.not, label %60, label %41, !llvm.loop !15

60:                                               ; preds = %41
  %61 = uitofp i32 %58 to float
  %62 = fdiv float %61, %33
  %63 = fpext float %indvar.conv to double
  %64 = fpext float %62 to double
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, double noundef %63, i32 noundef %58, i32 noundef %31, double noundef %64)
  %.not59 = icmp eq i32 %58, 0
  br i1 %.not59, label %.thread, label %66

66:                                               ; preds = %60
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.15, double noundef %63, double noundef %64) #9
  %.int = add nsw i32 %.056.int, 1
  %exitcond69 = icmp eq i32 %.int, 41
  br i1 %exitcond69, label %.thread, label %34

.thread:                                          ; preds = %60, %66
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.16) #9
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.17) #9
  %70 = call i32 @fclose(ptr noundef %28)
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, ptr noundef nonnull %3)
  %72 = call i32 @modem_destroy(ptr noundef %20) #9
  %73 = call i32 @modem_destroy(ptr noundef %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  br label %74

74:                                               ; preds = %.thread, %13, %8
  %.0 = phi i32 [ 1, %13 ], [ 0, %8 ], [ 0, %.thread ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %3) #9
  ret i32 %.0
}

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

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @liquid_getopt_str2mod(ptr noundef) local_unnamed_addr #6

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #7

declare ptr @modem_create(i32 noundef) local_unnamed_addr #6

declare i32 @modem_get_bps(ptr noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @powf(float noundef, float noundef) local_unnamed_addr #8

declare i32 @modem_reset(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #5

declare i32 @modem_modulate(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

declare float @randnf(...) local_unnamed_addr #6

declare i32 @modem_demodulate(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #6

declare i32 @count_bit_errors(i32 noundef, i32 noundef) local_unnamed_addr #6

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

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

declare i32 @modem_destroy(ptr noundef) local_unnamed_addr #6

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 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { "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 = { 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 #8 = { mustprogress nofree nounwind willreturn memory(write) "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 #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"modulation_type_s", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = distinct !{!15, !10}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass