; LLVM IR from beagleboard/librobotcontrol :: examples/src (rc_test_servos)

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

@opterr = external global i32, align 4
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@running = external hidden global i32, align 4
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [30 x i8], align 1
@stdout = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [22 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 double, align 8
  %7 = alloca double, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = 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 8, ptr %6) #5
  store double 0.000000e+00, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store double 1.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 50, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr @opterr, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %111, %2
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = call i32 @getopt(i32 noundef %19, ptr noundef %20, ptr noundef @.str) #5
  store i32 %21, ptr %15, align 4, !tbaa !5
  %22 = icmp ne i32 %21, -1
  br i1 %22, label %23, label %112

23:                                               ; preds = %18
  %24 = load i32, ptr %15, align 4, !tbaa !5
  switch i32 %24, label %109 [
    i32 99, label %25
    i32 102, label %37
    i32 112, label %46
    i32 119, label %62
    i32 115, label %76
    i32 114, label %92
    i32 104, label %108
  ]

25:                                               ; preds = %23
  %26 = load ptr, ptr @optarg, align 8, !tbaa !9
  %27 = call i32 @atoi(ptr noundef %26) #6
  store i32 %27, ptr %10, align 4, !tbaa !5
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 1
  br i1 %29, label %33, label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %10, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 8
  br i1 %32, label %33, label %36

33:                                               ; preds = %30, %25
  %34 = load ptr, ptr @stderr, align 8, !tbaa !9
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.1, i32 noundef 1, i32 noundef 8) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

36:                                               ; preds = %30
  br label %111

37:                                               ; preds = %23
  %38 = load ptr, ptr @optarg, align 8, !tbaa !9
  %39 = call i32 @atoi(ptr noundef %38) #6
  store i32 %39, ptr %13, align 4, !tbaa !5
  %40 = load i32, ptr %13, align 4, !tbaa !5
  %41 = icmp slt i32 %40, 1
  br i1 %41, label %42, label %45

42:                                               ; preds = %37
  %43 = load ptr, ptr @stderr, align 8, !tbaa !9
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.2) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

45:                                               ; preds = %37
  br label %111

46:                                               ; preds = %23
  %47 = load i32, ptr %12, align 4, !tbaa !5
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %46
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

50:                                               ; preds = %46
  %51 = load ptr, ptr @optarg, align 8, !tbaa !9
  %52 = call double @atof(ptr noundef %51) #6
  store double %52, ptr %6, align 8, !tbaa !11
  %53 = load double, ptr %6, align 8, !tbaa !11
  %54 = fcmp ogt double %53, 1.500000e+00
  br i1 %54, label %58, label %55

55:                                               ; preds = %50
  %56 = load double, ptr %6, align 8, !tbaa !11
  %57 = fcmp olt double %56, -1.500000e+00
  br i1 %57, label %58, label %61

58:                                               ; preds = %55, %50
  %59 = load ptr, ptr @stderr, align 8, !tbaa !9
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.3) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

61:                                               ; preds = %55
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %111

62:                                               ; preds = %23
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

66:                                               ; preds = %62
  %67 = load ptr, ptr @optarg, align 8, !tbaa !9
  %68 = call double @atof(ptr noundef %67) #6
  %69 = fptosi double %68 to i32
  store i32 %69, ptr %9, align 4, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = icmp slt i32 %70, 10
  br i1 %71, label %72, label %75

72:                                               ; preds = %66
  %73 = load ptr, ptr @stderr, align 8, !tbaa !9
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef @.str.4) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

75:                                               ; preds = %66
  store i32 2, ptr %12, align 4, !tbaa !5
  br label %111

76:                                               ; preds = %23
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

80:                                               ; preds = %76
  %81 = load ptr, ptr @optarg, align 8, !tbaa !9
  %82 = call double @atof(ptr noundef %81) #6
  store double %82, ptr %7, align 8, !tbaa !11
  %83 = load double, ptr %7, align 8, !tbaa !11
  %84 = fcmp ogt double %83, 1.500000e+00
  br i1 %84, label %88, label %85

85:                                               ; preds = %80
  %86 = load double, ptr %7, align 8, !tbaa !11
  %87 = fcmp olt double %86, -1.500000e+00
  br i1 %87, label %88, label %91

88:                                               ; preds = %85, %80
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.5) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

91:                                               ; preds = %85
  store i32 3, ptr %12, align 4, !tbaa !5
  store double 0.000000e+00, ptr %6, align 8, !tbaa !11
  br label %111

92:                                               ; preds = %23
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %96

95:                                               ; preds = %92
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

96:                                               ; preds = %92
  %97 = load ptr, ptr @optarg, align 8, !tbaa !9
  %98 = call i32 @atoi(ptr noundef %97) #6
  store i32 %98, ptr %16, align 4, !tbaa !5
  %99 = load i32, ptr %16, align 4, !tbaa !5
  %100 = icmp slt i32 %99, 1
  br i1 %100, label %104, label %101

101:                                              ; preds = %96
  %102 = load i32, ptr %16, align 4, !tbaa !5
  %103 = icmp sgt i32 %102, 9
  br i1 %103, label %104, label %107

104:                                              ; preds = %101, %96
  %105 = load ptr, ptr @stderr, align 8, !tbaa !9
  %106 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef @.str.6, i32 noundef 9) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

107:                                              ; preds = %101
  store i32 4, ptr %12, align 4, !tbaa !5
  br label %111

108:                                              ; preds = %23
  call void @__print_usage()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

109:                                              ; preds = %23
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

111:                                              ; preds = %107, %91, %75, %61, %45, %36
  br label %18, !llvm.loop !15

112:                                              ; preds = %18
  %113 = load i32, ptr %12, align 4, !tbaa !5
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %112
  %116 = load ptr, ptr @stderr, align 8, !tbaa !9
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef @.str.8) #5
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

118:                                              ; preds = %112
  %119 = call ptr @signal(i32 noundef 2, ptr noundef @__signal_handler) #5
  store i32 1, ptr @running, align 4, !tbaa !5
  %120 = call i32 @rc_adc_init()
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %125

122:                                              ; preds = %118
  %123 = load ptr, ptr @stderr, align 8, !tbaa !9
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %123, ptr noundef @.str.9) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

125:                                              ; preds = %118
  %126 = call double @rc_adc_batt()
  %127 = fcmp olt double %126, 6.000000e+00
  br i1 %127, label %128, label %131

128:                                              ; preds = %125
  %129 = load ptr, ptr @stderr, align 8, !tbaa !9
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.10) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

131:                                              ; preds = %125
  %132 = call i32 @rc_adc_cleanup()
  %133 = call i32 @rc_servo_init()
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %131
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

136:                                              ; preds = %131
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = icmp eq i32 %137, 4
  br i1 %138, label %139, label %156

139:                                              ; preds = %136
  %140 = call i32 @rc_dsm_init()
  %141 = icmp eq i32 %140, -1
  br i1 %141, label %142, label %143

142:                                              ; preds = %139
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

143:                                              ; preds = %139
  %144 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %145 = load ptr, ptr @stdout, align 8, !tbaa !9
  %146 = call i32 @fflush(ptr noundef %145)
  br label %147

147:                                              ; preds = %154, %143
  %148 = call i32 @rc_dsm_is_new_data()
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %155

150:                                              ; preds = %147
  %151 = load i32, ptr @running, align 4, !tbaa !5
  %152 = icmp eq i32 %151, 0
  br i1 %152, label %153, label %154

153:                                              ; preds = %150
  store i32 0, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

154:                                              ; preds = %150
  call void @rc_usleep(i32 noundef 50000)
  br label %147, !llvm.loop !17

155:                                              ; preds = %147
  br label %156

156:                                              ; preds = %155, %136
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %158 = call i32 @rc_servo_power_rail_en(i32 noundef 1)
  %159 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %160 = load i32, ptr %10, align 4, !tbaa !5
  %161 = icmp eq i32 %160, 0
  br i1 %161, label %162, label %164

162:                                              ; preds = %156
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %167

164:                                              ; preds = %156
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %165)
  br label %167

167:                                              ; preds = %164, %162
  %168 = load i32, ptr %12, align 4, !tbaa !5
  switch i32 %168, label %188 [
    i32 1, label %169
    i32 2, label %174
    i32 3, label %179
    i32 4, label %184
  ]

169:                                              ; preds = %167
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %171 = load double, ptr %6, align 8, !tbaa !11
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, double noundef %171, i32 noundef %172)
  br label %191

174:                                              ; preds = %167
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %176, i32 noundef %177)
  br label %191

179:                                              ; preds = %167
  %180 = load double, ptr %7, align 8, !tbaa !11
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, double noundef %180)
  %182 = load i32, ptr %13, align 4, !tbaa !5
  %183 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %182)
  br label %191

184:                                              ; preds = %167
  %185 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  %186 = load i32, ptr %13, align 4, !tbaa !5
  %187 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %186)
  br label %191

188:                                              ; preds = %167
  %189 = load ptr, ptr @stderr, align 8, !tbaa !9
  %190 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %189, ptr noundef @.str.23) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

191:                                              ; preds = %184, %179, %174, %169
  br label %192

192:                                              ; preds = %291, %191
  %193 = load i32, ptr @running, align 4, !tbaa !5
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %195, label %294

195:                                              ; preds = %192
  %196 = load i32, ptr %12, align 4, !tbaa !5
  switch i32 %196, label %288 [
    i32 1, label %197
    i32 2, label %204
    i32 3, label %211
    i32 4, label %241
  ]

197:                                              ; preds = %195
  %198 = load i32, ptr %10, align 4, !tbaa !5
  %199 = load double, ptr %6, align 8, !tbaa !11
  %200 = call i32 @rc_servo_send_pulse_normalized(i32 noundef %198, double noundef %199)
  %201 = icmp eq i32 %200, -1
  br i1 %201, label %202, label %203

202:                                              ; preds = %197
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

203:                                              ; preds = %197
  br label %291

204:                                              ; preds = %195
  %205 = load i32, ptr %10, align 4, !tbaa !5
  %206 = load i32, ptr %9, align 4, !tbaa !5
  %207 = call i32 @rc_servo_send_pulse_us(i32 noundef %205, i32 noundef %206)
  %208 = icmp eq i32 %207, -1
  br i1 %208, label %209, label %210

209:                                              ; preds = %204
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

210:                                              ; preds = %204
  br label %291

211:                                              ; preds = %195
  %212 = load double, ptr %11, align 8, !tbaa !11
  %213 = load double, ptr %7, align 8, !tbaa !11
  %214 = fmul double %212, %213
  %215 = load i32, ptr %13, align 4, !tbaa !5
  %216 = sitofp i32 %215 to double
  %217 = fdiv double %214, %216
  %218 = load double, ptr %6, align 8, !tbaa !11
  %219 = fadd double %218, %217
  store double %219, ptr %6, align 8, !tbaa !11
  %220 = load double, ptr %6, align 8, !tbaa !11
  %221 = load double, ptr %7, align 8, !tbaa !11
  %222 = fcmp ogt double %220, %221
  br i1 %222, label %223, label %225

223:                                              ; preds = %211
  %224 = load double, ptr %7, align 8, !tbaa !11
  store double %224, ptr %6, align 8, !tbaa !11
  store double -1.000000e+00, ptr %11, align 8, !tbaa !11
  br label %234

225:                                              ; preds = %211
  %226 = load double, ptr %6, align 8, !tbaa !11
  %227 = load double, ptr %7, align 8, !tbaa !11
  %228 = fneg double %227
  %229 = fcmp olt double %226, %228
  br i1 %229, label %230, label %233

230:                                              ; preds = %225
  %231 = load double, ptr %7, align 8, !tbaa !11
  %232 = fneg double %231
  store double %232, ptr %6, align 8, !tbaa !11
  store double 1.000000e+00, ptr %11, align 8, !tbaa !11
  br label %233

233:                                              ; preds = %230, %225
  br label %234

234:                                              ; preds = %233, %223
  %235 = load i32, ptr %10, align 4, !tbaa !5
  %236 = load double, ptr %6, align 8, !tbaa !11
  %237 = call i32 @rc_servo_send_pulse_normalized(i32 noundef %235, double noundef %236)
  %238 = icmp eq i32 %237, -1
  br i1 %238, label %239, label %240

239:                                              ; preds = %234
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

240:                                              ; preds = %234
  br label %291

241:                                              ; preds = %195
  %242 = call i64 @rc_dsm_nanos_since_last_packet()
  store i64 %242, ptr %8, align 8, !tbaa !13
  %243 = load i64, ptr %8, align 8, !tbaa !13
  %244 = icmp ugt i64 %243, 200000000
  br i1 %244, label %245, label %250

245:                                              ; preds = %241
  %246 = load i64, ptr %8, align 8, !tbaa !13
  %247 = uitofp i64 %246 to double
  %248 = fdiv double %247, 1.000000e+09
  %249 = call i32 (ptr, ...) @printf(ptr noundef @.str.24, double noundef %248)
  br label %287

250:                                              ; preds = %241
  %251 = load i32, ptr %16, align 4, !tbaa !5
  %252 = call double @rc_dsm_ch_normalized(i32 noundef %251)
  store double %252, ptr %6, align 8, !tbaa !11
  %253 = load double, ptr %6, align 8, !tbaa !11
  %254 = fcmp olt double %253, -1.500000e+00
  br i1 %254, label %255, label %256

255:                                              ; preds = %250
  store double -1.500000e+00, ptr %6, align 8, !tbaa !11
  br label %256

256:                                              ; preds = %255, %250
  %257 = load double, ptr %6, align 8, !tbaa !11
  %258 = fcmp ogt double %257, 1.500000e+00
  br i1 %258, label %259, label %260

259:                                              ; preds = %256
  store double 1.500000e+00, ptr %6, align 8, !tbaa !11
  br label %260

260:                                              ; preds = %259, %256
  %261 = load i32, ptr %10, align 4, !tbaa !5
  %262 = load double, ptr %6, align 8, !tbaa !11
  %263 = call i32 @rc_servo_send_pulse_normalized(i32 noundef %261, double noundef %262)
  %264 = icmp eq i32 %263, -1
  br i1 %264, label %265, label %266

265:                                              ; preds = %260
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

266:                                              ; preds = %260
  %267 = call i32 (ptr, ...) @printf(ptr noundef @.str.25)
  %268 = call i32 @rc_dsm_resolution()
  %269 = call i32 (ptr, ...) @printf(ptr noundef @.str.26, i32 noundef %268)
  %270 = call i32 @rc_dsm_channels()
  %271 = call i32 (ptr, ...) @printf(ptr noundef @.str.27, i32 noundef %270)
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %272

272:                                              ; preds = %283, %266
  %273 = load i32, ptr %14, align 4, !tbaa !5
  %274 = call i32 @rc_dsm_channels()
  %275 = icmp slt i32 %273, %274
  br i1 %275, label %276, label %286

276:                                              ; preds = %272
  %277 = load i32, ptr %14, align 4, !tbaa !5
  %278 = add nsw i32 %277, 1
  %279 = load i32, ptr %14, align 4, !tbaa !5
  %280 = add nsw i32 %279, 1
  %281 = call double @rc_dsm_ch_normalized(i32 noundef %280)
  %282 = call i32 (ptr, ...) @printf(ptr noundef @.str.28, i32 noundef %278, double noundef %281)
  br label %283

283:                                              ; preds = %276
  %284 = load i32, ptr %14, align 4, !tbaa !5
  %285 = add nsw i32 %284, 1
  store i32 %285, ptr %14, align 4, !tbaa !5
  br label %272, !llvm.loop !18

286:                                              ; preds = %272
  br label %287

287:                                              ; preds = %286, %245
  br label %291

288:                                              ; preds = %195
  %289 = load ptr, ptr @stderr, align 8, !tbaa !9
  %290 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %289, ptr noundef @.str.29) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

291:                                              ; preds = %287, %240, %210, %203
  %292 = load i32, ptr %13, align 4, !tbaa !5
  %293 = sdiv i32 1000000, %292
  call void @rc_usleep(i32 noundef %293)
  br label %192, !llvm.loop !19

294:                                              ; preds = %192
  call void @rc_usleep(i32 noundef 50000)
  %295 = call i32 @rc_servo_power_rail_en(i32 noundef 0)
  call void @rc_servo_cleanup()
  %296 = call i32 @rc_dsm_cleanup()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %297

297:                                              ; preds = %294, %288, %265, %239, %209, %202, %188, %153, %142, %135, %128, %122, %115, %109, %108, %104, %95, %88, %79, %72, %65, %58, %49, %42, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %298 = load i32, ptr %3, align 4
  ret i32 %298
}

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

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

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

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

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

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

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

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @__signal_handler(i32 noundef) #0

declare i32 @rc_adc_init() #4

declare double @rc_adc_batt() #4

declare i32 @rc_adc_cleanup() #4

declare i32 @rc_servo_init() #4

declare i32 @rc_dsm_init() #4

declare i32 @fflush(ptr noundef) #4

declare i32 @rc_dsm_is_new_data() #4

declare void @rc_usleep(i32 noundef) #4

declare i32 @rc_servo_power_rail_en(i32 noundef) #4

declare i32 @rc_servo_send_pulse_normalized(i32 noundef, double noundef) #4

declare i32 @rc_servo_send_pulse_us(i32 noundef, i32 noundef) #4

declare i64 @rc_dsm_nanos_since_last_packet() #4

declare double @rc_dsm_ch_normalized(i32 noundef) #4

declare i32 @rc_dsm_resolution() #4

declare i32 @rc_dsm_channels() #4

declare void @rc_servo_cleanup() #4

declare i32 @rc_dsm_cleanup() #4

; 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 = { 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 = { 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 = { "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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

@opterr = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@running = external hidden local_unnamed_addr global i32, align 4
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [30 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  store i32 0, ptr @opterr, align 4, !tbaa !5
  br label %.outer.outer

.outer.outer:                                     ; preds = %2, %40
  %.077.ph.ph = phi double [ 0.000000e+00, %2 ], [ %42, %40 ]
  %.075.ph.ph = phi i32 [ 0, %2 ], [ %.075.ph486, %40 ]
  %.073.ph.ph = phi i32 [ 0, %2 ], [ %.073.ph492, %40 ]
  %.069.ph.ph = phi i32 [ 0, %2 ], [ 3, %40 ]
  %.067.ph.ph = phi i32 [ 50, %2 ], [ %.067, %40 ]
  %.0.ph.ph = phi i32 [ undef, %2 ], [ %.0.ph499, %40 ]
  br label %.outer

.outer:                                           ; preds = %.outer.outer, %21
  %.079.ph = phi double [ %23, %21 ], [ 0.000000e+00, %.outer.outer ]
  %.075.ph = phi i32 [ %.075.ph486, %21 ], [ %.075.ph.ph, %.outer.outer ]
  %.073.ph = phi i32 [ %.073.ph492, %21 ], [ %.073.ph.ph, %.outer.outer ]
  %.069.ph = phi i32 [ 1, %21 ], [ %.069.ph.ph, %.outer.outer ]
  %.067.ph = phi i32 [ %.067, %21 ], [ %.067.ph.ph, %.outer.outer ]
  %.0.ph = phi i32 [ %.0.ph499, %21 ], [ %.0.ph.ph, %.outer.outer ]
  br label %.outer485

.outer485:                                        ; preds = %.outer, %30
  %.075.ph486 = phi i32 [ %.075.ph, %.outer ], [ %33, %30 ]
  %.073.ph487 = phi i32 [ %.073.ph, %.outer ], [ %.073.ph492, %30 ]
  %.069.ph488 = phi i32 [ %.069.ph, %.outer ], [ 2, %30 ]
  %.067.ph489 = phi i32 [ %.067.ph, %.outer ], [ %.067, %30 ]
  %.0.ph490 = phi i32 [ %.0.ph, %.outer ], [ %.0.ph499, %30 ]
  br label %.outer491

.outer491:                                        ; preds = %.outer485, %5
  %.073.ph492 = phi i32 [ %.073.ph487, %.outer485 ], [ %7, %5 ]
  %.069.ph493 = phi i32 [ %.069.ph488, %.outer485 ], [ %.069.ph497, %5 ]
  %.067.ph494 = phi i32 [ %.067.ph489, %.outer485 ], [ %.067, %5 ]
  %.0.ph495 = phi i32 [ %.0.ph490, %.outer485 ], [ %.0.ph499, %5 ]
  br label %.outer496

.outer496:                                        ; preds = %.outer491, %49
  %.069.ph497 = phi i32 [ %.069.ph493, %.outer491 ], [ 4, %49 ]
  %.067.ph498 = phi i32 [ %.067.ph494, %.outer491 ], [ %.067, %49 ]
  %.0.ph499 = phi i32 [ %.0.ph495, %.outer491 ], [ %51, %49 ]
  br label %3

3:                                                ; preds = %.outer496, %12
  %.067 = phi i32 [ %14, %12 ], [ %.067.ph498, %.outer496 ]
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #6
  switch i32 %4, label %57 [
    i32 -1, label %59
    i32 99, label %5
    i32 102, label %12
    i32 112, label %19
    i32 119, label %28
    i32 115, label %38
    i32 114, label %47
    i32 104, label %56
  ]

5:                                                ; preds = %3
  %6 = load ptr, ptr @optarg, align 8, !tbaa !9
  %7 = tail call i32 @atoi(ptr nocapture noundef %6) #7
  %8 = add i32 %7, -9
  %or.cond = icmp ult i32 %8, -8
  br i1 %or.cond, label %9, label %.outer491, !llvm.loop !11

9:                                                ; preds = %5
  %10 = load ptr, ptr @stderr, align 8, !tbaa !9
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.1, i32 noundef 1, i32 noundef 8) #8
  br label %.loopexit100

12:                                               ; preds = %3
  %13 = load ptr, ptr @optarg, align 8, !tbaa !9
  %14 = tail call i32 @atoi(ptr nocapture noundef %13) #7
  %15 = icmp slt i32 %14, 1
  br i1 %15, label %16, label %3, !llvm.loop !11

16:                                               ; preds = %12
  %17 = load ptr, ptr @stderr, align 8, !tbaa !9
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.2) #8
  br label %.loopexit100

19:                                               ; preds = %3
  %.not99 = icmp eq i32 %.069.ph497, 0
  br i1 %.not99, label %21, label %20

20:                                               ; preds = %19
  tail call void @__print_usage()
  br label %.loopexit100

21:                                               ; preds = %19
  %22 = load ptr, ptr @optarg, align 8, !tbaa !9
  %23 = tail call double @atof(ptr noundef %22) #7
  %24 = tail call double @llvm.fabs.f64(double %23)
  %or.cond3 = fcmp ogt double %24, 1.500000e+00
  br i1 %or.cond3, label %25, label %.outer, !llvm.loop !11

25:                                               ; preds = %21
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str.3) #8
  br label %.loopexit100

28:                                               ; preds = %3
  %.not98 = icmp eq i32 %.069.ph497, 0
  br i1 %.not98, label %30, label %29

29:                                               ; preds = %28
  tail call void @__print_usage()
  br label %.loopexit100

30:                                               ; preds = %28
  %31 = load ptr, ptr @optarg, align 8, !tbaa !9
  %32 = tail call double @atof(ptr noundef %31) #7
  %33 = fptosi double %32 to i32
  %34 = icmp slt i32 %33, 10
  br i1 %34, label %35, label %.outer485, !llvm.loop !11

35:                                               ; preds = %30
  %36 = load ptr, ptr @stderr, align 8, !tbaa !9
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.4) #8
  br label %.loopexit100

38:                                               ; preds = %3
  %.not97 = icmp eq i32 %.069.ph497, 0
  br i1 %.not97, label %40, label %39

39:                                               ; preds = %38
  tail call void @__print_usage()
  br label %.loopexit100

40:                                               ; preds = %38
  %41 = load ptr, ptr @optarg, align 8, !tbaa !9
  %42 = tail call double @atof(ptr noundef %41) #7
  %43 = tail call double @llvm.fabs.f64(double %42)
  %or.cond5 = fcmp ogt double %43, 1.500000e+00
  br i1 %or.cond5, label %44, label %.outer.outer, !llvm.loop !11

44:                                               ; preds = %40
  %45 = load ptr, ptr @stderr, align 8, !tbaa !9
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.5) #8
  br label %.loopexit100

47:                                               ; preds = %3
  %.not96 = icmp eq i32 %.069.ph497, 0
  br i1 %.not96, label %49, label %48

48:                                               ; preds = %47
  tail call void @__print_usage()
  br label %.loopexit100

49:                                               ; preds = %47
  %50 = load ptr, ptr @optarg, align 8, !tbaa !9
  %51 = tail call i32 @atoi(ptr nocapture noundef %50) #7
  %52 = add i32 %51, -10
  %or.cond7 = icmp ult i32 %52, -9
  br i1 %or.cond7, label %53, label %.outer496, !llvm.loop !11

53:                                               ; preds = %49
  %54 = load ptr, ptr @stderr, align 8, !tbaa !9
  %55 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.6, i32 noundef 9) #8
  br label %.loopexit100

56:                                               ; preds = %3
  tail call void @__print_usage()
  br label %.loopexit100

57:                                               ; preds = %3
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  tail call void @__print_usage()
  br label %.loopexit100

59:                                               ; preds = %3
  %60 = icmp eq i32 %.069.ph497, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %59
  %62 = load ptr, ptr @stderr, align 8, !tbaa !9
  %63 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef nonnull @.str.8) #8
  tail call void @__print_usage()
  br label %.loopexit100

64:                                               ; preds = %59
  %65 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @__signal_handler) #6
  store i32 1, ptr @running, align 4, !tbaa !5
  %66 = tail call i32 @rc_adc_init() #6
  %.not93 = icmp eq i32 %66, 0
  br i1 %.not93, label %70, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef nonnull @.str.9) #8
  br label %.loopexit100

70:                                               ; preds = %64
  %71 = tail call double @rc_adc_batt() #6
  %72 = fcmp olt double %71, 6.000000e+00
  br i1 %72, label %73, label %76

73:                                               ; preds = %70
  %74 = load ptr, ptr @stderr, align 8, !tbaa !9
  %75 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.10) #8
  br label %.loopexit100

76:                                               ; preds = %70
  %77 = tail call i32 @rc_adc_cleanup() #6
  %78 = tail call i32 @rc_servo_init() #6
  %.not94 = icmp eq i32 %78, 0
  br i1 %.not94, label %79, label %.loopexit100

79:                                               ; preds = %76
  %80 = icmp eq i32 %.069.ph497, 4
  br i1 %80, label %81, label %.loopexit101

81:                                               ; preds = %79
  %82 = tail call i32 @rc_dsm_init() #6
  %83 = icmp eq i32 %82, -1
  br i1 %83, label %.loopexit100, label %84

84:                                               ; preds = %81
  %85 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %86 = load ptr, ptr @stdout, align 8, !tbaa !9
  %87 = tail call i32 @fflush(ptr noundef %86)
  %88 = tail call i32 @rc_dsm_is_new_data() #6
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %.lr.ph, label %.loopexit101

.lr.ph:                                           ; preds = %84, %92
  %90 = load i32, ptr @running, align 4, !tbaa !5
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %.loopexit100, label %92

92:                                               ; preds = %.lr.ph
  tail call void @rc_usleep(i32 noundef 50000) #6
  %93 = tail call i32 @rc_dsm_is_new_data() #6
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %.lr.ph, label %.loopexit101, !llvm.loop !13

.loopexit101:                                     ; preds = %92, %84, %79
  %95 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %96 = tail call i32 @rc_servo_power_rail_en(i32 noundef 1) #6
  %97 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %98 = icmp eq i32 %.073.ph492, 0
  br i1 %98, label %99, label %101

99:                                               ; preds = %.loopexit101
  %100 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  br label %103

101:                                              ; preds = %.loopexit101
  %102 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %.073.ph492)
  br label %103

103:                                              ; preds = %101, %99
  switch i32 %.069.ph497, label %default.unreachable [
    i32 1, label %104
    i32 2, label %107
    i32 3, label %110
    i32 4, label %113
  ]

104:                                              ; preds = %103
  %105 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %106 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, double noundef %.079.ph, i32 noundef %.067)
  br label %116

107:                                              ; preds = %103
  %108 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %109 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %.075.ph486, i32 noundef %.067)
  br label %116

110:                                              ; preds = %103
  %111 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, double noundef %.077.ph.ph)
  %112 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %.067)
  br label %116

113:                                              ; preds = %103
  %114 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  %115 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %.067)
  br label %116

default.unreachable:                              ; preds = %103
  unreachable

116:                                              ; preds = %113, %110, %107, %104
  %117 = load i32, ptr @running, align 4, !tbaa !5
  %.not95189 = icmp eq i32 %117, 0
  br i1 %.not95189, label %._crit_edge, label %.lr.ph192

.lr.ph192:                                        ; preds = %116
  %118 = uitofp nneg i32 %.067 to double
  %119 = fneg double %.077.ph.ph
  switch i32 %.069.ph497, label %.lr.ph192.split.split [
    i32 1, label %.lr.ph192.split.split.us
    i32 2, label %.lr.ph192.split.split.us193
    i32 3, label %.lr.ph192.split.split.us199
  ]

.lr.ph192.split.split.us:                         ; preds = %.lr.ph192, %122
  %120 = tail call i32 @rc_servo_send_pulse_normalized(i32 noundef %.073.ph492, double noundef %.079.ph) #6
  %121 = icmp eq i32 %120, -1
  br i1 %121, label %.loopexit100, label %122

122:                                              ; preds = %.lr.ph192.split.split.us
  %123 = udiv i32 1000000, %.067
  tail call void @rc_usleep(i32 noundef %123) #6
  %124 = load i32, ptr @running, align 4, !tbaa !5
  %.not95.us = icmp eq i32 %124, 0
  br i1 %.not95.us, label %._crit_edge, label %.lr.ph192.split.split.us, !llvm.loop !14

.lr.ph192.split.split.us193:                      ; preds = %.lr.ph192, %127
  %125 = tail call i32 @rc_servo_send_pulse_us(i32 noundef %.073.ph492, i32 noundef %.075.ph486) #6
  %126 = icmp eq i32 %125, -1
  br i1 %126, label %.loopexit100, label %127

127:                                              ; preds = %.lr.ph192.split.split.us193
  %128 = udiv i32 1000000, %.067
  tail call void @rc_usleep(i32 noundef %128) #6
  %129 = load i32, ptr @running, align 4, !tbaa !5
  %.not95.us198 = icmp eq i32 %129, 0
  br i1 %.not95.us198, label %._crit_edge, label %.lr.ph192.split.split.us193, !llvm.loop !14

.lr.ph192.split.split.us199:                      ; preds = %.lr.ph192, %140
  %.071191.us200 = phi double [ %.172.us, %140 ], [ 1.000000e+00, %.lr.ph192 ]
  %.281190.us201 = phi double [ %.3.us, %140 ], [ %.079.ph, %.lr.ph192 ]
  %130 = fmul double %.077.ph.ph, %.071191.us200
  %131 = fdiv double %130, %118
  %132 = fadd double %.281190.us201, %131
  %133 = fcmp ogt double %132, %.077.ph.ph
  br i1 %133, label %137, label %134

134:                                              ; preds = %.lr.ph192.split.split.us199
  %135 = fcmp olt double %132, %119
  br i1 %135, label %136, label %137

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136, %134, %.lr.ph192.split.split.us199
  %.3.us = phi double [ %119, %136 ], [ %132, %134 ], [ %.077.ph.ph, %.lr.ph192.split.split.us199 ]
  %.172.us = phi double [ 1.000000e+00, %136 ], [ %.071191.us200, %134 ], [ -1.000000e+00, %.lr.ph192.split.split.us199 ]
  %138 = tail call i32 @rc_servo_send_pulse_normalized(i32 noundef %.073.ph492, double noundef %.3.us) #6
  %139 = icmp eq i32 %138, -1
  br i1 %139, label %.loopexit100, label %140

140:                                              ; preds = %137
  %141 = udiv i32 1000000, %.067
  tail call void @rc_usleep(i32 noundef %141) #6
  %142 = load i32, ptr @running, align 4, !tbaa !5
  %.not95.us204 = icmp eq i32 %142, 0
  br i1 %.not95.us204, label %._crit_edge, label %.lr.ph192.split.split.us199, !llvm.loop !14

.lr.ph192.split.split:                            ; preds = %.lr.ph192, %.loopexit
  %143 = tail call i64 @rc_dsm_nanos_since_last_packet() #6
  %144 = icmp ugt i64 %143, 200000000
  br i1 %144, label %145, label %149

145:                                              ; preds = %.lr.ph192.split.split
  %146 = uitofp i64 %143 to double
  %147 = fdiv double %146, 1.000000e+09
  %148 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, double noundef %147)
  br label %.loopexit

149:                                              ; preds = %.lr.ph192.split.split
  %150 = tail call double @rc_dsm_ch_normalized(i32 noundef %.0.ph499) #6
  %151 = fcmp olt double %150, -1.500000e+00
  %.4 = select i1 %151, double -1.500000e+00, double %150
  %152 = fcmp ogt double %.4, 1.500000e+00
  %.5 = select i1 %152, double 1.500000e+00, double %.4
  %153 = tail call i32 @rc_servo_send_pulse_normalized(i32 noundef %.073.ph492, double noundef %.5) #6
  %154 = icmp eq i32 %153, -1
  br i1 %154, label %.loopexit100, label %155

155:                                              ; preds = %149
  %156 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25)
  %157 = tail call i32 @rc_dsm_resolution() #6
  %158 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26, i32 noundef %157)
  %159 = tail call i32 @rc_dsm_channels() #6
  %160 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27, i32 noundef %159)
  %161 = tail call i32 @rc_dsm_channels() #6
  %162 = icmp sgt i32 %161, 0
  br i1 %162, label %.lr.ph188, label %.loopexit

.lr.ph188:                                        ; preds = %155, %.lr.ph188
  %.066187 = phi i32 [ %163, %.lr.ph188 ], [ 0, %155 ]
  %163 = add nuw nsw i32 %.066187, 1
  %164 = tail call double @rc_dsm_ch_normalized(i32 noundef %163) #6
  %165 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28, i32 noundef %163, double noundef %164)
  %166 = tail call i32 @rc_dsm_channels() #6
  %167 = icmp slt i32 %163, %166
  br i1 %167, label %.lr.ph188, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph188, %155, %145
  %168 = udiv i32 1000000, %.067
  tail call void @rc_usleep(i32 noundef %168) #6
  %169 = load i32, ptr @running, align 4, !tbaa !5
  %.not95 = icmp eq i32 %169, 0
  br i1 %.not95, label %._crit_edge, label %.lr.ph192.split.split, !llvm.loop !14

._crit_edge:                                      ; preds = %140, %127, %122, %.loopexit, %116
  tail call void @rc_usleep(i32 noundef 50000) #6
  %170 = tail call i32 @rc_servo_power_rail_en(i32 noundef 0) #6
  tail call void @rc_servo_cleanup() #6
  %171 = tail call i32 @rc_dsm_cleanup() #6
  br label %.loopexit100

.loopexit100:                                     ; preds = %.lr.ph, %137, %.lr.ph192.split.split.us193, %.lr.ph192.split.split.us, %149, %81, %76, %._crit_edge, %73, %67, %61, %57, %56, %53, %48, %44, %39, %35, %29, %25, %20, %16, %9
  %.065 = phi i32 [ -1, %57 ], [ 0, %56 ], [ -1, %48 ], [ -1, %53 ], [ -1, %39 ], [ -1, %44 ], [ -1, %29 ], [ -1, %35 ], [ -1, %20 ], [ -1, %25 ], [ -1, %16 ], [ -1, %9 ], [ -1, %61 ], [ -1, %67 ], [ -1, %73 ], [ 0, %._crit_edge ], [ -1, %76 ], [ -1, %81 ], [ -1, %149 ], [ -1, %.lr.ph192.split.split.us ], [ -1, %.lr.ph192.split.split.us193 ], [ -1, %137 ], [ 0, %.lr.ph ]
  ret i32 %.065
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @__signal_handler(i32 noundef) #0

declare i32 @rc_adc_init() local_unnamed_addr #4

declare double @rc_adc_batt() local_unnamed_addr #4

declare i32 @rc_adc_cleanup() local_unnamed_addr #4

declare i32 @rc_servo_init() local_unnamed_addr #4

declare i32 @rc_dsm_init() local_unnamed_addr #4

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

declare i32 @rc_dsm_is_new_data() local_unnamed_addr #4

declare void @rc_usleep(i32 noundef) local_unnamed_addr #4

declare i32 @rc_servo_power_rail_en(i32 noundef) local_unnamed_addr #4

declare i32 @rc_servo_send_pulse_normalized(i32 noundef, double noundef) local_unnamed_addr #4

declare i32 @rc_servo_send_pulse_us(i32 noundef, i32 noundef) local_unnamed_addr #4

declare i64 @rc_dsm_nanos_since_last_packet() local_unnamed_addr #4

declare double @rc_dsm_ch_normalized(i32 noundef) local_unnamed_addr #4

declare i32 @rc_dsm_resolution() local_unnamed_addr #4

declare i32 @rc_dsm_channels() local_unnamed_addr #4

declare void @rc_servo_cleanup() local_unnamed_addr #4

declare i32 @rc_dsm_cleanup() local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

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


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