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

; 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 [12 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@running = external hidden global i32, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@stdout = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [29 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = 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 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 25000, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr @opterr, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %89, %2
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = call i32 @getopt(i32 noundef %14, ptr noundef %15, ptr noundef @.str) #5
  store i32 %16, ptr %8, align 4, !tbaa !5
  %17 = icmp ne i32 %16, -1
  br i1 %17, label %18, label %90

18:                                               ; preds = %13
  %19 = load i32, ptr %8, align 4, !tbaa !5
  switch i32 %19, label %88 [
    i32 109, label %20
    i32 100, label %34
    i32 70, label %51
    i32 102, label %60
    i32 98, label %65
    i32 115, label %70
    i32 104, label %87
  ]

20:                                               ; preds = %18
  %21 = load ptr, ptr @optarg, align 8, !tbaa !9
  %22 = call i32 @atoi(ptr noundef %21) #6
  store i32 %22, ptr %9, align 4, !tbaa !5
  %23 = load i32, ptr %9, align 4, !tbaa !5
  %24 = icmp sle i32 %23, 4
  br i1 %24, label %25, label %30

25:                                               ; preds = %20
  %26 = load i32, ptr %9, align 4, !tbaa !5
  %27 = icmp sge i32 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %25
  %29 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %29, ptr %7, align 4, !tbaa !5
  br label %33

30:                                               ; preds = %25, %20
  %31 = load ptr, ptr @stderr, align 8, !tbaa !9
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.1) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

33:                                               ; preds = %28
  br label %89

34:                                               ; preds = %18
  %35 = load i32, ptr %11, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  call void @__print_usage()
  br label %38

38:                                               ; preds = %37, %34
  %39 = load ptr, ptr @optarg, align 8, !tbaa !9
  %40 = call double @atof(ptr noundef %39) #6
  store double %40, ptr %6, align 8, !tbaa !11
  %41 = load double, ptr %6, align 8, !tbaa !11
  %42 = fcmp ole double %41, 1.000000e+00
  br i1 %42, label %43, label %47

43:                                               ; preds = %38
  %44 = load double, ptr %6, align 8, !tbaa !11
  %45 = fcmp oge double %44, -1.000000e+00
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %50

47:                                               ; preds = %43, %38
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.2) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

50:                                               ; preds = %46
  br label %89

51:                                               ; preds = %18
  %52 = load ptr, ptr @optarg, align 8, !tbaa !9
  %53 = call i32 @atoi(ptr noundef %52) #6
  store i32 %53, ptr %10, align 4, !tbaa !5
  %54 = load i32, ptr %10, align 4, !tbaa !5
  %55 = icmp slt i32 %54, 1
  br i1 %55, label %56, label %59

56:                                               ; preds = %51
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.3) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

59:                                               ; preds = %51
  br label %89

60:                                               ; preds = %18
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %60
  call void @__print_usage()
  br label %64

64:                                               ; preds = %63, %60
  store i32 3, ptr %11, align 4, !tbaa !5
  br label %89

65:                                               ; preds = %18
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  call void @__print_usage()
  br label %69

69:                                               ; preds = %68, %65
  store i32 2, ptr %11, align 4, !tbaa !5
  br label %89

70:                                               ; preds = %18
  %71 = load i32, ptr %11, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  call void @__print_usage()
  br label %74

74:                                               ; preds = %73, %70
  %75 = load ptr, ptr @optarg, align 8, !tbaa !9
  %76 = call double @atof(ptr noundef %75) #6
  store double %76, ptr %6, align 8, !tbaa !11
  %77 = load double, ptr %6, align 8, !tbaa !11
  %78 = fcmp ole double %77, 1.000000e+00
  br i1 %78, label %79, label %83

79:                                               ; preds = %74
  %80 = load double, ptr %6, align 8, !tbaa !11
  %81 = fcmp oge double %80, -1.000000e+00
  br i1 %81, label %82, label %83

82:                                               ; preds = %79
  store i32 4, ptr %11, align 4, !tbaa !5
  br label %86

83:                                               ; preds = %79, %74
  %84 = load ptr, ptr @stderr, align 8, !tbaa !9
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.2) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

86:                                               ; preds = %82
  br label %89

87:                                               ; preds = %18
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

88:                                               ; preds = %18
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

89:                                               ; preds = %86, %69, %64, %59, %50, %33
  br label %13, !llvm.loop !13

90:                                               ; preds = %13
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %90
  call void @__print_usage()
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

94:                                               ; preds = %90
  %95 = call ptr @signal(i32 noundef 2, ptr noundef @__signal_handler) #5
  store i32 1, ptr @running, align 4, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = call i32 @rc_motor_init_freq(i32 noundef %96)
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %94
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

100:                                              ; preds = %94
  %101 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %101, label %116 [
    i32 1, label %102
    i32 3, label %108
    i32 2, label %112
  ]

102:                                              ; preds = %100
  %103 = load double, ptr %6, align 8, !tbaa !11
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %103)
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load double, ptr %6, align 8, !tbaa !11
  %107 = call i32 @rc_motor_set(i32 noundef %105, double noundef %106)
  br label %117

108:                                              ; preds = %100
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = call i32 @rc_motor_free_spin(i32 noundef %110)
  br label %117

112:                                              ; preds = %100
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = call i32 @rc_motor_brake(i32 noundef %114)
  br label %117

116:                                              ; preds = %100
  br label %117

117:                                              ; preds = %116, %112, %108, %102
  br label %118

118:                                              ; preds = %134, %117
  %119 = load i32, ptr @running, align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %135

121:                                              ; preds = %118
  %122 = load i32, ptr %11, align 4, !tbaa !5
  %123 = icmp eq i32 %122, 4
  br i1 %123, label %124, label %134

124:                                              ; preds = %121
  %125 = load double, ptr %6, align 8, !tbaa !11
  %126 = fneg double %125
  store double %126, ptr %6, align 8, !tbaa !11
  %127 = load double, ptr %6, align 8, !tbaa !11
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %127)
  %129 = load ptr, ptr @stdout, align 8, !tbaa !9
  %130 = call i32 @fflush(ptr noundef %129)
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = load double, ptr %6, align 8, !tbaa !11
  %133 = call i32 @rc_motor_set(i32 noundef %131, double noundef %132)
  br label %134

134:                                              ; preds = %124, %121
  call void @rc_usleep(i32 noundef 500000)
  br label %118, !llvm.loop !15

135:                                              ; preds = %118
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %137 = call i32 @rc_motor_cleanup()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %138

138:                                              ; preds = %135, %99, %93, %88, %87, %83, %56, %47, %30
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %139 = load i32, ptr %3, align 4
  ret i32 %139
}

; 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

; 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_motor_init_freq(i32 noundef) #4

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

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

declare i32 @rc_motor_free_spin(i32 noundef) #4

declare i32 @rc_motor_brake(i32 noundef) #4

declare i32 @fflush(ptr noundef) #4

declare void @rc_usleep(i32 noundef) #4

declare i32 @rc_motor_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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !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"

@opterr = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [12 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 [34 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@running = external hidden local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [29 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:                                           ; preds = %5, %2
  %.038.ph = phi i32 [ %7, %5 ], [ 0, %2 ]
  %.036.ph = phi double [ %.036.ph154, %5 ], [ 0.000000e+00, %2 ]
  %.033.ph = phi i32 [ %.033.ph158, %5 ], [ 25000, %2 ]
  %.0.ph = phi i32 [ %.0, %5 ], [ 0, %2 ]
  br label %.outer153

.outer153:                                        ; preds = %.outer153.backedge, %.outer
  %.036.ph154 = phi double [ %.036.ph, %.outer ], [ %.036.ph154.be, %.outer153.backedge ]
  %.033.ph155 = phi i32 [ %.033.ph, %.outer ], [ %.033.ph158, %.outer153.backedge ]
  %.0.ph156 = phi i32 [ %.0.ph, %.outer ], [ %.0.ph156.be, %.outer153.backedge ]
  br label %.outer157

.outer157:                                        ; preds = %.outer153, %20
  %.033.ph158 = phi i32 [ %.033.ph155, %.outer153 ], [ %22, %20 ]
  %.0.ph159 = phi i32 [ %.0.ph156, %.outer153 ], [ %.0, %20 ]
  br label %3

3:                                                ; preds = %.backedge, %.outer157
  %.0 = phi i32 [ %.0.ph159, %.outer157 ], [ %.0.be, %.backedge ]
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #6
  switch i32 %4, label %39 [
    i32 -1, label %40
    i32 109, label %5
    i32 100, label %11
    i32 70, label %20
    i32 102, label %27
    i32 98, label %28
    i32 115, label %29
    i32 104, label %38
  ]

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

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

11:                                               ; preds = %3
  %.not50 = icmp eq i32 %.0, 0
  br i1 %.not50, label %13, label %12

12:                                               ; preds = %11
  tail call void @__print_usage()
  br label %13

13:                                               ; preds = %12, %11
  %14 = load ptr, ptr @optarg, align 8, !tbaa !9
  %15 = tail call double @atof(ptr noundef %14) #7
  %16 = tail call double @llvm.fabs.f64(double %15)
  %or.cond3 = fcmp ugt double %16, 1.000000e+00
  br i1 %or.cond3, label %17, label %.outer153.backedge

.outer153.backedge:                               ; preds = %13, %31
  %.036.ph154.be = phi double [ %33, %31 ], [ %15, %13 ]
  %.0.ph156.be = phi i32 [ 4, %31 ], [ 1, %13 ]
  br label %.outer153, !llvm.loop !11

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

20:                                               ; preds = %3
  %21 = load ptr, ptr @optarg, align 8, !tbaa !9
  %22 = tail call i32 @atoi(ptr nocapture noundef %21) #7
  %23 = icmp slt i32 %22, 1
  br i1 %23, label %24, label %.outer157, !llvm.loop !11

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

27:                                               ; preds = %3
  %.not49 = icmp eq i32 %.0, 0
  br i1 %.not49, label %.backedge, label %.sink.split

28:                                               ; preds = %3
  %.not48 = icmp eq i32 %.0, 0
  br i1 %.not48, label %.backedge, label %.sink.split

29:                                               ; preds = %3
  %.not47 = icmp eq i32 %.0, 0
  br i1 %.not47, label %31, label %30

30:                                               ; preds = %29
  tail call void @__print_usage()
  br label %31

31:                                               ; preds = %30, %29
  %32 = load ptr, ptr @optarg, align 8, !tbaa !9
  %33 = tail call double @atof(ptr noundef %32) #7
  %34 = tail call double @llvm.fabs.f64(double %33)
  %or.cond5 = fcmp ugt double %34, 1.000000e+00
  br i1 %or.cond5, label %35, label %.outer153.backedge

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

38:                                               ; preds = %3
  tail call void @__print_usage()
  br label %68

39:                                               ; preds = %3
  tail call void @__print_usage()
  br label %68

.sink.split:                                      ; preds = %28, %27
  %.1.ph = phi i32 [ 3, %27 ], [ 2, %28 ]
  tail call void @__print_usage()
  br label %.backedge

.backedge:                                        ; preds = %.sink.split, %28, %27
  %.0.be = phi i32 [ 3, %27 ], [ 2, %28 ], [ %.1.ph, %.sink.split ]
  br label %3, !llvm.loop !11

40:                                               ; preds = %3
  %41 = icmp eq i32 %.0, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %40
  tail call void @__print_usage()
  br label %68

43:                                               ; preds = %40
  %44 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @__signal_handler) #6
  store i32 1, ptr @running, align 4, !tbaa !5
  %45 = tail call i32 @rc_motor_init_freq(i32 noundef %.033.ph158) #6
  %.not45 = icmp eq i32 %45, 0
  br i1 %.not45, label %46, label %68

46:                                               ; preds = %43
  switch i32 %.0, label %56 [
    i32 1, label %47
    i32 3, label %50
    i32 2, label %53
  ]

47:                                               ; preds = %46
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %.036.ph154)
  %49 = tail call i32 @rc_motor_set(i32 noundef %.038.ph, double noundef %.036.ph154) #6
  br label %56

50:                                               ; preds = %46
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %52 = tail call i32 @rc_motor_free_spin(i32 noundef %.038.ph) #6
  br label %56

53:                                               ; preds = %46
  %54 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %55 = tail call i32 @rc_motor_brake(i32 noundef %.038.ph) #6
  br label %56

56:                                               ; preds = %46, %53, %50, %47
  %57 = load i32, ptr @running, align 4, !tbaa !5
  %.not4675 = icmp eq i32 %57, 0
  br i1 %.not4675, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %56
  %58 = icmp eq i32 %.0, 4
  br i1 %58, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %.276.us = phi double [ %59, %.lr.ph.split.us ], [ %.036.ph154, %.lr.ph ]
  %59 = fneg double %.276.us
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %59)
  %61 = load ptr, ptr @stdout, align 8, !tbaa !9
  %62 = tail call i32 @fflush(ptr noundef %61)
  %63 = tail call i32 @rc_motor_set(i32 noundef %.038.ph, double noundef %59) #6
  tail call void @rc_usleep(i32 noundef 500000) #6
  %64 = load i32, ptr @running, align 4, !tbaa !5
  %.not46.us = icmp eq i32 %64, 0
  br i1 %.not46.us, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !13

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  tail call void @rc_usleep(i32 noundef 500000) #6
  %65 = load i32, ptr @running, align 4, !tbaa !5
  %.not46 = icmp eq i32 %65, 0
  br i1 %.not46, label %._crit_edge, label %.lr.ph.split, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph.split, %.lr.ph.split.us, %56
  %66 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %67 = tail call i32 @rc_motor_cleanup() #6
  br label %68

68:                                               ; preds = %43, %._crit_edge, %42, %39, %38, %35, %24, %17, %8
  %.035 = phi i32 [ -1, %39 ], [ -1, %38 ], [ -1, %35 ], [ -1, %24 ], [ -1, %17 ], [ -1, %8 ], [ -1, %42 ], [ 0, %._crit_edge ], [ -1, %43 ]
  ret i32 %.035
}

; 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: 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_motor_init_freq(i32 noundef) local_unnamed_addr #4

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

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

declare i32 @rc_motor_free_spin(i32 noundef) local_unnamed_addr #4

declare i32 @rc_motor_brake(i32 noundef) local_unnamed_addr #4

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

declare void @rc_usleep(i32 noundef) local_unnamed_addr #4

declare i32 @rc_motor_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}


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