; LLVM IR from DroneBridge/DroneBridge :: control (control_main_ground)

; 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.timespec = type { i64, i64 }

@opterr = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@optarg = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [803 x i8], align 1
@stderr = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [218 x i8], align 1

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

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

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

declare void @syslog(i32 noundef, ptr noundef, ...) #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 [128 x i8], align 16
  %7 = alloca [500 x i8], align 16
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca [4 x [16 x i8]], align 16
  %20 = alloca double, align 8
  %21 = alloca %struct.timespec, align 8
  %22 = 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
  %23 = call i32 @atexit(ptr noundef @close_raw_interfaces) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 500, ptr %7) #7
  call void @llvm.memset.p0.i64(ptr align 16 %7, i8 0, i64 500, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #7
  store i8 109, ptr %15, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #7
  store i8 78, ptr %16, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 60, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %19) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 5, ptr %13, align 4, !tbaa !5
  store i32 1, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %14, align 4, !tbaa !5
  store i8 -56, ptr %8, align 1, !tbaa !11
  store i8 2, ptr %9, align 1, !tbaa !11
  store i32 0, ptr @opterr, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %85, %2
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = call i32 @getopt(i32 noundef %25, ptr noundef %26, ptr noundef @.str.2) #7
  store i32 %27, ptr %11, align 4, !tbaa !5
  %28 = icmp ne i32 %27, -1
  br i1 %28, label %29, label %86

29:                                               ; preds = %24
  %30 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %30, label %84 [
    i32 110, label %31
    i32 106, label %44
    i32 109, label %48
    i32 98, label %51
    i32 118, label %55
    i32 111, label %59
    i32 99, label %62
    i32 116, label %66
    i32 97, label %70
    i32 114, label %74
    i32 63, label %78
  ]

31:                                               ; preds = %29
  %32 = load i32, ptr %17, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 4
  br i1 %33, label %34, label %43

34:                                               ; preds = %31
  %35 = load i32, ptr %17, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [4 x [16 x i8]], ptr %19, i64 0, i64 %36
  %38 = getelementptr inbounds [16 x i8], ptr %37, i64 0, i64 0
  %39 = load ptr, ptr @optarg, align 8, !tbaa !9
  %40 = call ptr @strncpy(ptr noundef %38, ptr noundef %39, i64 noundef 16) #7
  %41 = load i32, ptr %17, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %17, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %34, %31
  br label %85

44:                                               ; preds = %29
  %45 = load ptr, ptr @optarg, align 8, !tbaa !9
  %46 = call i64 @strtol(ptr noundef %45, ptr noundef null, i32 noundef 10) #7
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %10, align 4, !tbaa !5
  br label %85

48:                                               ; preds = %29
  %49 = load ptr, ptr @optarg, align 8, !tbaa !9
  %50 = load i8, ptr %49, align 1, !tbaa !11
  store i8 %50, ptr %15, align 1, !tbaa !11
  br label %85

51:                                               ; preds = %29
  %52 = load ptr, ptr @optarg, align 8, !tbaa !9
  %53 = call i64 @strtol(ptr noundef %52, ptr noundef null, i32 noundef 10) #7
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %12, align 4, !tbaa !5
  br label %85

55:                                               ; preds = %29
  %56 = load ptr, ptr @optarg, align 8, !tbaa !9
  %57 = call i64 @strtol(ptr noundef %56, ptr noundef null, i32 noundef 10) #7
  %58 = trunc i64 %57 to i32
  store i32 %58, ptr %13, align 4, !tbaa !5
  br label %85

59:                                               ; preds = %29
  %60 = load ptr, ptr @optarg, align 8, !tbaa !9
  %61 = load i8, ptr %60, align 1, !tbaa !11
  store i8 %61, ptr %16, align 1, !tbaa !11
  br label %85

62:                                               ; preds = %29
  %63 = load ptr, ptr @optarg, align 8, !tbaa !9
  %64 = call i64 @strtol(ptr noundef %63, ptr noundef null, i32 noundef 10) #7
  %65 = trunc i64 %64 to i8
  store i8 %65, ptr %8, align 1, !tbaa !11
  br label %85

66:                                               ; preds = %29
  %67 = load ptr, ptr @optarg, align 8, !tbaa !9
  %68 = call i64 @strtol(ptr noundef %67, ptr noundef null, i32 noundef 10) #7
  %69 = trunc i64 %68 to i8
  store i8 %69, ptr %9, align 1, !tbaa !11
  br label %85

70:                                               ; preds = %29
  %71 = load ptr, ptr @optarg, align 8, !tbaa !9
  %72 = call i64 @strtol(ptr noundef %71, ptr noundef null, i32 noundef 10) #7
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %14, align 4, !tbaa !5
  br label %85

74:                                               ; preds = %29
  %75 = load ptr, ptr @optarg, align 8, !tbaa !9
  %76 = call i64 @strtol(ptr noundef %75, ptr noundef null, i32 noundef 10) #7
  %77 = trunc i64 %76 to i32
  store i32 %77, ptr %18, align 4, !tbaa !5
  br label %85

78:                                               ; preds = %29
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef 60, i32 noundef %82)
  call void @exit(i32 noundef 0) #8
  unreachable

84:                                               ; preds = %29
  call void @abort() #8
  unreachable

85:                                               ; preds = %74, %70, %66, %62, %59, %55, %51, %48, %44, %43
  br label %24, !llvm.loop !12

86:                                               ; preds = %24
  %87 = getelementptr inbounds [4 x [16 x i8]], ptr %19, i64 0, i64 0
  %88 = load i32, ptr %17, align 4, !tbaa !5
  %89 = load i8, ptr %8, align 1, !tbaa !11
  %90 = zext i8 %89 to i32
  %91 = load i8, ptr %15, align 1, !tbaa !11
  %92 = load i32, ptr %12, align 4, !tbaa !5
  %93 = load i8, ptr %9, align 1, !tbaa !11
  %94 = zext i8 %93 to i32
  %95 = load i32, ptr %13, align 4, !tbaa !5
  %96 = load i8, ptr %16, align 1, !tbaa !11
  %97 = load i32, ptr %14, align 4, !tbaa !5
  call void @conf_rc(ptr noundef %87, i32 noundef %88, i32 noundef %90, i8 noundef signext %91, i32 noundef %92, i32 noundef %94, i32 noundef %95, i8 noundef signext %96, i32 noundef %97)
  call void (...) @open_rc_shm()
  %98 = load i32, ptr %18, align 4, !tbaa !5
  %99 = icmp sle i32 %98, 0
  br i1 %99, label %100, label %106

100:                                              ; preds = %86
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr @stderr, align 8, !tbaa !9
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef @.str.7) #7
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.7)
  br label %104

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %104
  store i32 60, ptr %18, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %105, %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %107 = load i32, ptr %18, align 4, !tbaa !5
  %108 = sitofp i32 %107 to double
  %109 = fdiv double 1.000000e+09, %108
  store double %109, ptr %20, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  %110 = getelementptr inbounds %struct.timespec, ptr %21, i32 0, i32 0
  store i64 0, ptr %110, align 8, !tbaa !16
  %111 = load double, ptr %20, align 8, !tbaa !14
  %112 = fptosi double %111 to i64
  %113 = getelementptr inbounds %struct.timespec, ptr %21, i32 0, i32 1
  store i64 %112, ptr %113, align 8, !tbaa !19
  br label %114

114:                                              ; preds = %106
  %115 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.8)
  br label %116

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = call i32 @detect_RC(i32 noundef %118)
  store i32 %119, ptr %22, align 4, !tbaa !5
  %120 = load i32, ptr %22, align 4, !tbaa !5
  %121 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 0
  %122 = call i32 (i32, i64, ...) @ioctl(i32 noundef %120, i64 noundef 2155899411, ptr noundef %121) #7
  %123 = icmp slt i32 %122, 0
  br i1 %123, label %124, label %127

124:                                              ; preds = %117
  %125 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 0
  %126 = call ptr @strncpy(ptr noundef %125, ptr noundef @.str.9, i64 noundef 128) #7
  br label %127

127:                                              ; preds = %124, %117
  %128 = load i32, ptr %22, align 4, !tbaa !5
  %129 = call i32 @close(i32 noundef %128)
  br label %130

130:                                              ; preds = %127
  %131 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 0
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, ptr noundef %131)
  %133 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 0
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.10, ptr noundef %133)
  br label %134

134:                                              ; preds = %130
  br label %135

135:                                              ; preds = %134
  %136 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 0
  %137 = call i32 @strcmp(ptr noundef @.str.11, ptr noundef %136) #9
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %149

139:                                              ; preds = %135
  br label %140

140:                                              ; preds = %139
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.12)
  br label %142

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 0
  %146 = load i64, ptr %145, align 8
  %147 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 1
  %148 = load i64, ptr %147, align 8
  call void @i6S(i32 noundef %144, i64 %146, i64 %148)
  br label %163

149:                                              ; preds = %135
  br label %150

150:                                              ; preds = %149
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.13)
  br label %152

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152
  %154 = getelementptr inbounds [500 x i8], ptr %7, i64 0, i64 0
  %155 = call ptr @strcpy(ptr noundef %154, ptr noundef @.str.14) #7
  %156 = getelementptr inbounds [500 x i8], ptr %7, i64 0, i64 0
  %157 = load i32, ptr %10, align 4, !tbaa !5
  call void @do_calibration(ptr noundef %156, i32 noundef %157)
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 0
  %160 = load i64, ptr %159, align 8
  %161 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 1
  %162 = load i64, ptr %161, align 8
  call void @opentx(i32 noundef %158, i64 %160, i64 %162)
  br label %163

163:                                              ; preds = %153, %143
  call void @exit(i32 noundef 0) #8
  unreachable
}

; Function Attrs: nounwind
declare i32 @atexit(ptr noundef) #3

declare void @close_raw_interfaces(...) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #3

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

; Function Attrs: noreturn nounwind
declare void @abort() #5

declare void @conf_rc(ptr noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef) #2

declare void @open_rc_shm(...) #2

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

; Function Attrs: nounwind
declare i32 @ioctl(i32 noundef, i64 noundef, ...) #3

declare i32 @close(i32 noundef) #2

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

declare void @i6S(i32 noundef, i64, i64) #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

declare void @do_calibration(ptr noundef, i32 noundef) #2

declare void @opentx(i32 noundef, i64, i64) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !18, i64 0}
!17 = !{!"timespec", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !18, i64 8}


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

@opterr = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [803 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [218 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @detect_RC(i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca [128 x i8], align 16
  %4 = alloca [500 x i8], align 16
  %5 = alloca [4 x [16 x i8]], align 16
  %6 = tail call i32 @atexit(ptr noundef nonnull @close_raw_interfaces) #11
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #11
  call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %4) #11
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(500) %4, i8 0, i64 500, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #11
  store i32 0, ptr @opterr, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %.backedge, %2
  %.041 = phi i32 [ 5, %2 ], [ %.041.be, %.backedge ]
  %.039 = phi i32 [ 0, %2 ], [ %.039.be, %.backedge ]
  %.037 = phi i8 [ 109, %2 ], [ %.037.be, %.backedge ]
  %.035 = phi i8 [ 78, %2 ], [ %.035.be, %.backedge ]
  %.033 = phi i32 [ 0, %2 ], [ %.033.be, %.backedge ]
  %.031 = phi i32 [ 60, %2 ], [ %.031.be, %.backedge ]
  %.029 = phi i32 [ 1, %2 ], [ %.029.be, %.backedge ]
  %.027 = phi i32 [ 0, %2 ], [ %.027.be, %.backedge ]
  %.025 = phi i8 [ 2, %2 ], [ %.025.be, %.backedge ]
  %.0 = phi i8 [ -56, %2 ], [ %.0.be, %.backedge ]
  %8 = call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.2) #11
  switch i32 %8, label %56 [
    i32 -1, label %57
    i32 110, label %9
    i32 106, label %17
    i32 109, label %21
    i32 98, label %24
    i32 118, label %28
    i32 111, label %32
    i32 99, label %35
    i32 116, label %39
    i32 97, label %43
    i32 114, label %47
    i32 63, label %51
  ]

9:                                                ; preds = %7
  %10 = icmp slt i32 %.033, 4
  br i1 %10, label %11, label %.backedge

.backedge:                                        ; preds = %9, %11, %47, %43, %39, %35, %32, %28, %24, %21, %17
  %.041.be = phi i32 [ %.041, %47 ], [ %.041, %43 ], [ %.041, %39 ], [ %.041, %35 ], [ %.041, %32 ], [ %31, %28 ], [ %.041, %24 ], [ %.041, %21 ], [ %.041, %17 ], [ %.041, %11 ], [ %.041, %9 ]
  %.039.be = phi i32 [ %.039, %47 ], [ %46, %43 ], [ %.039, %39 ], [ %.039, %35 ], [ %.039, %32 ], [ %.039, %28 ], [ %.039, %24 ], [ %.039, %21 ], [ %.039, %17 ], [ %.039, %11 ], [ %.039, %9 ]
  %.037.be = phi i8 [ %.037, %47 ], [ %.037, %43 ], [ %.037, %39 ], [ %.037, %35 ], [ %.037, %32 ], [ %.037, %28 ], [ %.037, %24 ], [ %23, %21 ], [ %.037, %17 ], [ %.037, %11 ], [ %.037, %9 ]
  %.035.be = phi i8 [ %.035, %47 ], [ %.035, %43 ], [ %.035, %39 ], [ %.035, %35 ], [ %34, %32 ], [ %.035, %28 ], [ %.035, %24 ], [ %.035, %21 ], [ %.035, %17 ], [ %.035, %11 ], [ %.035, %9 ]
  %.033.be = phi i32 [ %.033, %47 ], [ %.033, %43 ], [ %.033, %39 ], [ %.033, %35 ], [ %.033, %32 ], [ %.033, %28 ], [ %.033, %24 ], [ %.033, %21 ], [ %.033, %17 ], [ %16, %11 ], [ %.033, %9 ]
  %.031.be = phi i32 [ %50, %47 ], [ %.031, %43 ], [ %.031, %39 ], [ %.031, %35 ], [ %.031, %32 ], [ %.031, %28 ], [ %.031, %24 ], [ %.031, %21 ], [ %.031, %17 ], [ %.031, %11 ], [ %.031, %9 ]
  %.029.be = phi i32 [ %.029, %47 ], [ %.029, %43 ], [ %.029, %39 ], [ %.029, %35 ], [ %.029, %32 ], [ %.029, %28 ], [ %27, %24 ], [ %.029, %21 ], [ %.029, %17 ], [ %.029, %11 ], [ %.029, %9 ]
  %.027.be = phi i32 [ %.027, %47 ], [ %.027, %43 ], [ %.027, %39 ], [ %.027, %35 ], [ %.027, %32 ], [ %.027, %28 ], [ %.027, %24 ], [ %.027, %21 ], [ %20, %17 ], [ %.027, %11 ], [ %.027, %9 ]
  %.025.be = phi i8 [ %.025, %47 ], [ %.025, %43 ], [ %42, %39 ], [ %.025, %35 ], [ %.025, %32 ], [ %.025, %28 ], [ %.025, %24 ], [ %.025, %21 ], [ %.025, %17 ], [ %.025, %11 ], [ %.025, %9 ]
  %.0.be = phi i8 [ %.0, %47 ], [ %.0, %43 ], [ %.0, %39 ], [ %38, %35 ], [ %.0, %32 ], [ %.0, %28 ], [ %.0, %24 ], [ %.0, %21 ], [ %.0, %17 ], [ %.0, %11 ], [ %.0, %9 ]
  br label %7, !llvm.loop !9

11:                                               ; preds = %9
  %12 = sext i32 %.033 to i64
  %13 = getelementptr inbounds [4 x [16 x i8]], ptr %5, i64 0, i64 %12
  %14 = load ptr, ptr @optarg, align 8, !tbaa !11
  %15 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) %14, i64 noundef 16) #11
  %16 = add nsw i32 %.033, 1
  br label %.backedge

17:                                               ; preds = %7
  %18 = load ptr, ptr @optarg, align 8, !tbaa !11
  %19 = call i64 @strtol(ptr nocapture noundef %18, ptr noundef null, i32 noundef 10) #11
  %20 = trunc i64 %19 to i32
  br label %.backedge

21:                                               ; preds = %7
  %22 = load ptr, ptr @optarg, align 8, !tbaa !11
  %23 = load i8, ptr %22, align 1, !tbaa !13
  br label %.backedge

24:                                               ; preds = %7
  %25 = load ptr, ptr @optarg, align 8, !tbaa !11
  %26 = call i64 @strtol(ptr nocapture noundef %25, ptr noundef null, i32 noundef 10) #11
  %27 = trunc i64 %26 to i32
  br label %.backedge

28:                                               ; preds = %7
  %29 = load ptr, ptr @optarg, align 8, !tbaa !11
  %30 = call i64 @strtol(ptr nocapture noundef %29, ptr noundef null, i32 noundef 10) #11
  %31 = trunc i64 %30 to i32
  br label %.backedge

32:                                               ; preds = %7
  %33 = load ptr, ptr @optarg, align 8, !tbaa !11
  %34 = load i8, ptr %33, align 1, !tbaa !13
  br label %.backedge

35:                                               ; preds = %7
  %36 = load ptr, ptr @optarg, align 8, !tbaa !11
  %37 = call i64 @strtol(ptr nocapture noundef %36, ptr noundef null, i32 noundef 10) #11
  %38 = trunc i64 %37 to i8
  br label %.backedge

39:                                               ; preds = %7
  %40 = load ptr, ptr @optarg, align 8, !tbaa !11
  %41 = call i64 @strtol(ptr nocapture noundef %40, ptr noundef null, i32 noundef 10) #11
  %42 = trunc i64 %41 to i8
  br label %.backedge

43:                                               ; preds = %7
  %44 = load ptr, ptr @optarg, align 8, !tbaa !11
  %45 = call i64 @strtol(ptr nocapture noundef %44, ptr noundef null, i32 noundef 10) #11
  %46 = trunc i64 %45 to i32
  br label %.backedge

47:                                               ; preds = %7
  %48 = load ptr, ptr @optarg, align 8, !tbaa !11
  %49 = call i64 @strtol(ptr nocapture noundef %48, ptr noundef null, i32 noundef 10) #11
  %50 = trunc i64 %49 to i32
  br label %.backedge

51:                                               ; preds = %7
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 60, i32 noundef %.029)
  call void @exit(i32 noundef 0) #12
  unreachable

56:                                               ; preds = %7
  call void @abort() #12
  unreachable

57:                                               ; preds = %7
  %58 = zext i8 %.0 to i32
  %59 = zext i8 %.025 to i32
  call void @conf_rc(ptr noundef nonnull %5, i32 noundef %.033, i32 noundef %58, i8 noundef signext %.037, i32 noundef %.029, i32 noundef %59, i32 noundef %.041, i8 noundef signext %.035, i32 noundef %.039) #11
  call void (...) @open_rc_shm() #11
  %60 = icmp slt i32 %.031, 1
  br i1 %60, label %61, label %64

61:                                               ; preds = %57
  %62 = load ptr, ptr @stderr, align 8, !tbaa !11
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef nonnull @.str.7) #13
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.7) #11
  br label %64

64:                                               ; preds = %61, %57
  %.2 = phi i32 [ 60, %61 ], [ %.031, %57 ]
  %65 = uitofp nneg i32 %.2 to double
  %66 = fdiv double 1.000000e+09, %65
  %67 = fptosi double %66 to i64
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.8) #11
  %69 = call i32 @detect_RC(i32 noundef %.027)
  %70 = call i32 (i32, i64, ...) @ioctl(i32 noundef %69, i64 noundef 2155899411, ptr noundef nonnull %3) #11
  %71 = icmp slt i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %64
  %73 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.9, i64 noundef 128) #11
  br label %74

74:                                               ; preds = %72, %64
  %75 = call i32 @close(i32 noundef %69) #11
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, ptr noundef nonnull %3)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.10, ptr noundef nonnull %3) #11
  %77 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef nonnull dereferenceable(1) %3) #14
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %74
  %80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.12) #11
  call void @i6S(i32 noundef %.027, i64 0, i64 %67) #11
  br label %84

81:                                               ; preds = %74
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.13) #11
  %83 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.14) #11
  call void @do_calibration(ptr noundef nonnull %4, i32 noundef %.027) #11
  call void @opentx(i32 noundef %.027, i64 0, i64 %67) #11
  br label %84

84:                                               ; preds = %81, %79
  call void @exit(i32 noundef 0) #12
  unreachable
}

; Function Attrs: nofree nounwind
declare i32 @atexit(ptr noundef) local_unnamed_addr #2

declare void @close_raw_interfaces(...) #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #8

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #9

declare void @conf_rc(ptr noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef) local_unnamed_addr #3

declare void @open_rc_shm(...) local_unnamed_addr #3

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #3

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

declare void @i6S(i32 noundef, i64, i64) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #7

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

declare void @opentx(i32 noundef, i64, i64) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 "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 = { 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 #10 = { 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 #11 = { nounwind }
attributes #12 = { noreturn nounwind }
attributes #13 = { cold nounwind }
attributes #14 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass