; LLVM IR from QunShanHe/JLURoboVision :: Serial/Serial.ll (Z9UART0_Setiiiiii)

; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }

@__const._Z9UART0_Setiiiiii.speed_arr = external hidden unnamed_addr constant [7 x i32], align 16
@__const._Z9UART0_Setiiiiii.name_arr = external hidden unnamed_addr constant [7 x i32], align 16
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@stderr = external global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare void @perror(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9UART0_Setiiiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #3 {
  %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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca [7 x i32], align 16
  %17 = alloca [7 x i32], align 16
  %18 = alloca %struct.termios, align 4
  %19 = alloca i32, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !5
  store i32 %5, 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 28, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 @__const._Z9UART0_Setiiiiii.speed_arr, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 28, ptr %17) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 @__const._Z9UART0_Setiiiiii.name_arr, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 60, ptr %18) #5
  %20 = load i32, ptr %8, align 4, !tbaa !5
  %21 = call i32 @tcgetattr(i32 noundef %20, ptr noundef %18) #5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %6
  call void @perror(ptr noundef @.str.15)
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

24:                                               ; preds = %6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %48, %24
  %26 = load i32, ptr %14, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp ult i64 %27, 7
  br i1 %28, label %29, label %51

29:                                               ; preds = %25
  %30 = load i32, ptr %9, align 4, !tbaa !5
  %31 = load i32, ptr %14, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [7 x i32], ptr %17, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp eq i32 %30, %34
  br i1 %35, label %36, label %47

36:                                               ; preds = %29
  %37 = load i32, ptr %14, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [7 x i32], ptr %16, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = call i32 @cfsetispeed(ptr noundef %18, i32 noundef %40) #5
  %42 = load i32, ptr %14, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [7 x i32], ptr %16, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = call i32 @cfsetospeed(ptr noundef %18, i32 noundef %45) #5
  br label %47

47:                                               ; preds = %36, %29
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %14, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %14, align 4, !tbaa !5
  br label %25, !llvm.loop !9

51:                                               ; preds = %25
  %52 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = or i32 %53, 2048
  store i32 %54, ptr %52, align 4, !tbaa !11
  %55 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %56 = load i32, ptr %55, align 4, !tbaa !11
  %57 = or i32 %56, 128
  store i32 %57, ptr %55, align 4, !tbaa !11
  %58 = load i32, ptr %10, align 4, !tbaa !5
  switch i32 %58, label %71 [
    i32 0, label %59
    i32 1, label %63
    i32 2, label %67
  ]

59:                                               ; preds = %51
  %60 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %61 = load i32, ptr %60, align 4, !tbaa !11
  %62 = and i32 %61, 2147483647
  store i32 %62, ptr %60, align 4, !tbaa !11
  br label %71

63:                                               ; preds = %51
  %64 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %66 = or i32 %65, -2147483648
  store i32 %66, ptr %64, align 4, !tbaa !11
  br label %71

67:                                               ; preds = %51
  %68 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %69 = load i32, ptr %68, align 4, !tbaa !11
  %70 = or i32 %69, 7168
  store i32 %70, ptr %68, align 4, !tbaa !11
  br label %71

71:                                               ; preds = %67, %63, %59, %51
  %72 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %73 = load i32, ptr %72, align 4, !tbaa !11
  %74 = and i32 %73, -49
  store i32 %74, ptr %72, align 4, !tbaa !11
  %75 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %75, label %92 [
    i32 5, label %76
    i32 6, label %80
    i32 7, label %84
    i32 8, label %88
  ]

76:                                               ; preds = %71
  %77 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %78 = load i32, ptr %77, align 4, !tbaa !11
  %79 = or i32 %78, 0
  store i32 %79, ptr %77, align 4, !tbaa !11
  br label %95

80:                                               ; preds = %71
  %81 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !11
  %83 = or i32 %82, 16
  store i32 %83, ptr %81, align 4, !tbaa !11
  br label %95

84:                                               ; preds = %71
  %85 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %86 = load i32, ptr %85, align 4, !tbaa !11
  %87 = or i32 %86, 32
  store i32 %87, ptr %85, align 4, !tbaa !11
  br label %95

88:                                               ; preds = %71
  %89 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %90 = load i32, ptr %89, align 4, !tbaa !11
  %91 = or i32 %90, 48
  store i32 %91, ptr %89, align 4, !tbaa !11
  br label %95

92:                                               ; preds = %71
  %93 = load ptr, ptr @stderr, align 8, !tbaa !13
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef @.str.16) #5
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

95:                                               ; preds = %88, %84, %80, %76
  %96 = load i32, ptr %13, align 4, !tbaa !5
  switch i32 %96, label %128 [
    i32 110, label %97
    i32 78, label %97
    i32 111, label %104
    i32 79, label %104
    i32 101, label %111
    i32 69, label %111
    i32 115, label %121
    i32 83, label %121
  ]

97:                                               ; preds = %95, %95
  %98 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %100 = and i32 %99, -257
  store i32 %100, ptr %98, align 4, !tbaa !11
  %101 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 0
  %102 = load i32, ptr %101, align 4, !tbaa !15
  %103 = and i32 %102, -17
  store i32 %103, ptr %101, align 4, !tbaa !15
  br label %131

104:                                              ; preds = %95, %95
  %105 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %107 = or i32 %106, 768
  store i32 %107, ptr %105, align 4, !tbaa !11
  %108 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !15
  %110 = or i32 %109, 16
  store i32 %110, ptr %108, align 4, !tbaa !15
  br label %131

111:                                              ; preds = %95, %95
  %112 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %113 = load i32, ptr %112, align 4, !tbaa !11
  %114 = or i32 %113, 256
  store i32 %114, ptr %112, align 4, !tbaa !11
  %115 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %116 = load i32, ptr %115, align 4, !tbaa !11
  %117 = and i32 %116, -513
  store i32 %117, ptr %115, align 4, !tbaa !11
  %118 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !15
  %120 = or i32 %119, 16
  store i32 %120, ptr %118, align 4, !tbaa !15
  br label %131

121:                                              ; preds = %95, %95
  %122 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %124 = and i32 %123, -257
  store i32 %124, ptr %122, align 4, !tbaa !11
  %125 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %126 = load i32, ptr %125, align 4, !tbaa !11
  %127 = and i32 %126, -65
  store i32 %127, ptr %125, align 4, !tbaa !11
  br label %131

128:                                              ; preds = %95
  %129 = load ptr, ptr @stderr, align 8, !tbaa !13
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.17) #5
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

131:                                              ; preds = %121, %111, %104, %97
  %132 = load i32, ptr %12, align 4, !tbaa !5
  switch i32 %132, label %141 [
    i32 1, label %133
    i32 2, label %137
  ]

133:                                              ; preds = %131
  %134 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %135 = load i32, ptr %134, align 4, !tbaa !11
  %136 = and i32 %135, -65
  store i32 %136, ptr %134, align 4, !tbaa !11
  br label %144

137:                                              ; preds = %131
  %138 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 2
  %139 = load i32, ptr %138, align 4, !tbaa !11
  %140 = or i32 %139, 64
  store i32 %140, ptr %138, align 4, !tbaa !11
  br label %144

141:                                              ; preds = %131
  %142 = load ptr, ptr @stderr, align 8, !tbaa !13
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef @.str.18) #5
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

144:                                              ; preds = %137, %133
  %145 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !16
  %147 = and i32 %146, -2
  store i32 %147, ptr %145, align 4, !tbaa !16
  %148 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 3
  %149 = load i32, ptr %148, align 4, !tbaa !17
  %150 = and i32 %149, -28
  store i32 %150, ptr %148, align 4, !tbaa !17
  %151 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 5
  %152 = getelementptr inbounds [32 x i8], ptr %151, i64 0, i64 5
  store i8 1, ptr %152, align 1, !tbaa !18
  %153 = getelementptr inbounds %struct.termios, ptr %18, i32 0, i32 5
  %154 = getelementptr inbounds [32 x i8], ptr %153, i64 0, i64 6
  store i8 1, ptr %154, align 1, !tbaa !18
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = call i32 @tcflush(i32 noundef %155, i32 noundef 0) #5
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = call i32 @tcsetattr(i32 noundef %157, i32 noundef 0, ptr noundef %18) #5
  %159 = icmp ne i32 %158, 0
  br i1 %159, label %160, label %161

160:                                              ; preds = %144
  call void @perror(ptr noundef @.str.19)
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

161:                                              ; preds = %144
  store i32 0, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %162

162:                                              ; preds = %161, %160, %141, %128, %92, %23
  call void @llvm.lifetime.end.p0(i64 60, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 28, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 28, 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
  %163 = load i32, ptr %7, align 4
  ret i32 %163
}

; Function Attrs: nounwind
declare i32 @tcgetattr(i32 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare i32 @cfsetispeed(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind
declare i32 @cfsetospeed(ptr noundef, i32 noundef) #4

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

; Function Attrs: nounwind
declare i32 @tcflush(i32 noundef, i32 noundef) #4

; Function Attrs: nounwind
declare i32 @tcsetattr(i32 noundef, i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 }

!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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS7termios", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !7, i64 16, !7, i64 17, !6, i64 52, !6, i64 56}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 4}
!17 = !{!12, !6, i64 12}
!18 = !{!7, !7, i64 0}


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

%struct.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }

@__const._Z9UART0_Setiiiiii.speed_arr = external hidden unnamed_addr constant [7 x i32], align 16
@__const._Z9UART0_Setiiiiii.name_arr = external hidden unnamed_addr constant [7 x i32], align 16
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 -1, 1) i32 @_Z9UART0_Setiiiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #2 {
  %7 = alloca %struct.termios, align 4
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %7) #4
  %8 = call i32 @tcgetattr(i32 noundef %0, ptr noundef nonnull %7) #4
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.preheader.preheader, label %11

.preheader.preheader:                             ; preds = %6
  %9 = load i32, ptr @__const._Z9UART0_Setiiiiii.name_arr, align 16, !tbaa !5
  %10 = icmp eq i32 %9, %1
  br i1 %10, label %12, label %.preheader.1

11:                                               ; preds = %6
  call void @perror(ptr noundef nonnull @.str.15) #5
  br label %115

12:                                               ; preds = %.preheader.preheader
  %13 = load i32, ptr @__const._Z9UART0_Setiiiiii.speed_arr, align 16, !tbaa !5
  %14 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %13) #4
  %15 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %13) #4
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader, %12
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 4), align 4, !tbaa !5
  %17 = icmp eq i32 %16, %1
  br i1 %17, label %18, label %.preheader.2

18:                                               ; preds = %.preheader.1
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 4), align 4, !tbaa !5
  %20 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %19) #4
  %21 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %19) #4
  br label %.preheader.2

.preheader.2:                                     ; preds = %18, %.preheader.1
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 8), align 8, !tbaa !5
  %23 = icmp eq i32 %22, %1
  br i1 %23, label %24, label %.preheader.3

24:                                               ; preds = %.preheader.2
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 8), align 8, !tbaa !5
  %26 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %25) #4
  %27 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %25) #4
  br label %.preheader.3

.preheader.3:                                     ; preds = %24, %.preheader.2
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 12), align 4, !tbaa !5
  %29 = icmp eq i32 %28, %1
  br i1 %29, label %30, label %.preheader.4

30:                                               ; preds = %.preheader.3
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 12), align 4, !tbaa !5
  %32 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %31) #4
  %33 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %31) #4
  br label %.preheader.4

.preheader.4:                                     ; preds = %30, %.preheader.3
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 16), align 16, !tbaa !5
  %35 = icmp eq i32 %34, %1
  br i1 %35, label %36, label %.preheader.5

36:                                               ; preds = %.preheader.4
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 16), align 16, !tbaa !5
  %38 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %37) #4
  %39 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %37) #4
  br label %.preheader.5

.preheader.5:                                     ; preds = %36, %.preheader.4
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 20), align 4, !tbaa !5
  %41 = icmp eq i32 %40, %1
  br i1 %41, label %42, label %.preheader.6

42:                                               ; preds = %.preheader.5
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 20), align 4, !tbaa !5
  %44 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %43) #4
  %45 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %43) #4
  br label %.preheader.6

.preheader.6:                                     ; preds = %42, %.preheader.5
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.name_arr, i64 24), align 8, !tbaa !5
  %47 = icmp eq i32 %46, %1
  br i1 %47, label %48, label %52

48:                                               ; preds = %.preheader.6
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @__const._Z9UART0_Setiiiiii.speed_arr, i64 24), align 8, !tbaa !5
  %50 = call i32 @cfsetispeed(ptr noundef nonnull %7, i32 noundef %49) #4
  %51 = call i32 @cfsetospeed(ptr noundef nonnull %7, i32 noundef %49) #4
  br label %52

52:                                               ; preds = %48, %.preheader.6
  %53 = getelementptr inbounds i8, ptr %7, i64 8
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = or i32 %54, 2176
  switch i32 %2, label %62 [
    i32 0, label %56
    i32 1, label %58
    i32 2, label %60
  ]

56:                                               ; preds = %52
  %57 = and i32 %55, 2147483647
  br label %62

58:                                               ; preds = %52
  %59 = or i32 %54, -2147481472
  br label %62

60:                                               ; preds = %52
  %61 = or i32 %54, 7296
  br label %62

62:                                               ; preds = %60, %58, %56, %52
  %63 = phi i32 [ %61, %60 ], [ %59, %58 ], [ %57, %56 ], [ %55, %52 ]
  %64 = and i32 %63, -49
  store i32 %64, ptr %53, align 4, !tbaa !9
  switch i32 %3, label %71 [
    i32 5, label %74
    i32 6, label %65
    i32 7, label %67
    i32 8, label %69
  ]

65:                                               ; preds = %62
  %66 = or disjoint i32 %64, 16
  br label %.sink.split

67:                                               ; preds = %62
  %68 = or disjoint i32 %64, 32
  br label %.sink.split

69:                                               ; preds = %62
  %70 = or i32 %63, 48
  br label %.sink.split

71:                                               ; preds = %62
  %72 = load ptr, ptr @stderr, align 8, !tbaa !11
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str.16) #6
  br label %115

.sink.split:                                      ; preds = %65, %67, %69
  %.sink = phi i32 [ %70, %69 ], [ %68, %67 ], [ %66, %65 ]
  store i32 %.sink, ptr %53, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %.sink.split, %62
  %75 = phi i32 [ %64, %62 ], [ %.sink, %.sink.split ]
  switch i32 %5, label %91 [
    i32 110, label %76
    i32 78, label %76
    i32 111, label %80
    i32 79, label %80
    i32 101, label %84
    i32 69, label %84
    i32 115, label %89
    i32 83, label %89
  ]

76:                                               ; preds = %74, %74
  %77 = and i32 %75, -257
  store i32 %77, ptr %53, align 4, !tbaa !9
  %78 = load i32, ptr %7, align 4, !tbaa !13
  %79 = and i32 %78, -17
  store i32 %79, ptr %7, align 4, !tbaa !13
  br label %94

80:                                               ; preds = %74, %74
  %81 = or i32 %75, 768
  store i32 %81, ptr %53, align 4, !tbaa !9
  %82 = load i32, ptr %7, align 4, !tbaa !13
  %83 = or i32 %82, 16
  store i32 %83, ptr %7, align 4, !tbaa !13
  br label %94

84:                                               ; preds = %74, %74
  %85 = and i32 %75, -769
  %86 = or disjoint i32 %85, 256
  store i32 %86, ptr %53, align 4, !tbaa !9
  %87 = load i32, ptr %7, align 4, !tbaa !13
  %88 = or i32 %87, 16
  store i32 %88, ptr %7, align 4, !tbaa !13
  br label %94

89:                                               ; preds = %74, %74
  %90 = and i32 %75, -321
  store i32 %90, ptr %53, align 4, !tbaa !9
  br label %94

91:                                               ; preds = %74
  %92 = load ptr, ptr @stderr, align 8, !tbaa !11
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str.17) #6
  br label %115

94:                                               ; preds = %89, %84, %80, %76
  %95 = phi i32 [ %90, %89 ], [ %86, %84 ], [ %81, %80 ], [ %77, %76 ]
  switch i32 %4, label %100 [
    i32 1, label %96
    i32 2, label %98
  ]

96:                                               ; preds = %94
  %97 = and i32 %95, -65
  br label %103

98:                                               ; preds = %94
  %99 = or i32 %95, 64
  br label %103

100:                                              ; preds = %94
  %101 = load ptr, ptr @stderr, align 8, !tbaa !11
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str.18) #6
  br label %115

103:                                              ; preds = %98, %96
  %storemerge = phi i32 [ %99, %98 ], [ %97, %96 ]
  store i32 %storemerge, ptr %53, align 4, !tbaa !9
  %104 = getelementptr inbounds i8, ptr %7, i64 4
  %105 = load i32, ptr %104, align 4, !tbaa !14
  %106 = and i32 %105, -2
  store i32 %106, ptr %104, align 4, !tbaa !14
  %107 = getelementptr inbounds i8, ptr %7, i64 12
  %108 = load i32, ptr %107, align 4, !tbaa !15
  %109 = and i32 %108, -28
  store i32 %109, ptr %107, align 4, !tbaa !15
  %110 = getelementptr inbounds i8, ptr %7, i64 22
  store i8 1, ptr %110, align 2, !tbaa !16
  %111 = getelementptr inbounds i8, ptr %7, i64 23
  store i8 1, ptr %111, align 1, !tbaa !16
  %112 = call i32 @tcflush(i32 noundef %0, i32 noundef 0) #4
  %113 = call i32 @tcsetattr(i32 noundef %0, i32 noundef 0, ptr noundef nonnull %7) #4
  %.not16 = icmp eq i32 %113, 0
  br i1 %.not16, label %115, label %114

114:                                              ; preds = %103
  call void @perror(ptr noundef nonnull @.str.19) #5
  br label %115

115:                                              ; preds = %103, %114, %100, %91, %71, %11
  %.0 = phi i32 [ -1, %11 ], [ -1, %71 ], [ -1, %91 ], [ -1, %100 ], [ -1, %114 ], [ 0, %103 ]
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %7) #4
  ret i32 %.0
}

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

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

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

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

; Function Attrs: nounwind
declare i32 @tcflush(i32 noundef, i32 noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #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 = { nounwind }
attributes #5 = { cold }
attributes #6 = { 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++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTS7termios", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !7, i64 16, !7, i64 17, !6, i64 52, !6, i64 56}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !6, i64 4}
!15 = !{!10, !6, i64 12}
!16 = !{!7, !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass