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

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

@__const._Z6Serialiibb.dev = external hidden unnamed_addr constant [2 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@__const._Z6Serialiibb.rcv = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_yaw = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_pitch = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_F = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_dist = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z6Serialiibb(i32 noundef %0, i32 noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca [2 x ptr], align 16
  %15 = alloca i32, align 4
  %16 = alloca [8 x i8], align 1
  %17 = alloca [8 x i8], align 1
  %18 = alloca [8 x i8], align 1
  %19 = alloca [8 x i8], align 1
  %20 = alloca [8 x i8], align 1
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  %25 = zext i1 %2 to i8
  store i8 %25, ptr %8, align 1, !tbaa !9
  %26 = zext i1 %3 to i8
  store i8 %26, ptr %9, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 -1, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const._Z6Serialiibb.dev, i64 16, i1 false)
  %27 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %28 = trunc i8 %27 to i1
  br i1 %28, label %29, label %38

29:                                               ; preds = %4
  %30 = getelementptr inbounds [2 x ptr], ptr %14, i64 0, i64 1
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = call i32 (ptr, i32, ...) @open(ptr noundef %31, i32 noundef 2306)
  store i32 %32, ptr %10, align 4, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = icmp eq i32 -1, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  call void @perror(ptr noundef @.str.2)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %214

36:                                               ; preds = %29
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %36
  br label %40

38:                                               ; preds = %4
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %214

40:                                               ; preds = %37
  br label %41

41:                                               ; preds = %51, %40
  %42 = load i32, ptr %10, align 4, !tbaa !5
  %43 = call noundef i32 @_Z10UART0_Initiiiiii(i32 noundef %42, i32 noundef 115200, i32 noundef 0, i32 noundef 8, i32 noundef 1, i32 noundef 78)
  store i32 %43, ptr %11, align 4, !tbaa !5
  %44 = call i32 @usleep(i32 noundef 100)
  br label %45

45:                                               ; preds = %41
  %46 = load i32, ptr %11, align 4, !tbaa !5
  %47 = icmp eq i32 -1, %46
  br i1 %47, label %51, label %48

48:                                               ; preds = %45
  %49 = load i32, ptr %10, align 4, !tbaa !5
  %50 = icmp eq i32 -1, %49
  br label %51

51:                                               ; preds = %48, %45
  %52 = phi i1 [ true, %45 ], [ %50, %48 ]
  br i1 %52, label %41, label %53, !llvm.loop !15

53:                                               ; preds = %51
  br label %54

54:                                               ; preds = %211, %53
  br label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %16, ptr align 1 @__const._Z6Serialiibb.rcv, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %17, ptr align 1 @__const._Z6Serialiibb.send_yaw, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %18, ptr align 1 @__const._Z6Serialiibb.send_pitch, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %19, ptr align 1 @__const._Z6Serialiibb.send_F, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %20, ptr align 1 @__const._Z6Serialiibb.send_dist, i64 8, i1 false)
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %58, label %66

58:                                               ; preds = %55
  %59 = getelementptr inbounds [8 x i8], ptr %17, i64 0, i64 2
  store i8 49, ptr %59, align 1, !tbaa !17
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %62, label %65

62:                                               ; preds = %58
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = call i32 @llvm.abs.i32(i32 %63, i1 true)
  store i32 %64, ptr %6, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %62, %58
  br label %66

66:                                               ; preds = %65, %55
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %69, label %77

69:                                               ; preds = %66
  %70 = getelementptr inbounds [8 x i8], ptr %18, i64 0, i64 2
  store i8 49, ptr %70, align 1, !tbaa !17
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = icmp slt i32 %71, 0
  br i1 %72, label %73, label %76

73:                                               ; preds = %69
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = call i32 @llvm.abs.i32(i32 %74, i1 true)
  store i32 %75, ptr %7, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %73, %69
  br label %77

77:                                               ; preds = %76, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  store i64 0, ptr %21, align 8, !tbaa !18
  br label %78

78:                                               ; preds = %92, %77
  %79 = load i64, ptr %21, align 8, !tbaa !18
  %80 = icmp ult i64 %79, 4
  br i1 %80, label %82, label %81

81:                                               ; preds = %78
  store i32 6, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %95

82:                                               ; preds = %78
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = srem i32 %83, 10
  %85 = add nsw i32 %84, 48
  %86 = trunc i32 %85 to i8
  %87 = load i64, ptr %21, align 8, !tbaa !18
  %88 = sub i64 5, %87
  %89 = getelementptr inbounds [8 x i8], ptr %17, i64 0, i64 %88
  store i8 %86, ptr %89, align 1, !tbaa !17
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = sdiv i32 %90, 10
  store i32 %91, ptr %6, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %82
  %93 = load i64, ptr %21, align 8, !tbaa !18
  %94 = add i64 %93, 1
  store i64 %94, ptr %21, align 8, !tbaa !18
  br label %78, !llvm.loop !20

95:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  store i64 0, ptr %22, align 8, !tbaa !18
  br label %96

96:                                               ; preds = %110, %95
  %97 = load i64, ptr %22, align 8, !tbaa !18
  %98 = icmp ult i64 %97, 4
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  store i32 9, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  br label %113

100:                                              ; preds = %96
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = srem i32 %101, 10
  %103 = add nsw i32 %102, 48
  %104 = trunc i32 %103 to i8
  %105 = load i64, ptr %22, align 8, !tbaa !18
  %106 = sub i64 5, %105
  %107 = getelementptr inbounds [8 x i8], ptr %18, i64 0, i64 %106
  store i8 %104, ptr %107, align 1, !tbaa !17
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = sdiv i32 %108, 10
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %100
  %111 = load i64, ptr %22, align 8, !tbaa !18
  %112 = add i64 %111, 1
  store i64 %112, ptr %22, align 8, !tbaa !18
  br label %96, !llvm.loop !21

113:                                              ; preds = %99
  %114 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %115 = trunc i8 %114 to i1
  br i1 %115, label %116, label %118

116:                                              ; preds = %113
  %117 = getelementptr inbounds [8 x i8], ptr %19, i64 0, i64 0
  store i8 1, ptr %117, align 1, !tbaa !17
  br label %120

118:                                              ; preds = %113
  %119 = getelementptr inbounds [8 x i8], ptr %19, i64 0, i64 0
  store i8 2, ptr %119, align 1, !tbaa !17
  br label %120

120:                                              ; preds = %118, %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  store i64 0, ptr %23, align 8, !tbaa !18
  br label %121

121:                                              ; preds = %131, %120
  %122 = load i64, ptr %23, align 8, !tbaa !18
  %123 = icmp ult i64 %122, 8
  br i1 %123, label %125, label %124

124:                                              ; preds = %121
  store i32 12, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %134

125:                                              ; preds = %121
  %126 = load i64, ptr %23, align 8, !tbaa !18
  %127 = getelementptr inbounds [8 x i8], ptr %18, i64 0, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !17
  %129 = sext i8 %128 to i32
  %130 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %129)
  br label %131

131:                                              ; preds = %125
  %132 = load i64, ptr %23, align 8, !tbaa !18
  %133 = add i64 %132, 1
  store i64 %133, ptr %23, align 8, !tbaa !18
  br label %121, !llvm.loop !22

134:                                              ; preds = %124
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %158

137:                                              ; preds = %134
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = getelementptr inbounds [8 x i8], ptr %19, i64 0, i64 0
  %140 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %138, ptr noundef %139, i32 noundef 8)
  store i32 %140, ptr %12, align 4, !tbaa !5
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = getelementptr inbounds [8 x i8], ptr %17, i64 0, i64 0
  %143 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %141, ptr noundef %142, i32 noundef 8)
  store i32 %143, ptr %12, align 4, !tbaa !5
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = getelementptr inbounds [8 x i8], ptr %18, i64 0, i64 0
  %146 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %144, ptr noundef %145, i32 noundef 8)
  store i32 %146, ptr %12, align 4, !tbaa !5
  %147 = load i32, ptr %10, align 4, !tbaa !5
  %148 = getelementptr inbounds [8 x i8], ptr %20, i64 0, i64 0
  %149 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %147, ptr noundef %148, i32 noundef 8)
  store i32 %149, ptr %12, align 4, !tbaa !5
  %150 = load i32, ptr %12, align 4, !tbaa !5
  %151 = icmp sgt i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %137
  %153 = load i32, ptr %12, align 4, !tbaa !5
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %153)
  br label %157

155:                                              ; preds = %137
  %156 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %157

157:                                              ; preds = %155, %152
  store i32 5, ptr %15, align 4
  br label %209

158:                                              ; preds = %134
  %159 = load i32, ptr %10, align 4, !tbaa !5
  %160 = getelementptr inbounds [8 x i8], ptr %16, i64 0, i64 0
  %161 = call noundef i32 @_Z10UART0_RecviPci(i32 noundef %159, ptr noundef %160, i32 noundef 8)
  store i32 %161, ptr %12, align 4, !tbaa !5
  %162 = load i32, ptr %12, align 4, !tbaa !5
  %163 = icmp sgt i32 %162, 0
  br i1 %163, label %164, label %205

164:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %175, %164
  %166 = load i32, ptr %24, align 4, !tbaa !5
  %167 = icmp slt i32 %166, 8
  br i1 %167, label %168, label %178

168:                                              ; preds = %165
  %169 = load i32, ptr %24, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [8 x i8], ptr %16, i64 0, i64 %170
  %172 = load i8, ptr %171, align 1, !tbaa !17
  %173 = sext i8 %172 to i32
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %173)
  br label %175

175:                                              ; preds = %168
  %176 = load i32, ptr %24, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %24, align 4, !tbaa !5
  br label %165, !llvm.loop !23

178:                                              ; preds = %165
  %179 = getelementptr inbounds [8 x i8], ptr %16, i64 0, i64 0
  %180 = load i8, ptr %179, align 1, !tbaa !17
  %181 = sext i8 %180 to i32
  %182 = icmp eq i32 %181, 1
  br i1 %182, label %183, label %185

183:                                              ; preds = %178
  %184 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %185

185:                                              ; preds = %183, %178
  %186 = getelementptr inbounds [8 x i8], ptr %16, i64 0, i64 0
  %187 = load i8, ptr %186, align 1, !tbaa !17
  %188 = sext i8 %187 to i32
  %189 = icmp eq i32 %188, 2
  br i1 %189, label %190, label %191

190:                                              ; preds = %185
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %202

191:                                              ; preds = %185
  %192 = getelementptr inbounds [8 x i8], ptr %16, i64 0, i64 0
  %193 = load i8, ptr %192, align 1, !tbaa !17
  %194 = sext i8 %193 to i32
  %195 = icmp eq i32 %194, 3
  br i1 %195, label %196, label %197

196:                                              ; preds = %191
  store i32 2, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %202

197:                                              ; preds = %191
  %198 = load i32, ptr %24, align 4, !tbaa !5
  %199 = icmp sgt i32 %198, 7
  br i1 %199, label %200, label %201

200:                                              ; preds = %197
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %200, %197
  store i32 0, ptr %15, align 4
  br label %202

202:                                              ; preds = %201, %196, %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  %203 = load i32, ptr %15, align 4
  switch i32 %203, label %209 [
    i32 0, label %204
  ]

204:                                              ; preds = %202
  br label %207

205:                                              ; preds = %158
  %206 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %207

207:                                              ; preds = %205, %204
  %208 = call i32 @usleep(i32 noundef 100)
  store i32 0, ptr %15, align 4
  br label %209

209:                                              ; preds = %207, %202, %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %210 = load i32, ptr %15, align 4
  switch i32 %210, label %214 [
    i32 0, label %211
    i32 5, label %212
  ]

211:                                              ; preds = %209
  br label %54, !llvm.loop !24

212:                                              ; preds = %209
  %213 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z11UART0_Closei(i32 noundef %213)
  unreachable

214:                                              ; preds = %209, %38, %35
  call void @llvm.lifetime.end.p0(i64 16, 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 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %215 = load i32, ptr %5, align 4
  ret i32 %215
}

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

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

declare i32 @open(ptr noundef, i32 noundef, ...) #3

declare void @perror(ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10UART0_Initiiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare i32 @usleep(i32 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10UART0_SendiPci(i32 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10UART0_RecviPci(i32 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11UART0_Closei(i32 noundef) #0

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !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"

@__const._Z6Serialiibb.dev = external hidden unnamed_addr constant [2 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@__const._Z6Serialiibb.send_yaw = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_pitch = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_F = external hidden unnamed_addr constant [8 x i8], align 1
@__const._Z6Serialiibb.send_dist = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z6Serialiibb(i32 noundef %0, i32 noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3) local_unnamed_addr #0 {
  %5 = alloca [8 x i8], align 8
  %6 = alloca [8 x i8], align 8
  %7 = alloca [8 x i8], align 8
  %8 = alloca [8 x i8], align 8
  br i1 %3, label %9, label %13

9:                                                ; preds = %4
  %.sroa.3.0.copyload = load ptr, ptr getelementptr inbounds (i8, ptr @__const._Z6Serialiibb.dev, i64 8), align 8
  %10 = tail call i32 (ptr, i32, ...) @open(ptr noundef %.sroa.3.0.copyload, i32 noundef 2306)
  %11 = icmp eq i32 %10, -1
  br i1 %11, label %12, label %.preheader57

12:                                               ; preds = %9
  tail call void @perror(ptr noundef nonnull @.str.2) #5
  br label %89

13:                                               ; preds = %4
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %89

.preheader57:                                     ; preds = %9, %.preheader57
  %15 = tail call noundef i32 @_Z10UART0_Initiiiiii(i32 noundef %10, i32 noundef 115200, i32 noundef 0, i32 noundef 8, i32 noundef 1, i32 noundef 78)
  %16 = tail call i32 @usleep(i32 noundef 100)
  %17 = icmp eq i32 %15, -1
  br i1 %17, label %.preheader57, label %.preheader.preheader, !llvm.loop !5

.preheader.preheader:                             ; preds = %.preheader57
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %18 = load i64, ptr @__const._Z6Serialiibb.send_yaw, align 1
  store i64 %18, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %19 = load i64, ptr @__const._Z6Serialiibb.send_pitch, align 1
  store i64 %19, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %20 = load i64, ptr @__const._Z6Serialiibb.send_F, align 1
  store i64 %20, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %21 = load i64, ptr @__const._Z6Serialiibb.send_dist, align 1
  store i64 %21, ptr %8, align 8
  %22 = trunc i64 %19 to i32
  %23 = trunc i64 %19 to i32
  %24 = srem i32 %0, 10
  %25 = trunc nsw i32 %24 to i8
  %26 = add nsw i8 %25, 48
  %27 = getelementptr inbounds i8, ptr %5, i64 5
  store i8 %26, ptr %27, align 1, !tbaa !7
  %28 = sdiv i32 %0, 10
  %29 = srem i32 %28, 10
  %30 = trunc nsw i32 %29 to i8
  %31 = add nsw i8 %30, 48
  %32 = getelementptr inbounds i8, ptr %5, i64 4
  store i8 %31, ptr %32, align 4, !tbaa !7
  %33 = sdiv i32 %0, 100
  %34 = srem i32 %33, 10
  %35 = trunc nsw i32 %34 to i8
  %36 = add nsw i8 %35, 48
  %37 = getelementptr inbounds i8, ptr %5, i64 3
  store i8 %36, ptr %37, align 1, !tbaa !7
  %38 = sdiv i32 %0, 1000
  %39 = srem i32 %38, 10
  %40 = trunc nsw i32 %39 to i8
  %41 = add nsw i8 %40, 48
  %42 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 %41, ptr %42, align 2, !tbaa !7
  %43 = srem i32 %1, 10
  %44 = trunc nsw i32 %43 to i8
  %45 = add nsw i8 %44, 48
  %46 = getelementptr inbounds i8, ptr %6, i64 5
  store i8 %45, ptr %46, align 1, !tbaa !7
  %47 = sdiv i32 %1, 10
  %48 = srem i32 %47, 10
  %49 = trunc nsw i32 %48 to i8
  %50 = add nsw i8 %49, 48
  %51 = getelementptr inbounds i8, ptr %6, i64 4
  store i8 %50, ptr %51, align 4, !tbaa !7
  %52 = sdiv i32 %1, 100
  %53 = srem i32 %52, 10
  %54 = trunc nsw i32 %53 to i8
  %55 = add nsw i8 %54, 48
  %56 = getelementptr inbounds i8, ptr %6, i64 3
  store i8 %55, ptr %56, align 1, !tbaa !7
  %57 = sdiv i32 %1, 1000
  %58 = srem i32 %57, 10
  %59 = trunc nsw i32 %58 to i8
  %60 = add nsw i8 %59, 48
  %61 = getelementptr inbounds i8, ptr %6, i64 2
  store i8 %60, ptr %61, align 2, !tbaa !7
  %. = select i1 %2, i8 1, i8 2
  store i8 %., ptr %7, align 8, !tbaa !7
  %sext = shl i32 %22, 24
  %62 = ashr exact i32 %sext, 24
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %62)
  %64 = shl i32 %23, 16
  %65 = ashr i32 %64, 24
  %66 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %65)
  %67 = zext nneg i8 %60 to i32
  %68 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %67)
  %69 = zext nneg i8 %55 to i32
  %70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %69)
  %71 = zext nneg i8 %50 to i32
  %72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %71)
  %73 = zext nneg i8 %45 to i32
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %73)
  %sh.diff = lshr i64 %19, 24
  %tr.sh.diff = trunc i64 %sh.diff to i32
  %75 = ashr i32 %tr.sh.diff, 24
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %75)
  %sh.diff66 = lshr i64 %19, 32
  %tr.sh.diff67 = trunc nuw i64 %sh.diff66 to i32
  %77 = ashr i32 %tr.sh.diff67, 24
  %78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %77)
  %79 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %10, ptr noundef nonnull %7, i32 noundef 8)
  %80 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %10, ptr noundef nonnull %5, i32 noundef 8)
  %81 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %10, ptr noundef nonnull %6, i32 noundef 8)
  %82 = call noundef i32 @_Z10UART0_SendiPci(i32 noundef %10, ptr noundef nonnull %8, i32 noundef 8)
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %84, label %86

84:                                               ; preds = %.preheader.preheader
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %82)
  br label %88

86:                                               ; preds = %.preheader.preheader
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %88

88:                                               ; preds = %84, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @_Z11UART0_Closei(i32 noundef %10)
  unreachable

89:                                               ; preds = %13, %12
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10UART0_Initiiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @usleep(i32 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10UART0_SendiPci(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11UART0_Closei(i32 noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree "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 = { cold }
attributes #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass