; LLVM IR from beagleboard/librobotcontrol :: library/src/io (pwm)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [63 x i8], align 1
@mode = external hidden global i32, align 4
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@ssindex = external hidden global [3 x i32], align 4
@dutyA_fd = external hidden global [3 x i32], align 4
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@dutyB_fd = external hidden global [3 x i32], align 4
@.str.8 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [55 x i8], align 1
@period_ns = external hidden global [3 x i32], align 4
@.str.27 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [61 x i8], align 1
@init_flag = external hidden global [3 x i32], align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @rc_pwm_init(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %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 [128 x i8], align 16
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #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
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %20, label %17

17:                                               ; preds = %2
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 2
  br i1 %19, label %20, label %23

20:                                               ; preds = %17, %2
  %21 = load ptr, ptr @stderr, align 8, !tbaa !9
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

23:                                               ; preds = %17
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 1
  br i1 %25, label %29, label %26

26:                                               ; preds = %23
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp sgt i32 %27, 1000000000
  br i1 %28, label %29, label %32

29:                                               ; preds = %26, %23
  %30 = load ptr, ptr @stderr, align 8, !tbaa !9
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.1, i32 noundef 1, i32 noundef 1000000000) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

32:                                               ; preds = %26
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = call i32 @__unexport_channels(i32 noundef %33)
  %35 = icmp eq i32 %34, -1
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

37:                                               ; preds = %32
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = call i32 @__export_channels(i32 noundef %38)
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

42:                                               ; preds = %37
  %43 = load i32, ptr @mode, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  %46 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = mul nsw i32 %47, 2
  %49 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %46, i64 noundef 128, ptr noundef @.str.2, i32 noundef %48) #5
  store i32 %49, ptr %13, align 4, !tbaa !5
  br label %57

50:                                               ; preds = %42
  %51 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %51, i64 noundef 128, ptr noundef @.str.3, i32 noundef %55) #5
  store i32 %56, ptr %13, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %50, %45
  %58 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %59 = call i32 (ptr, i32, ...) @open(ptr noundef %58, i32 noundef 1)
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %61
  store i32 %59, ptr %62, align 4, !tbaa !5
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %66, -1
  %68 = xor i1 %67, true
  %69 = xor i1 %68, true
  %70 = zext i1 %69 to i32
  %71 = sext i32 %70 to i64
  %72 = call i64 @llvm.expect.i64(i64 %71, i64 0)
  %73 = icmp ne i64 %72, 0
  br i1 %73, label %74, label %96

74:                                               ; preds = %57
  call void @rc_usleep(i32 noundef 600000)
  %75 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %76 = call i32 (ptr, i32, ...) @open(ptr noundef %75, i32 noundef 1)
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %78
  store i32 %76, ptr %79, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp eq i32 %83, -1
  %85 = xor i1 %84, true
  %86 = xor i1 %85, true
  %87 = zext i1 %86 to i32
  %88 = sext i32 %87 to i64
  %89 = call i64 @llvm.expect.i64(i64 %88, i64 0)
  %90 = icmp ne i64 %89, 0
  br i1 %90, label %91, label %95

91:                                               ; preds = %74
  call void @perror(ptr noundef @.str.4)
  %92 = load ptr, ptr @stderr, align 8, !tbaa !9
  %93 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.5, ptr noundef %93) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

95:                                               ; preds = %74
  br label %96

96:                                               ; preds = %95, %57
  %97 = load i32, ptr @mode, align 4, !tbaa !5
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %104

99:                                               ; preds = %96
  %100 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = mul nsw i32 %101, 2
  %103 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %100, i64 noundef 128, ptr noundef @.str.6, i32 noundef %102) #5
  store i32 %103, ptr %13, align 4, !tbaa !5
  br label %111

104:                                              ; preds = %96
  %105 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %105, i64 noundef 128, ptr noundef @.str.7, i32 noundef %109) #5
  store i32 %110, ptr %13, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %104, %99
  %112 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %113 = call i32 (ptr, i32, ...) @open(ptr noundef %112, i32 noundef 1)
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [3 x i32], ptr @dutyB_fd, i64 0, i64 %115
  store i32 %113, ptr %116, align 4, !tbaa !5
  %117 = load i32, ptr %4, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [3 x i32], ptr @dutyB_fd, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = icmp eq i32 %120, -1
  %122 = xor i1 %121, true
  %123 = xor i1 %122, true
  %124 = zext i1 %123 to i32
  %125 = sext i32 %124 to i64
  %126 = call i64 @llvm.expect.i64(i64 %125, i64 0)
  %127 = icmp ne i64 %126, 0
  br i1 %127, label %128, label %132

128:                                              ; preds = %111
  call void @perror(ptr noundef @.str.8)
  %129 = load ptr, ptr @stderr, align 8, !tbaa !9
  %130 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %131 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.5, ptr noundef %130) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

132:                                              ; preds = %111
  %133 = load i32, ptr @mode, align 4, !tbaa !5
  %134 = icmp eq i32 %133, 0
  br i1 %134, label %135, label %140

135:                                              ; preds = %132
  %136 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = mul nsw i32 %137, 2
  %139 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %136, i64 noundef 128, ptr noundef @.str.9, i32 noundef %138) #5
  store i32 %139, ptr %13, align 4, !tbaa !5
  br label %147

140:                                              ; preds = %132
  %141 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %142 = load i32, ptr %4, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %141, i64 noundef 128, ptr noundef @.str.10, i32 noundef %145) #5
  store i32 %146, ptr %13, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %140, %135
  %148 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %149 = call i32 (ptr, i32, ...) @open(ptr noundef %148, i32 noundef 1)
  store i32 %149, ptr %8, align 4, !tbaa !5
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = icmp eq i32 %150, -1
  %152 = xor i1 %151, true
  %153 = xor i1 %152, true
  %154 = zext i1 %153 to i32
  %155 = sext i32 %154 to i64
  %156 = call i64 @llvm.expect.i64(i64 %155, i64 0)
  %157 = icmp ne i64 %156, 0
  br i1 %157, label %158, label %162

158:                                              ; preds = %147
  call void @perror(ptr noundef @.str.11)
  %159 = load ptr, ptr @stderr, align 8, !tbaa !9
  %160 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %161 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %159, ptr noundef @.str.5, ptr noundef %160) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

162:                                              ; preds = %147
  %163 = load i32, ptr @mode, align 4, !tbaa !5
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %170

165:                                              ; preds = %162
  %166 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = mul nsw i32 %167, 2
  %169 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %166, i64 noundef 128, ptr noundef @.str.12, i32 noundef %168) #5
  store i32 %169, ptr %13, align 4, !tbaa !5
  br label %177

170:                                              ; preds = %162
  %171 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %172 = load i32, ptr %4, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %171, i64 noundef 128, ptr noundef @.str.13, i32 noundef %175) #5
  store i32 %176, ptr %13, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %170, %165
  %178 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %179 = call i32 (ptr, i32, ...) @open(ptr noundef %178, i32 noundef 1)
  store i32 %179, ptr %9, align 4, !tbaa !5
  %180 = load i32, ptr %9, align 4, !tbaa !5
  %181 = icmp eq i32 %180, -1
  %182 = xor i1 %181, true
  %183 = xor i1 %182, true
  %184 = zext i1 %183 to i32
  %185 = sext i32 %184 to i64
  %186 = call i64 @llvm.expect.i64(i64 %185, i64 0)
  %187 = icmp ne i64 %186, 0
  br i1 %187, label %188, label %192

188:                                              ; preds = %177
  call void @perror(ptr noundef @.str.14)
  %189 = load ptr, ptr @stderr, align 8, !tbaa !9
  %190 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %191 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %189, ptr noundef @.str.5, ptr noundef %190) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

192:                                              ; preds = %177
  %193 = load i32, ptr @mode, align 4, !tbaa !5
  %194 = icmp eq i32 %193, 0
  br i1 %194, label %195, label %200

195:                                              ; preds = %192
  %196 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %197 = load i32, ptr %4, align 4, !tbaa !5
  %198 = mul nsw i32 %197, 2
  %199 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %196, i64 noundef 128, ptr noundef @.str.15, i32 noundef %198) #5
  store i32 %199, ptr %13, align 4, !tbaa !5
  br label %207

200:                                              ; preds = %192
  %201 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %202 = load i32, ptr %4, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %201, i64 noundef 128, ptr noundef @.str.16, i32 noundef %205) #5
  store i32 %206, ptr %13, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %200, %195
  %208 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %209 = call i32 (ptr, i32, ...) @open(ptr noundef %208, i32 noundef 1)
  store i32 %209, ptr %6, align 4, !tbaa !5
  %210 = load i32, ptr %6, align 4, !tbaa !5
  %211 = icmp eq i32 %210, -1
  %212 = xor i1 %211, true
  %213 = xor i1 %212, true
  %214 = zext i1 %213 to i32
  %215 = sext i32 %214 to i64
  %216 = call i64 @llvm.expect.i64(i64 %215, i64 0)
  %217 = icmp ne i64 %216, 0
  br i1 %217, label %218, label %222

218:                                              ; preds = %207
  call void @perror(ptr noundef @.str.17)
  %219 = load ptr, ptr @stderr, align 8, !tbaa !9
  %220 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %221 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %219, ptr noundef @.str.5, ptr noundef %220) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

222:                                              ; preds = %207
  %223 = load i32, ptr @mode, align 4, !tbaa !5
  %224 = icmp eq i32 %223, 0
  br i1 %224, label %225, label %230

225:                                              ; preds = %222
  %226 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %227 = load i32, ptr %4, align 4, !tbaa !5
  %228 = mul nsw i32 %227, 2
  %229 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %226, i64 noundef 128, ptr noundef @.str.18, i32 noundef %228) #5
  store i32 %229, ptr %13, align 4, !tbaa !5
  br label %237

230:                                              ; preds = %222
  %231 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %232 = load i32, ptr %4, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %231, i64 noundef 128, ptr noundef @.str.19, i32 noundef %235) #5
  store i32 %236, ptr %13, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %230, %225
  %238 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %239 = call i32 (ptr, i32, ...) @open(ptr noundef %238, i32 noundef 1)
  store i32 %239, ptr %7, align 4, !tbaa !5
  %240 = load i32, ptr %7, align 4, !tbaa !5
  %241 = icmp eq i32 %240, -1
  %242 = xor i1 %241, true
  %243 = xor i1 %242, true
  %244 = zext i1 %243 to i32
  %245 = sext i32 %244 to i64
  %246 = call i64 @llvm.expect.i64(i64 %245, i64 0)
  %247 = icmp ne i64 %246, 0
  br i1 %247, label %248, label %252

248:                                              ; preds = %237
  call void @perror(ptr noundef @.str.20)
  %249 = load ptr, ptr @stderr, align 8, !tbaa !9
  %250 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %251 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %249, ptr noundef @.str.5, ptr noundef %250) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

252:                                              ; preds = %237
  %253 = load i32, ptr @mode, align 4, !tbaa !5
  %254 = icmp eq i32 %253, 0
  br i1 %254, label %255, label %260

255:                                              ; preds = %252
  %256 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %257 = load i32, ptr %4, align 4, !tbaa !5
  %258 = mul nsw i32 %257, 2
  %259 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %256, i64 noundef 128, ptr noundef @.str.21, i32 noundef %258) #5
  store i32 %259, ptr %13, align 4, !tbaa !5
  br label %267

260:                                              ; preds = %252
  %261 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %262 = load i32, ptr %4, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %263
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %261, i64 noundef 128, ptr noundef @.str.22, i32 noundef %265) #5
  store i32 %266, ptr %13, align 4, !tbaa !5
  br label %267

267:                                              ; preds = %260, %255
  %268 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %269 = call i32 (ptr, i32, ...) @open(ptr noundef %268, i32 noundef 1)
  store i32 %269, ptr %10, align 4, !tbaa !5
  %270 = load i32, ptr %10, align 4, !tbaa !5
  %271 = icmp eq i32 %270, -1
  %272 = xor i1 %271, true
  %273 = xor i1 %272, true
  %274 = zext i1 %273 to i32
  %275 = sext i32 %274 to i64
  %276 = call i64 @llvm.expect.i64(i64 %275, i64 0)
  %277 = icmp ne i64 %276, 0
  br i1 %277, label %278, label %282

278:                                              ; preds = %267
  call void @perror(ptr noundef @.str.23)
  %279 = load ptr, ptr @stderr, align 8, !tbaa !9
  %280 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %281 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %279, ptr noundef @.str.5, ptr noundef %280) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

282:                                              ; preds = %267
  %283 = load i32, ptr @mode, align 4, !tbaa !5
  %284 = icmp eq i32 %283, 0
  br i1 %284, label %285, label %290

285:                                              ; preds = %282
  %286 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %287 = load i32, ptr %4, align 4, !tbaa !5
  %288 = mul nsw i32 %287, 2
  %289 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %286, i64 noundef 128, ptr noundef @.str.24, i32 noundef %288) #5
  store i32 %289, ptr %13, align 4, !tbaa !5
  br label %297

290:                                              ; preds = %282
  %291 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %292 = load i32, ptr %4, align 4, !tbaa !5
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %293
  %295 = load i32, ptr %294, align 4, !tbaa !5
  %296 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %291, i64 noundef 128, ptr noundef @.str.25, i32 noundef %295) #5
  store i32 %296, ptr %13, align 4, !tbaa !5
  br label %297

297:                                              ; preds = %290, %285
  %298 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %299 = call i32 (ptr, i32, ...) @open(ptr noundef %298, i32 noundef 1)
  store i32 %299, ptr %11, align 4, !tbaa !5
  %300 = load i32, ptr %11, align 4, !tbaa !5
  %301 = icmp eq i32 %300, -1
  %302 = xor i1 %301, true
  %303 = xor i1 %302, true
  %304 = zext i1 %303 to i32
  %305 = sext i32 %304 to i64
  %306 = call i64 @llvm.expect.i64(i64 %305, i64 0)
  %307 = icmp ne i64 %306, 0
  br i1 %307, label %308, label %312

308:                                              ; preds = %297
  call void @perror(ptr noundef @.str.26)
  %309 = load ptr, ptr @stderr, align 8, !tbaa !9
  %310 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %311 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %309, ptr noundef @.str.5, ptr noundef %310) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

312:                                              ; preds = %297
  %313 = load i32, ptr %5, align 4, !tbaa !5
  %314 = sdiv i32 1000000000, %313
  %315 = load i32, ptr %4, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [3 x i32], ptr @period_ns, i64 0, i64 %316
  store i32 %314, ptr %317, align 4, !tbaa !5
  %318 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %319 = load i32, ptr %4, align 4, !tbaa !5
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [3 x i32], ptr @period_ns, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !5
  %323 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %318, i64 noundef 128, ptr noundef @.str.27, i32 noundef %322) #5
  store i32 %323, ptr %13, align 4, !tbaa !5
  %324 = load i32, ptr %6, align 4, !tbaa !5
  %325 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %326 = load i32, ptr %13, align 4, !tbaa !5
  %327 = sext i32 %326 to i64
  %328 = call i64 @write(i32 noundef %324, ptr noundef %325, i64 noundef %327)
  %329 = icmp eq i64 %328, -1
  %330 = xor i1 %329, true
  %331 = xor i1 %330, true
  %332 = zext i1 %331 to i32
  %333 = sext i32 %332 to i64
  %334 = call i64 @llvm.expect.i64(i64 %333, i64 0)
  %335 = icmp ne i64 %334, 0
  br i1 %335, label %336, label %337

336:                                              ; preds = %312
  call void @perror(ptr noundef @.str.28)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

337:                                              ; preds = %312
  %338 = load i32, ptr %7, align 4, !tbaa !5
  %339 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %340 = load i32, ptr %13, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = call i64 @write(i32 noundef %338, ptr noundef %339, i64 noundef %341)
  %343 = icmp eq i64 %342, -1
  %344 = xor i1 %343, true
  %345 = xor i1 %344, true
  %346 = zext i1 %345 to i32
  %347 = sext i32 %346 to i64
  %348 = call i64 @llvm.expect.i64(i64 %347, i64 0)
  %349 = icmp ne i64 %348, 0
  br i1 %349, label %350, label %351

350:                                              ; preds = %337
  call void @perror(ptr noundef @.str.29)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

351:                                              ; preds = %337
  %352 = load i32, ptr %10, align 4, !tbaa !5
  %353 = call i64 @write(i32 noundef %352, ptr noundef @.str.30, i64 noundef 7)
  %354 = icmp eq i64 %353, -1
  %355 = xor i1 %354, true
  %356 = xor i1 %355, true
  %357 = zext i1 %356 to i32
  %358 = sext i32 %357 to i64
  %359 = call i64 @llvm.expect.i64(i64 %358, i64 0)
  %360 = icmp ne i64 %359, 0
  br i1 %360, label %361, label %362

361:                                              ; preds = %351
  call void @perror(ptr noundef @.str.31)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

362:                                              ; preds = %351
  %363 = load i32, ptr %11, align 4, !tbaa !5
  %364 = call i64 @write(i32 noundef %363, ptr noundef @.str.30, i64 noundef 7)
  %365 = icmp eq i64 %364, -1
  %366 = xor i1 %365, true
  %367 = xor i1 %366, true
  %368 = zext i1 %367 to i32
  %369 = sext i32 %368 to i64
  %370 = call i64 @llvm.expect.i64(i64 %369, i64 0)
  %371 = icmp ne i64 %370, 0
  br i1 %371, label %372, label %373

372:                                              ; preds = %362
  call void @perror(ptr noundef @.str.32)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

373:                                              ; preds = %362
  %374 = load i32, ptr %4, align 4, !tbaa !5
  %375 = sext i32 %374 to i64
  %376 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %375
  %377 = load i32, ptr %376, align 4, !tbaa !5
  %378 = call i64 @write(i32 noundef %377, ptr noundef @.str.33, i64 noundef 2)
  %379 = icmp eq i64 %378, -1
  %380 = xor i1 %379, true
  %381 = xor i1 %380, true
  %382 = zext i1 %381 to i32
  %383 = sext i32 %382 to i64
  %384 = call i64 @llvm.expect.i64(i64 %383, i64 0)
  %385 = icmp ne i64 %384, 0
  br i1 %385, label %386, label %387

386:                                              ; preds = %373
  call void @perror(ptr noundef @.str.34)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

387:                                              ; preds = %373
  %388 = load i32, ptr %4, align 4, !tbaa !5
  %389 = sext i32 %388 to i64
  %390 = getelementptr inbounds [3 x i32], ptr @dutyB_fd, i64 0, i64 %389
  %391 = load i32, ptr %390, align 4, !tbaa !5
  %392 = call i64 @write(i32 noundef %391, ptr noundef @.str.33, i64 noundef 2)
  %393 = icmp eq i64 %392, -1
  %394 = xor i1 %393, true
  %395 = xor i1 %394, true
  %396 = zext i1 %395 to i32
  %397 = sext i32 %396 to i64
  %398 = call i64 @llvm.expect.i64(i64 %397, i64 0)
  %399 = icmp ne i64 %398, 0
  br i1 %399, label %400, label %401

400:                                              ; preds = %387
  call void @perror(ptr noundef @.str.35)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

401:                                              ; preds = %387
  %402 = load i32, ptr %8, align 4, !tbaa !5
  %403 = call i64 @write(i32 noundef %402, ptr noundef @.str.36, i64 noundef 2)
  %404 = icmp eq i64 %403, -1
  %405 = xor i1 %404, true
  %406 = xor i1 %405, true
  %407 = zext i1 %406 to i32
  %408 = sext i32 %407 to i64
  %409 = call i64 @llvm.expect.i64(i64 %408, i64 0)
  %410 = icmp ne i64 %409, 0
  br i1 %410, label %411, label %412

411:                                              ; preds = %401
  call void @perror(ptr noundef @.str.37)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

412:                                              ; preds = %401
  %413 = load i32, ptr %9, align 4, !tbaa !5
  %414 = call i64 @write(i32 noundef %413, ptr noundef @.str.36, i64 noundef 2)
  %415 = icmp eq i64 %414, -1
  %416 = xor i1 %415, true
  %417 = xor i1 %416, true
  %418 = zext i1 %417 to i32
  %419 = sext i32 %418 to i64
  %420 = call i64 @llvm.expect.i64(i64 %419, i64 0)
  %421 = icmp ne i64 %420, 0
  br i1 %421, label %422, label %423

422:                                              ; preds = %412
  call void @perror(ptr noundef @.str.38)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

423:                                              ; preds = %412
  %424 = load i32, ptr %8, align 4, !tbaa !5
  %425 = call i32 @close(i32 noundef %424)
  %426 = load i32, ptr %9, align 4, !tbaa !5
  %427 = call i32 @close(i32 noundef %426)
  %428 = load i32, ptr %6, align 4, !tbaa !5
  %429 = call i32 @close(i32 noundef %428)
  %430 = load i32, ptr %7, align 4, !tbaa !5
  %431 = call i32 @close(i32 noundef %430)
  %432 = load i32, ptr %10, align 4, !tbaa !5
  %433 = call i32 @close(i32 noundef %432)
  %434 = load i32, ptr %11, align 4, !tbaa !5
  %435 = call i32 @close(i32 noundef %434)
  %436 = load i32, ptr %4, align 4, !tbaa !5
  %437 = sext i32 %436 to i64
  %438 = getelementptr inbounds [3 x i32], ptr @init_flag, i64 0, i64 %437
  store i32 1, ptr %438, align 4, !tbaa !5
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %439

439:                                              ; preds = %423, %422, %411, %400, %386, %372, %361, %350, %336, %308, %278, %248, %218, %188, %158, %128, %91, %41, %36, %29, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 128, 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
  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 4, ptr %6) #5
  %440 = load i32, ptr %3, align 4
  ret i32 %440
}

; 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 @fprintf(ptr noundef, ptr noundef, ...) #2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #4

declare void @rc_usleep(i32 noundef) #3

declare void @perror(ptr noundef) #3

declare i64 @write(i32 noundef, ptr noundef, i64 noundef) #3

declare i32 @close(i32 noundef) #3

; 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 = { "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 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [63 x i8], align 1
@mode = external hidden local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@ssindex = external hidden local_unnamed_addr global [3 x i32], align 4
@dutyA_fd = external hidden local_unnamed_addr global [3 x i32], align 4
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@dutyB_fd = external hidden local_unnamed_addr global [3 x i32], align 4
@.str.8 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [55 x i8], align 1
@period_ns = external hidden local_unnamed_addr global [3 x i32], align 4
@.str.27 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [61 x i8], align 1
@init_flag = external hidden local_unnamed_addr global [3 x i32], align 4

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @rc_pwm_init(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca [128 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #5
  %or.cond = icmp ugt i32 %0, 2
  br i1 %or.cond, label %4, label %7

4:                                                ; preds = %2
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str) #6
  br label %198

7:                                                ; preds = %2
  %8 = add i32 %1, -1000000001
  %or.cond3 = icmp ult i32 %8, -1000000000
  br i1 %or.cond3, label %9, label %12

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

12:                                               ; preds = %7
  %13 = tail call i32 @__unexport_channels(i32 noundef %0)
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %198, label %15

15:                                               ; preds = %12
  %16 = tail call i32 @__export_channels(i32 noundef %0)
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %198, label %18

18:                                               ; preds = %15
  %19 = load i32, ptr @mode, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = shl nuw nsw i32 %0, 1
  %23 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.2, i32 noundef %22) #5
  %.pre = zext nneg i32 %0 to i64
  br label %29

24:                                               ; preds = %18
  %25 = zext nneg i32 %0 to i64
  %26 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.3, i32 noundef %27) #5
  br label %29

29:                                               ; preds = %24, %21
  %.pre-phi = phi i64 [ %25, %24 ], [ %.pre, %21 ]
  %30 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %31 = getelementptr inbounds [3 x i32], ptr @dutyA_fd, i64 0, i64 %.pre-phi
  store i32 %30, ptr %31, align 4, !tbaa !9
  %32 = icmp eq i32 %30, -1
  br i1 %32, label %33, label %39, !prof !11

33:                                               ; preds = %29
  tail call void @rc_usleep(i32 noundef 600000) #5
  %34 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  store i32 %34, ptr %31, align 4, !tbaa !9
  %35 = icmp eq i32 %34, -1
  br i1 %35, label %36, label %39, !prof !11

36:                                               ; preds = %33
  tail call void @perror(ptr noundef nonnull @.str.4) #7
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

39:                                               ; preds = %33, %29
  %40 = load i32, ptr @mode, align 4, !tbaa !9
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %45

42:                                               ; preds = %39
  %43 = shl nuw nsw i32 %0, 1
  %44 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.6, i32 noundef %43) #5
  br label %49

45:                                               ; preds = %39
  %46 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.7, i32 noundef %47) #5
  br label %49

49:                                               ; preds = %45, %42
  %50 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %51 = getelementptr inbounds [3 x i32], ptr @dutyB_fd, i64 0, i64 %.pre-phi
  store i32 %50, ptr %51, align 4, !tbaa !9
  %52 = icmp eq i32 %50, -1
  br i1 %52, label %53, label %56, !prof !11

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

56:                                               ; preds = %49
  %57 = load i32, ptr @mode, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %62

59:                                               ; preds = %56
  %60 = shl nuw nsw i32 %0, 1
  %61 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.9, i32 noundef %60) #5
  br label %66

62:                                               ; preds = %56
  %63 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.10, i32 noundef %64) #5
  br label %66

66:                                               ; preds = %62, %59
  %67 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %68 = icmp eq i32 %67, -1
  br i1 %68, label %69, label %72, !prof !11

69:                                               ; preds = %66
  tail call void @perror(ptr noundef nonnull @.str.11) #7
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

72:                                               ; preds = %66
  %73 = load i32, ptr @mode, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %78

75:                                               ; preds = %72
  %76 = shl nuw nsw i32 %0, 1
  %77 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.12, i32 noundef %76) #5
  br label %82

78:                                               ; preds = %72
  %79 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.13, i32 noundef %80) #5
  br label %82

82:                                               ; preds = %78, %75
  %83 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %84 = icmp eq i32 %83, -1
  br i1 %84, label %85, label %88, !prof !11

85:                                               ; preds = %82
  tail call void @perror(ptr noundef nonnull @.str.14) #7
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

88:                                               ; preds = %82
  %89 = load i32, ptr @mode, align 4, !tbaa !9
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %94

91:                                               ; preds = %88
  %92 = shl nuw nsw i32 %0, 1
  %93 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.15, i32 noundef %92) #5
  br label %98

94:                                               ; preds = %88
  %95 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %96 = load i32, ptr %95, align 4, !tbaa !9
  %97 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.16, i32 noundef %96) #5
  br label %98

98:                                               ; preds = %94, %91
  %99 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %100 = icmp eq i32 %99, -1
  br i1 %100, label %101, label %104, !prof !11

101:                                              ; preds = %98
  tail call void @perror(ptr noundef nonnull @.str.17) #7
  %102 = load ptr, ptr @stderr, align 8, !tbaa !5
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

104:                                              ; preds = %98
  %105 = load i32, ptr @mode, align 4, !tbaa !9
  %106 = icmp eq i32 %105, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %104
  %108 = shl nuw nsw i32 %0, 1
  %109 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.18, i32 noundef %108) #5
  br label %114

110:                                              ; preds = %104
  %111 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.19, i32 noundef %112) #5
  br label %114

114:                                              ; preds = %110, %107
  %115 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %116 = icmp eq i32 %115, -1
  br i1 %116, label %117, label %120, !prof !11

117:                                              ; preds = %114
  tail call void @perror(ptr noundef nonnull @.str.20) #7
  %118 = load ptr, ptr @stderr, align 8, !tbaa !5
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

120:                                              ; preds = %114
  %121 = load i32, ptr @mode, align 4, !tbaa !9
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %126

123:                                              ; preds = %120
  %124 = shl nuw nsw i32 %0, 1
  %125 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.21, i32 noundef %124) #5
  br label %130

126:                                              ; preds = %120
  %127 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.22, i32 noundef %128) #5
  br label %130

130:                                              ; preds = %126, %123
  %131 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %132 = icmp eq i32 %131, -1
  br i1 %132, label %133, label %136, !prof !11

133:                                              ; preds = %130
  tail call void @perror(ptr noundef nonnull @.str.23) #7
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

136:                                              ; preds = %130
  %137 = load i32, ptr @mode, align 4, !tbaa !9
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %142

139:                                              ; preds = %136
  %140 = shl nuw nsw i32 %0, 1
  %141 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.24, i32 noundef %140) #5
  br label %146

142:                                              ; preds = %136
  %143 = getelementptr inbounds [3 x i32], ptr @ssindex, i64 0, i64 %.pre-phi
  %144 = load i32, ptr %143, align 4, !tbaa !9
  %145 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.25, i32 noundef %144) #5
  br label %146

146:                                              ; preds = %142, %139
  %147 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %3, i32 noundef 1) #5
  %148 = icmp eq i32 %147, -1
  br i1 %148, label %149, label %152, !prof !11

149:                                              ; preds = %146
  tail call void @perror(ptr noundef nonnull @.str.26) #7
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef nonnull @.str.5, ptr noundef nonnull %3) #6
  br label %198

152:                                              ; preds = %146
  %153 = udiv i32 1000000000, %1
  %154 = getelementptr inbounds [3 x i32], ptr @period_ns, i64 0, i64 %.pre-phi
  store i32 %153, ptr %154, align 4, !tbaa !9
  %155 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 128, ptr noundef nonnull @.str.27, i32 noundef %153) #5
  %156 = sext i32 %155 to i64
  %157 = call i64 @write(i32 noundef %99, ptr noundef nonnull %3, i64 noundef %156) #5
  %158 = icmp eq i64 %157, -1
  br i1 %158, label %159, label %160, !prof !11

159:                                              ; preds = %152
  tail call void @perror(ptr noundef nonnull @.str.28) #7
  br label %198

160:                                              ; preds = %152
  %161 = call i64 @write(i32 noundef %115, ptr noundef nonnull %3, i64 noundef %156) #5
  %162 = icmp eq i64 %161, -1
  br i1 %162, label %163, label %164, !prof !11

163:                                              ; preds = %160
  tail call void @perror(ptr noundef nonnull @.str.29) #7
  br label %198

164:                                              ; preds = %160
  %165 = tail call i64 @write(i32 noundef %131, ptr noundef nonnull @.str.30, i64 noundef 7) #5
  %166 = icmp eq i64 %165, -1
  br i1 %166, label %167, label %168, !prof !11

167:                                              ; preds = %164
  tail call void @perror(ptr noundef nonnull @.str.31) #7
  br label %198

168:                                              ; preds = %164
  %169 = tail call i64 @write(i32 noundef %147, ptr noundef nonnull @.str.30, i64 noundef 7) #5
  %170 = icmp eq i64 %169, -1
  br i1 %170, label %171, label %172, !prof !11

171:                                              ; preds = %168
  tail call void @perror(ptr noundef nonnull @.str.32) #7
  br label %198

172:                                              ; preds = %168
  %173 = load i32, ptr %31, align 4, !tbaa !9
  %174 = tail call i64 @write(i32 noundef %173, ptr noundef nonnull @.str.33, i64 noundef 2) #5
  %175 = icmp eq i64 %174, -1
  br i1 %175, label %176, label %177, !prof !11

176:                                              ; preds = %172
  tail call void @perror(ptr noundef nonnull @.str.34) #7
  br label %198

177:                                              ; preds = %172
  %178 = load i32, ptr %51, align 4, !tbaa !9
  %179 = tail call i64 @write(i32 noundef %178, ptr noundef nonnull @.str.33, i64 noundef 2) #5
  %180 = icmp eq i64 %179, -1
  br i1 %180, label %181, label %182, !prof !11

181:                                              ; preds = %177
  tail call void @perror(ptr noundef nonnull @.str.35) #7
  br label %198

182:                                              ; preds = %177
  %183 = tail call i64 @write(i32 noundef %67, ptr noundef nonnull @.str.36, i64 noundef 2) #5
  %184 = icmp eq i64 %183, -1
  br i1 %184, label %185, label %186, !prof !11

185:                                              ; preds = %182
  tail call void @perror(ptr noundef nonnull @.str.37) #7
  br label %198

186:                                              ; preds = %182
  %187 = tail call i64 @write(i32 noundef %83, ptr noundef nonnull @.str.36, i64 noundef 2) #5
  %188 = icmp eq i64 %187, -1
  br i1 %188, label %189, label %190, !prof !11

189:                                              ; preds = %186
  tail call void @perror(ptr noundef nonnull @.str.38) #7
  br label %198

190:                                              ; preds = %186
  %191 = tail call i32 @close(i32 noundef %67) #5
  %192 = tail call i32 @close(i32 noundef %83) #5
  %193 = tail call i32 @close(i32 noundef %99) #5
  %194 = tail call i32 @close(i32 noundef %115) #5
  %195 = tail call i32 @close(i32 noundef %131) #5
  %196 = tail call i32 @close(i32 noundef %147) #5
  %197 = getelementptr inbounds [3 x i32], ptr @init_flag, i64 0, i64 %.pre-phi
  store i32 1, ptr %197, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %15, %12, %190, %189, %185, %181, %176, %171, %167, %163, %159, %149, %133, %117, %101, %85, %69, %53, %36, %9, %4
  %.0 = phi i32 [ -1, %4 ], [ -1, %9 ], [ -1, %36 ], [ -1, %53 ], [ -1, %69 ], [ -1, %85 ], [ -1, %101 ], [ -1, %117 ], [ -1, %133 ], [ -1, %149 ], [ -1, %159 ], [ -1, %163 ], [ -1, %167 ], [ -1, %171 ], [ -1, %176 ], [ -1, %181 ], [ -1, %185 ], [ -1, %189 ], [ 0, %190 ], [ -1, %12 ], [ -1, %15 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #5
  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 nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @__unexport_channels(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @__export_channels(i32 noundef) local_unnamed_addr #0

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

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

declare void @rc_usleep(i32 noundef) local_unnamed_addr #4

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

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #3

declare i32 @close(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

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

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass