; LLVM IR from tleonhardt/practical_cryptography_engineering :: aesgcm_file (main)

; 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.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }
%struct.mbedtls_entropy_context = type { %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_gcm_context = type { %struct.mbedtls_cipher_context_t, [16 x i64], [16 x i64], i64, i64, [16 x i8], [16 x i8], [16 x i8], i32 }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr }

@.str = external hidden unnamed_addr constant [266 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [32 x i8], align 16
  %10 = alloca [12 x i8], align 1
  %11 = alloca [16 x i8], align 16
  %12 = alloca [80 x i8], align 16
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %16 = alloca %struct.mbedtls_entropy_context, align 8
  %17 = alloca %struct.mbedtls_gcm_context, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  %32 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %32, i8 0, i64 32, i1 false)
  %33 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %33, i8 0, i64 12, i1 false)
  %34 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %34, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store ptr null, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store ptr null, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 344, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 416, ptr %17) #8
  call void @mbedtls_gcm_init(ptr noundef %17)
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 6
  br i1 %36, label %37, label %45

37:                                               ; preds = %2
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 0
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 0
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %40, ptr noundef %43)
  br label %322

45:                                               ; preds = %2
  %46 = load ptr, ptr %5, align 8, !tbaa !9
  %47 = getelementptr inbounds ptr, ptr %46, i64 1
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = call i32 @atoi(ptr noundef %48) #9
  store i32 %49, ptr %18, align 4, !tbaa !5
  %50 = load i32, ptr %18, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %45
  %53 = load i32, ptr %18, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 1
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = load ptr, ptr @stderr, align 8, !tbaa !9
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.1) #8
  br label %322

58:                                               ; preds = %52, %45
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 2
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !9
  %63 = getelementptr inbounds ptr, ptr %62, i64 3
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = call i32 @strcmp(ptr noundef %61, ptr noundef %64) #9
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %70

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

70:                                               ; preds = %58
  %71 = load ptr, ptr %5, align 8, !tbaa !9
  %72 = getelementptr inbounds ptr, ptr %71, i64 2
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = call noalias ptr @fopen(ptr noundef %73, ptr noundef @.str.3)
  store ptr %74, ptr %7, align 8, !tbaa !9
  %75 = icmp eq ptr %74, null
  br i1 %75, label %76, label %82

76:                                               ; preds = %70
  %77 = load ptr, ptr @stderr, align 8, !tbaa !9
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds ptr, ptr %78, i64 2
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.4, ptr noundef %80) #8
  br label %322

82:                                               ; preds = %70
  %83 = load ptr, ptr %5, align 8, !tbaa !9
  %84 = getelementptr inbounds ptr, ptr %83, i64 3
  %85 = load ptr, ptr %84, align 8, !tbaa !9
  %86 = call noalias ptr @fopen(ptr noundef %85, ptr noundef @.str.5)
  store ptr %86, ptr %8, align 8, !tbaa !9
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %94

88:                                               ; preds = %82
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  %91 = getelementptr inbounds ptr, ptr %90, i64 3
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.6, ptr noundef %92) #8
  br label %322

94:                                               ; preds = %82
  %95 = load ptr, ptr %5, align 8, !tbaa !9
  %96 = getelementptr inbounds ptr, ptr %95, i64 4
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = call i32 @memcmp(ptr noundef %97, ptr noundef @.str.7, i64 noundef 4) #9
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %132

100:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %101 = load ptr, ptr %5, align 8, !tbaa !9
  %102 = getelementptr inbounds ptr, ptr %101, i64 4
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  %104 = getelementptr inbounds i8, ptr %103, i64 4
  store ptr %104, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  store i64 0, ptr %21, align 8, !tbaa !11
  br label %105

105:                                              ; preds = %114, %100
  %106 = load ptr, ptr %19, align 8, !tbaa !9
  %107 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %106, ptr noundef @.str.8, ptr noundef %20) #8
  %108 = icmp sgt i32 %107, 0
  br i1 %108, label %109, label %112

109:                                              ; preds = %105
  %110 = load i64, ptr %21, align 8, !tbaa !11
  %111 = icmp ult i64 %110, 32
  br label %112

112:                                              ; preds = %109, %105
  %113 = phi i1 [ false, %105 ], [ %111, %109 ]
  br i1 %113, label %114, label %122

114:                                              ; preds = %112
  %115 = load i32, ptr %20, align 4, !tbaa !5
  %116 = trunc i32 %115 to i8
  %117 = load i64, ptr %21, align 8, !tbaa !11
  %118 = add i64 %117, 1
  store i64 %118, ptr %21, align 8, !tbaa !11
  %119 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 %117
  store i8 %116, ptr %119, align 1, !tbaa !13
  %120 = load ptr, ptr %19, align 8, !tbaa !9
  %121 = getelementptr inbounds i8, ptr %120, i64 2
  store ptr %121, ptr %19, align 8, !tbaa !9
  br label %105, !llvm.loop !14

122:                                              ; preds = %112
  %123 = load i64, ptr %21, align 8, !tbaa !11
  %124 = icmp ne i64 %123, 32
  br i1 %124, label %125, label %128

125:                                              ; preds = %122
  %126 = load ptr, ptr @stderr, align 8, !tbaa !9
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.9) #8
  store i32 2, ptr %22, align 4
  br label %129

128:                                              ; preds = %122
  store i32 0, ptr %22, align 4
  br label %129

129:                                              ; preds = %128, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  %130 = load i32, ptr %22, align 4
  switch i32 %130, label %382 [
    i32 0, label %131
    i32 2, label %322
  ]

131:                                              ; preds = %129
  br label %133

132:                                              ; preds = %94
  call void @perror(ptr noundef @.str.10)
  br label %322

133:                                              ; preds = %131
  %134 = load ptr, ptr %5, align 8, !tbaa !9
  %135 = getelementptr inbounds ptr, ptr %134, i64 5
  %136 = load ptr, ptr %135, align 8, !tbaa !9
  store ptr %136, ptr %23, align 8, !tbaa !9
  %137 = load ptr, ptr %5, align 8, !tbaa !9
  %138 = getelementptr inbounds ptr, ptr %137, i64 5
  %139 = load ptr, ptr %138, align 8, !tbaa !9
  %140 = call i64 @strlen(ptr noundef %139) #9
  store i64 %140, ptr %24, align 8, !tbaa !11
  %141 = load ptr, ptr %7, align 8, !tbaa !9
  %142 = call i32 @fileno(ptr noundef %141) #8
  %143 = call i64 @lseek(i32 noundef %142, i64 noundef 0, i32 noundef 2) #8
  store i64 %143, ptr %25, align 8, !tbaa !11
  %144 = icmp slt i64 %143, 0
  br i1 %144, label %145, label %146

145:                                              ; preds = %133
  call void @perror(ptr noundef @.str.11)
  br label %322

146:                                              ; preds = %133
  %147 = load i64, ptr %25, align 8, !tbaa !11
  store i64 %147, ptr %26, align 8, !tbaa !11
  %148 = load i64, ptr %26, align 8, !tbaa !11
  store i64 %148, ptr %27, align 8, !tbaa !11
  %149 = load ptr, ptr %7, align 8, !tbaa !9
  %150 = call i32 @fseek(ptr noundef %149, i64 noundef 0, i32 noundef 0)
  %151 = icmp slt i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %146
  %153 = load ptr, ptr @stderr, align 8, !tbaa !9
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef @.str.12) #8
  br label %322

155:                                              ; preds = %146
  %156 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %157 = call i32 @mbedtls_gcm_setkey(ptr noundef %17, i32 noundef 2, ptr noundef %156, i32 noundef 256)
  store i32 %157, ptr %6, align 4, !tbaa !5
  %158 = load i32, ptr %6, align 4, !tbaa !5
  %159 = icmp ne i32 %158, 0
  br i1 %159, label %160, label %164

160:                                              ; preds = %155
  %161 = load i32, ptr %6, align 4, !tbaa !5
  %162 = sub nsw i32 0, %161
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %162)
  br label %322

164:                                              ; preds = %155
  %165 = load i32, ptr %18, align 4, !tbaa !5
  %166 = icmp eq i32 %165, 0
  br i1 %166, label %167, label %254

167:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  store ptr @.str.14, ptr %30, align 8, !tbaa !9
  call void @mbedtls_entropy_init(ptr noundef %16)
  call void @mbedtls_ctr_drbg_init(ptr noundef %15)
  %168 = load ptr, ptr %30, align 8, !tbaa !9
  %169 = load ptr, ptr %30, align 8, !tbaa !9
  %170 = call i64 @strlen(ptr noundef %169) #9
  %171 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef %15, ptr noundef @mbedtls_entropy_func, ptr noundef %16, ptr noundef %168, i64 noundef %170)
  store i32 %171, ptr %6, align 4, !tbaa !5
  %172 = load i32, ptr %6, align 4, !tbaa !5
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %178

174:                                              ; preds = %167
  %175 = load i32, ptr %6, align 4, !tbaa !5
  %176 = sub nsw i32 0, %175
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %176)
  store i32 2, ptr %22, align 4
  br label %251

178:                                              ; preds = %167
  %179 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  %180 = call i32 @mbedtls_ctr_drbg_random(ptr noundef %15, ptr noundef %179, i64 noundef 12)
  store i32 %180, ptr %6, align 4, !tbaa !5
  %181 = load i32, ptr %6, align 4, !tbaa !5
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %187

183:                                              ; preds = %178
  %184 = load i32, ptr %6, align 4, !tbaa !5
  %185 = sub nsw i32 0, %184
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, i32 noundef %185)
  store i32 2, ptr %22, align 4
  br label %251

187:                                              ; preds = %178
  %188 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  %189 = load ptr, ptr %8, align 8, !tbaa !9
  %190 = call i64 @fwrite(ptr noundef %188, i64 noundef 1, i64 noundef 12, ptr noundef %189)
  %191 = icmp ne i64 %190, 12
  br i1 %191, label %192, label %195

192:                                              ; preds = %187
  %193 = load ptr, ptr @stderr, align 8, !tbaa !9
  %194 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %193, ptr noundef @.str.17, i32 noundef 12) #8
  store i32 2, ptr %22, align 4
  br label %251

195:                                              ; preds = %187
  %196 = load i64, ptr %27, align 8, !tbaa !11
  %197 = add i64 %196, 1
  %198 = call noalias ptr @malloc(i64 noundef %197) #10
  store ptr %198, ptr %13, align 8, !tbaa !9
  %199 = load i64, ptr %27, align 8, !tbaa !11
  %200 = add i64 %199, 1
  %201 = call noalias ptr @malloc(i64 noundef %200) #10
  store ptr %201, ptr %14, align 8, !tbaa !9
  %202 = load ptr, ptr %13, align 8, !tbaa !9
  %203 = load i64, ptr %27, align 8, !tbaa !11
  %204 = load ptr, ptr %7, align 8, !tbaa !9
  %205 = call i64 @fread(ptr noundef %202, i64 noundef 1, i64 noundef %203, ptr noundef %204)
  store i64 %205, ptr %28, align 8, !tbaa !11
  %206 = load i64, ptr %28, align 8, !tbaa !11
  %207 = load i64, ptr %27, align 8, !tbaa !11
  %208 = icmp ne i64 %206, %207
  br i1 %208, label %209, label %214

209:                                              ; preds = %195
  %210 = load ptr, ptr @stderr, align 8, !tbaa !9
  %211 = load i64, ptr %27, align 8, !tbaa !11
  %212 = load i64, ptr %28, align 8, !tbaa !11
  %213 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %210, ptr noundef @.str.18, i64 noundef %211, i64 noundef %212) #8
  store i32 2, ptr %22, align 4
  br label %251

214:                                              ; preds = %195
  %215 = load i64, ptr %27, align 8, !tbaa !11
  %216 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  %217 = load ptr, ptr %23, align 8, !tbaa !9
  %218 = load i64, ptr %24, align 8, !tbaa !11
  %219 = load ptr, ptr %13, align 8, !tbaa !9
  %220 = load ptr, ptr %14, align 8, !tbaa !9
  %221 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  %222 = call i32 @mbedtls_gcm_crypt_and_tag(ptr noundef %17, i32 noundef 1, i64 noundef %215, ptr noundef %216, i64 noundef 12, ptr noundef %217, i64 noundef %218, ptr noundef %219, ptr noundef %220, i64 noundef 16, ptr noundef %221)
  store i32 %222, ptr %6, align 4, !tbaa !5
  %223 = load i32, ptr %6, align 4, !tbaa !5
  %224 = icmp ne i32 %223, 0
  br i1 %224, label %225, label %229

225:                                              ; preds = %214
  %226 = load i32, ptr %6, align 4, !tbaa !5
  %227 = sub nsw i32 0, %226
  %228 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %227)
  store i32 2, ptr %22, align 4
  br label %251

229:                                              ; preds = %214
  %230 = load ptr, ptr %14, align 8, !tbaa !9
  %231 = load i64, ptr %27, align 8, !tbaa !11
  %232 = load ptr, ptr %8, align 8, !tbaa !9
  %233 = call i64 @fwrite(ptr noundef %230, i64 noundef 1, i64 noundef %231, ptr noundef %232)
  store i64 %233, ptr %29, align 8, !tbaa !11
  %234 = load i64, ptr %29, align 8, !tbaa !11
  %235 = load i64, ptr %27, align 8, !tbaa !11
  %236 = icmp ne i64 %234, %235
  br i1 %236, label %237, label %242

237:                                              ; preds = %229
  %238 = load ptr, ptr @stderr, align 8, !tbaa !9
  %239 = load i64, ptr %27, align 8, !tbaa !11
  %240 = load i64, ptr %29, align 8, !tbaa !11
  %241 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %238, ptr noundef @.str.20, i64 noundef %239, i64 noundef %240) #8
  store i32 2, ptr %22, align 4
  br label %251

242:                                              ; preds = %229
  %243 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  %244 = load ptr, ptr %8, align 8, !tbaa !9
  %245 = call i64 @fwrite(ptr noundef %243, i64 noundef 1, i64 noundef 16, ptr noundef %244)
  %246 = icmp ne i64 %245, 16
  br i1 %246, label %247, label %250

247:                                              ; preds = %242
  %248 = load ptr, ptr @stderr, align 8, !tbaa !9
  %249 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %248, ptr noundef @.str.21, i32 noundef 16) #8
  store i32 2, ptr %22, align 4
  br label %251

250:                                              ; preds = %242
  store i32 0, ptr %22, align 4
  br label %251

251:                                              ; preds = %250, %247, %237, %225, %209, %192, %183, %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  %252 = load i32, ptr %22, align 4
  switch i32 %252, label %382 [
    i32 0, label %253
    i32 2, label %322
  ]

253:                                              ; preds = %251
  br label %254

254:                                              ; preds = %253, %164
  %255 = load i32, ptr %18, align 4, !tbaa !5
  %256 = icmp eq i32 %255, 1
  br i1 %256, label %257, label %321

257:                                              ; preds = %254
  %258 = load i64, ptr %26, align 8, !tbaa !11
  %259 = icmp ult i64 %258, 28
  br i1 %259, label %260, label %263

260:                                              ; preds = %257
  %261 = load ptr, ptr @stderr, align 8, !tbaa !9
  %262 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %261, ptr noundef @.str.22) #8
  br label %322

263:                                              ; preds = %257
  %264 = load i64, ptr %27, align 8, !tbaa !11
  %265 = sub i64 %264, 28
  store i64 %265, ptr %27, align 8, !tbaa !11
  %266 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  %267 = load ptr, ptr %7, align 8, !tbaa !9
  %268 = call i64 @fread(ptr noundef %266, i64 noundef 1, i64 noundef 12, ptr noundef %267)
  %269 = icmp ne i64 %268, 12
  br i1 %269, label %270, label %273

270:                                              ; preds = %263
  %271 = load ptr, ptr @stderr, align 8, !tbaa !9
  %272 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %271, ptr noundef @.str.23, i32 noundef 12) #8
  br label %322

273:                                              ; preds = %263
  %274 = load i64, ptr %27, align 8, !tbaa !11
  %275 = call noalias ptr @malloc(i64 noundef %274) #10
  store ptr %275, ptr %13, align 8, !tbaa !9
  %276 = load i64, ptr %27, align 8, !tbaa !11
  %277 = call noalias ptr @malloc(i64 noundef %276) #10
  store ptr %277, ptr %14, align 8, !tbaa !9
  %278 = load ptr, ptr %14, align 8, !tbaa !9
  %279 = load i64, ptr %27, align 8, !tbaa !11
  %280 = load ptr, ptr %7, align 8, !tbaa !9
  %281 = call i64 @fread(ptr noundef %278, i64 noundef 1, i64 noundef %279, ptr noundef %280)
  %282 = load i64, ptr %27, align 8, !tbaa !11
  %283 = icmp ne i64 %281, %282
  br i1 %283, label %284, label %288

284:                                              ; preds = %273
  %285 = load ptr, ptr @stderr, align 8, !tbaa !9
  %286 = load i64, ptr %27, align 8, !tbaa !11
  %287 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %285, ptr noundef @.str.24, i64 noundef %286) #8
  br label %322

288:                                              ; preds = %273
  %289 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  %290 = load ptr, ptr %7, align 8, !tbaa !9
  %291 = call i64 @fread(ptr noundef %289, i64 noundef 1, i64 noundef 16, ptr noundef %290)
  %292 = icmp ne i64 %291, 16
  br i1 %292, label %293, label %296

293:                                              ; preds = %288
  %294 = load ptr, ptr @stderr, align 8, !tbaa !9
  %295 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %294, ptr noundef @.str.25, i32 noundef 16) #8
  br label %322

296:                                              ; preds = %288
  %297 = load i64, ptr %27, align 8, !tbaa !11
  %298 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  %299 = load ptr, ptr %23, align 8, !tbaa !9
  %300 = load i64, ptr %24, align 8, !tbaa !11
  %301 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  %302 = load ptr, ptr %14, align 8, !tbaa !9
  %303 = load ptr, ptr %13, align 8, !tbaa !9
  %304 = call i32 @mbedtls_gcm_auth_decrypt(ptr noundef %17, i64 noundef %297, ptr noundef %298, i64 noundef 12, ptr noundef %299, i64 noundef %300, ptr noundef %301, i64 noundef 16, ptr noundef %302, ptr noundef %303)
  store i32 %304, ptr %6, align 4, !tbaa !5
  %305 = load i32, ptr %6, align 4, !tbaa !5
  %306 = icmp ne i32 %305, 0
  br i1 %306, label %307, label %309

307:                                              ; preds = %296
  %308 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  br label %322

309:                                              ; preds = %296
  %310 = load ptr, ptr %13, align 8, !tbaa !9
  %311 = load i64, ptr %27, align 8, !tbaa !11
  %312 = load ptr, ptr %8, align 8, !tbaa !9
  %313 = call i64 @fwrite(ptr noundef %310, i64 noundef 1, i64 noundef %311, ptr noundef %312)
  %314 = load i64, ptr %27, align 8, !tbaa !11
  %315 = icmp ne i64 %313, %314
  br i1 %315, label %316, label %320

316:                                              ; preds = %309
  %317 = load ptr, ptr @stderr, align 8, !tbaa !9
  %318 = load i64, ptr %27, align 8, !tbaa !11
  %319 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %317, ptr noundef @.str.27, i64 noundef %318) #8
  br label %322

320:                                              ; preds = %309
  br label %321

321:                                              ; preds = %320, %254
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %322

322:                                              ; preds = %321, %316, %307, %293, %284, %270, %260, %251, %160, %152, %145, %132, %129, %88, %76, %67, %55, %37
  %323 = load i32, ptr %6, align 4, !tbaa !5
  %324 = icmp ne i32 %323, 0
  br i1 %324, label %325, label %330

325:                                              ; preds = %322
  %326 = load i32, ptr %6, align 4, !tbaa !5
  %327 = getelementptr inbounds [80 x i8], ptr %12, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %326, ptr noundef %327, i64 noundef 80)
  %328 = getelementptr inbounds [80 x i8], ptr %12, i64 0, i64 0
  %329 = call i32 (ptr, ...) @printf(ptr noundef @.str.28, ptr noundef %328)
  br label %330

330:                                              ; preds = %325, %322
  %331 = load ptr, ptr %7, align 8, !tbaa !9
  %332 = icmp ne ptr %331, null
  br i1 %332, label %333, label %336

333:                                              ; preds = %330
  %334 = load ptr, ptr %7, align 8, !tbaa !9
  %335 = call i32 @fclose(ptr noundef %334)
  br label %336

336:                                              ; preds = %333, %330
  %337 = load ptr, ptr %8, align 8, !tbaa !9
  %338 = icmp ne ptr %337, null
  br i1 %338, label %339, label %342

339:                                              ; preds = %336
  %340 = load ptr, ptr %8, align 8, !tbaa !9
  %341 = call i32 @fclose(ptr noundef %340)
  br label %342

342:                                              ; preds = %339, %336
  %343 = load ptr, ptr %13, align 8, !tbaa !9
  %344 = icmp ne ptr %343, null
  br i1 %344, label %345, label %349

345:                                              ; preds = %342
  %346 = load ptr, ptr %13, align 8, !tbaa !9
  %347 = load i64, ptr %27, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 1 %346, i8 0, i64 %347, i1 false)
  %348 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %348) #8
  br label %349

349:                                              ; preds = %345, %342
  %350 = load ptr, ptr %14, align 8, !tbaa !9
  %351 = icmp ne ptr %350, null
  br i1 %351, label %352, label %356

352:                                              ; preds = %349
  %353 = load ptr, ptr %14, align 8, !tbaa !9
  %354 = load i64, ptr %27, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 1 %353, i8 0, i64 %354, i1 false)
  %355 = load ptr, ptr %14, align 8, !tbaa !9
  call void @free(ptr noundef %355) #8
  br label %356

356:                                              ; preds = %352, %349
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #8
  store i32 0, ptr %31, align 4, !tbaa !5
  br label %357

357:                                              ; preds = %374, %356
  %358 = load i32, ptr %31, align 4, !tbaa !5
  %359 = load i32, ptr %4, align 4, !tbaa !5
  %360 = icmp ult i32 %358, %359
  br i1 %360, label %362, label %361

361:                                              ; preds = %357
  store i32 5, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  br label %377

362:                                              ; preds = %357
  %363 = load ptr, ptr %5, align 8, !tbaa !9
  %364 = load i32, ptr %31, align 4, !tbaa !5
  %365 = zext i32 %364 to i64
  %366 = getelementptr inbounds ptr, ptr %363, i64 %365
  %367 = load ptr, ptr %366, align 8, !tbaa !9
  %368 = load ptr, ptr %5, align 8, !tbaa !9
  %369 = load i32, ptr %31, align 4, !tbaa !5
  %370 = zext i32 %369 to i64
  %371 = getelementptr inbounds ptr, ptr %368, i64 %370
  %372 = load ptr, ptr %371, align 8, !tbaa !9
  %373 = call i64 @strlen(ptr noundef %372) #9
  call void @llvm.memset.p0.i64(ptr align 1 %367, i8 0, i64 %373, i1 false)
  br label %374

374:                                              ; preds = %362
  %375 = load i32, ptr %31, align 4, !tbaa !5
  %376 = add i32 %375, 1
  store i32 %376, ptr %31, align 4, !tbaa !5
  br label %357, !llvm.loop !16

377:                                              ; preds = %361
  %378 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %378, i8 0, i64 32, i1 false)
  %379 = getelementptr inbounds [12 x i8], ptr %10, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %379, i8 0, i64 12, i1 false)
  %380 = getelementptr inbounds [16 x i8], ptr %11, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %380, i8 0, i64 16, i1 false)
  call void @mbedtls_entropy_free(ptr noundef %16)
  call void @mbedtls_ctr_drbg_free(ptr noundef %15)
  call void @mbedtls_gcm_free(ptr noundef %17)
  %381 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %381, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %382

382:                                              ; preds = %377, %251, %129
  call void @llvm.lifetime.end.p0(i64 416, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 344, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %383 = load i32, ptr %3, align 4
  ret i32 %383
}

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @mbedtls_gcm_init(ptr noundef) #3

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #6

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #6

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #5

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

declare void @perror(ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) #5

; Function Attrs: nounwind
declare i32 @fileno(ptr noundef) #5

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

declare i32 @mbedtls_gcm_setkey(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #3

declare void @mbedtls_entropy_init(ptr noundef) #3

declare void @mbedtls_ctr_drbg_init(ptr noundef) #3

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

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

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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #7

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

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

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

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 noundef) #3

declare i32 @fclose(ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

declare void @mbedtls_entropy_free(ptr noundef) #3

declare void @mbedtls_ctr_drbg_free(ptr noundef) #3

declare void @mbedtls_gcm_free(ptr noundef) #3

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }
%struct.mbedtls_entropy_context = type { %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_gcm_context = type { %struct.mbedtls_cipher_context_t, [16 x i64], [16 x i64], i64, i64, [16 x i8], [16 x i8], [16 x i8], i32 }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr }

@.str = external hidden unnamed_addr constant [266 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [32 x i8], align 16
  %4 = alloca [12 x i8], align 1
  %5 = alloca [16 x i8], align 16
  %6 = alloca [80 x i8], align 16
  %7 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %8 = alloca %struct.mbedtls_entropy_context, align 8
  %9 = alloca %struct.mbedtls_gcm_context, align 8
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #11
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #11
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %3, i8 0, i64 32, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %4, i8 0, i64 12, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %6) #11
  call void @llvm.lifetime.start.p0(i64 344, ptr nonnull %7) #11
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %8) #11
  call void @llvm.lifetime.start.p0(i64 416, ptr nonnull %9) #11
  call void @mbedtls_gcm_init(ptr noundef nonnull %9) #11
  %.not = icmp eq i32 %0, 6
  br i1 %.not, label %14, label %11

11:                                               ; preds = %2
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %12, ptr noundef %12)
  br label %.thread264

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = call i32 @atoi(ptr nocapture noundef %16) #12
  %or.cond = icmp ugt i32 %17, 1
  br i1 %or.cond, label %18, label %21

18:                                               ; preds = %14
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.1) #13
  br label %.lr.ph274.preheader

21:                                               ; preds = %14
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 24
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %23, ptr noundef nonnull dereferenceable(1) %25) #12
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %31

28:                                               ; preds = %21
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.2) #13
  br label %.lr.ph274.preheader

31:                                               ; preds = %21
  %32 = call noalias ptr @fopen(ptr noundef %23, ptr noundef nonnull @.str.3)
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %38

34:                                               ; preds = %31
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = load ptr, ptr %22, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.4, ptr noundef %36) #13
  br label %.lr.ph274.preheader

38:                                               ; preds = %31
  %39 = load ptr, ptr %24, align 8, !tbaa !5
  %40 = call noalias ptr @fopen(ptr noundef %39, ptr noundef nonnull @.str.5)
  %41 = icmp eq ptr %40, null
  br i1 %41, label %.thread310, label %46

.thread310:                                       ; preds = %38
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = load ptr, ptr %24, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.6, ptr noundef %43) #13
  %45 = call i32 @fclose(ptr noundef nonnull %32)
  br label %.lr.ph274.preheader

46:                                               ; preds = %38
  %47 = getelementptr inbounds i8, ptr %1, i64 32
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %48, ptr noundef nonnull dereferenceable(4) @.str.7, i64 4)
  %49 = icmp eq i32 %bcmp, 0
  br i1 %49, label %50, label %.thread178.thread230.thread290

50:                                               ; preds = %46
  %51 = getelementptr inbounds i8, ptr %48, i64 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #11
  %52 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %51, ptr noundef nonnull @.str.8, ptr noundef nonnull %10) #11
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %50, %.lr.ph
  %.0120272 = phi ptr [ %58, %.lr.ph ], [ %51, %50 ]
  %.0123271 = phi i64 [ %56, %.lr.ph ], [ 0, %50 ]
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = trunc i32 %54 to i8
  %56 = add nuw nsw i64 %.0123271, 1
  %57 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 %.0123271
  store i8 %55, ptr %57, align 1, !tbaa !11
  %58 = getelementptr inbounds i8, ptr %.0120272, i64 2
  %59 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %58, ptr noundef nonnull @.str.8, ptr noundef nonnull %10) #11
  %60 = icmp sgt i32 %59, 0
  %61 = icmp ult i64 %.0123271, 31
  %62 = and i1 %60, %61
  br i1 %62, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph
  %.not142 = icmp eq i64 %56, 32
  br i1 %.not142, label %65, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %50, %._crit_edge
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.9) #13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #11
  br label %.thread178.thread230

.thread178.thread230.thread290:                   ; preds = %46
  call void @perror(ptr noundef nonnull @.str.10) #14
  br label %.thread178.thread230

65:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #11
  %66 = getelementptr inbounds i8, ptr %1, i64 40
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %67) #12
  %69 = call i32 @fileno(ptr noundef nonnull %32) #11
  %70 = call i64 @lseek(i32 noundef %69, i64 noundef 0, i32 noundef 2) #11
  %71 = icmp slt i64 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  call void @perror(ptr noundef nonnull @.str.11) #14
  br label %.thread178.thread230

73:                                               ; preds = %65
  %74 = call i32 @fseek(ptr noundef nonnull %32, i64 noundef 0, i32 noundef 0)
  %75 = icmp slt i32 %74, 0
  br i1 %75, label %76, label %79

76:                                               ; preds = %73
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.12) #13
  br label %.thread178.thread230

79:                                               ; preds = %73
  %80 = call i32 @mbedtls_gcm_setkey(ptr noundef nonnull %9, i32 noundef 2, ptr noundef nonnull %3, i32 noundef 256) #11
  %.not143 = icmp eq i32 %80, 0
  br i1 %.not143, label %84, label %81

81:                                               ; preds = %79
  %82 = sub nsw i32 0, %80
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %82)
  br label %.thread197

84:                                               ; preds = %79
  %trunc = trunc nuw i32 %17 to i1
  br i1 %trunc, label %124, label %85

85:                                               ; preds = %84
  call void @mbedtls_entropy_init(ptr noundef nonnull %8) #11
  call void @mbedtls_ctr_drbg_init(ptr noundef nonnull %7) #11
  %86 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.14) #12
  %87 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef nonnull %7, ptr noundef nonnull @mbedtls_entropy_func, ptr noundef nonnull %8, ptr noundef nonnull @.str.14, i64 noundef %86) #11
  %.not144 = icmp eq i32 %87, 0
  br i1 %.not144, label %91, label %88

88:                                               ; preds = %85
  %89 = sub nsw i32 0, %87
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %89)
  br label %.thread197

91:                                               ; preds = %85
  %92 = call i32 @mbedtls_ctr_drbg_random(ptr noundef nonnull %7, ptr noundef nonnull %4, i64 noundef 12) #11
  %.not145 = icmp eq i32 %92, 0
  br i1 %.not145, label %96, label %93

93:                                               ; preds = %91
  %94 = sub nsw i32 0, %92
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, i32 noundef %94)
  br label %.thread197

96:                                               ; preds = %91
  %97 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 12, ptr noundef nonnull %40)
  %.not146 = icmp eq i64 %97, 12
  br i1 %.not146, label %101, label %98

98:                                               ; preds = %96
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.17, i32 noundef 12) #13
  br label %.thread178.thread230

101:                                              ; preds = %96
  %102 = add nuw i64 %70, 1
  %103 = call noalias ptr @malloc(i64 noundef %102) #15
  %104 = call noalias ptr @malloc(i64 noundef %102) #15
  %105 = call i64 @fread(ptr noundef %103, i64 noundef 1, i64 noundef %70, ptr noundef nonnull %32)
  %.not147 = icmp eq i64 %105, %70
  br i1 %.not147, label %109, label %106

106:                                              ; preds = %101
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str.18, i64 noundef %70, i64 noundef %105) #13
  br label %.thread178.thread230

109:                                              ; preds = %101
  %110 = call i32 @mbedtls_gcm_crypt_and_tag(ptr noundef nonnull %9, i32 noundef 1, i64 noundef %70, ptr noundef nonnull %4, i64 noundef 12, ptr noundef %67, i64 noundef %68, ptr noundef %103, ptr noundef %104, i64 noundef 16, ptr noundef nonnull %5) #11
  %.not148 = icmp eq i32 %110, 0
  br i1 %.not148, label %114, label %111

111:                                              ; preds = %109
  %112 = sub nsw i32 0, %110
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %112)
  br label %.thread197

114:                                              ; preds = %109
  %115 = call i64 @fwrite(ptr noundef %104, i64 noundef 1, i64 noundef %70, ptr noundef nonnull %40)
  %.not149 = icmp eq i64 %115, %70
  br i1 %.not149, label %119, label %116

116:                                              ; preds = %114
  %117 = load ptr, ptr @stderr, align 8, !tbaa !5
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %117, ptr noundef nonnull @.str.20, i64 noundef %70, i64 noundef %115) #13
  br label %.thread178.thread230

119:                                              ; preds = %114
  %120 = call i64 @fwrite(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 16, ptr noundef nonnull %40)
  %.not150 = icmp eq i64 %120, 16
  br i1 %.not150, label %.thread178.thread230, label %121

121:                                              ; preds = %119
  %122 = load ptr, ptr @stderr, align 8, !tbaa !5
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef nonnull @.str.21, i32 noundef 16) #13
  br label %.thread178.thread230

124:                                              ; preds = %84
  %125 = icmp ult i64 %70, 28
  br i1 %125, label %126, label %129

126:                                              ; preds = %124
  %127 = load ptr, ptr @stderr, align 8, !tbaa !5
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef nonnull @.str.22) #13
  br label %.thread178.thread230

129:                                              ; preds = %124
  %130 = add nsw i64 %70, -28
  %131 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 12, ptr noundef nonnull %32)
  %.not151 = icmp eq i64 %131, 12
  br i1 %.not151, label %135, label %132

132:                                              ; preds = %129
  %133 = load ptr, ptr @stderr, align 8, !tbaa !5
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %133, ptr noundef nonnull @.str.23, i32 noundef 12) #13
  br label %.thread178.thread230

135:                                              ; preds = %129
  %136 = call noalias ptr @malloc(i64 noundef %130) #15
  %137 = call noalias ptr @malloc(i64 noundef %130) #15
  %138 = call i64 @fread(ptr noundef %137, i64 noundef 1, i64 noundef %130, ptr noundef nonnull %32)
  %.not152 = icmp eq i64 %138, %130
  br i1 %.not152, label %142, label %139

139:                                              ; preds = %135
  %140 = load ptr, ptr @stderr, align 8, !tbaa !5
  %141 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef nonnull @.str.24, i64 noundef %130) #13
  br label %.thread178.thread230

142:                                              ; preds = %135
  %143 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 16, ptr noundef nonnull %32)
  %.not153 = icmp eq i64 %143, 16
  br i1 %.not153, label %147, label %144

144:                                              ; preds = %142
  %145 = load ptr, ptr @stderr, align 8, !tbaa !5
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef nonnull @.str.25, i32 noundef 16) #13
  br label %.thread178.thread230

147:                                              ; preds = %142
  %148 = call i32 @mbedtls_gcm_auth_decrypt(ptr noundef nonnull %9, i64 noundef %130, ptr noundef nonnull %4, i64 noundef 12, ptr noundef %67, i64 noundef %68, ptr noundef nonnull %5, i64 noundef 16, ptr noundef %137, ptr noundef %136) #11
  %.not154 = icmp eq i32 %148, 0
  br i1 %.not154, label %151, label %149

149:                                              ; preds = %147
  %150 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  br label %.thread197

151:                                              ; preds = %147
  %152 = call i64 @fwrite(ptr noundef %136, i64 noundef 1, i64 noundef %130, ptr noundef nonnull %40)
  %.not155 = icmp eq i64 %152, %130
  br i1 %.not155, label %.thread178.thread230, label %153

153:                                              ; preds = %151
  %154 = load ptr, ptr @stderr, align 8, !tbaa !5
  %155 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %154, ptr noundef nonnull @.str.27, i64 noundef %130) #13
  br label %.thread178.thread230

.thread197:                                       ; preds = %149, %81, %111, %93, %88
  %.2210 = phi i32 [ %110, %111 ], [ %92, %93 ], [ %87, %88 ], [ %148, %149 ], [ %80, %81 ]
  %.3206 = phi ptr [ %103, %111 ], [ null, %93 ], [ null, %88 ], [ %136, %149 ], [ null, %81 ]
  %.3119205 = phi ptr [ %104, %111 ], [ null, %93 ], [ null, %88 ], [ %137, %149 ], [ null, %81 ]
  call void @mbedtls_strerror(i32 noundef %.2210, ptr noundef nonnull %6, i64 noundef 80) #11
  %156 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28, ptr noundef nonnull %6)
  br label %.thread178.thread230

.thread178.thread230:                             ; preds = %98, %106, %116, %121, %119, %151, %153, %144, %139, %132, %126, %76, %72, %._crit_edge.thread, %.thread197, %.thread178.thread230.thread290
  %.2191238301 = phi i32 [ 0, %.thread178.thread230.thread290 ], [ %.2210, %.thread197 ], [ 0, %151 ], [ 0, %153 ], [ 0, %144 ], [ 0, %139 ], [ 0, %132 ], [ 0, %126 ], [ 0, %76 ], [ 0, %72 ], [ 0, %._crit_edge.thread ], [ 0, %119 ], [ 0, %121 ], [ 0, %116 ], [ 0, %106 ], [ 0, %98 ]
  %.3187242298 = phi ptr [ null, %.thread178.thread230.thread290 ], [ %.3206, %.thread197 ], [ %136, %151 ], [ %136, %153 ], [ %136, %144 ], [ %136, %139 ], [ null, %132 ], [ null, %126 ], [ null, %76 ], [ null, %72 ], [ null, %._crit_edge.thread ], [ %103, %119 ], [ %103, %121 ], [ %103, %116 ], [ %103, %106 ], [ null, %98 ]
  %.3119186243297 = phi ptr [ null, %.thread178.thread230.thread290 ], [ %.3119205, %.thread197 ], [ %137, %151 ], [ %137, %153 ], [ %137, %144 ], [ %137, %139 ], [ null, %132 ], [ null, %126 ], [ null, %76 ], [ null, %72 ], [ null, %._crit_edge.thread ], [ %104, %119 ], [ %104, %121 ], [ %104, %116 ], [ %104, %106 ], [ null, %98 ]
  %157 = call i32 @fclose(ptr noundef nonnull %32)
  %158 = call i32 @fclose(ptr noundef nonnull %40)
  %.not159 = icmp eq ptr %.3187242298, null
  br i1 %.not159, label %160, label %159

159:                                              ; preds = %.thread178.thread230
  call void @free(ptr noundef nonnull %.3187242298) #11
  br label %160

160:                                              ; preds = %159, %.thread178.thread230
  %.not160 = icmp eq ptr %.3119186243297, null
  br i1 %.not160, label %.thread264, label %161

161:                                              ; preds = %160
  call void @free(ptr noundef nonnull %.3119186243297) #11
  br label %.thread264

.thread264:                                       ; preds = %11, %161, %160
  %.2191224254261269 = phi i32 [ %.2191238301, %161 ], [ %.2191238301, %160 ], [ 0, %11 ]
  %.not276 = icmp eq i32 %0, 0
  br i1 %.not276, label %._crit_edge275, label %.lr.ph274.preheader

.lr.ph274.preheader:                              ; preds = %18, %28, %34, %.thread310, %.thread264
  %.2191224254261269317 = phi i32 [ %.2191224254261269, %.thread264 ], [ 0, %.thread310 ], [ 0, %34 ], [ 0, %28 ], [ 0, %18 ]
  %wide.trip.count = zext i32 %0 to i64
  br label %.lr.ph274

._crit_edge275:                                   ; preds = %.lr.ph274, %.thread264
  %.2191224254261269318 = phi i32 [ %.2191224254261269, %.thread264 ], [ %.2191224254261269317, %.lr.ph274 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %3, i8 0, i64 32, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %4, i8 0, i64 12, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @mbedtls_entropy_free(ptr noundef nonnull %8) #11
  call void @mbedtls_ctr_drbg_free(ptr noundef nonnull %7) #11
  call void @mbedtls_gcm_free(ptr noundef nonnull %9) #11
  call void @llvm.lifetime.end.p0(i64 416, ptr nonnull %9) #11
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %8) #11
  call void @llvm.lifetime.end.p0(i64 344, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #11
  ret i32 %.2191224254261269318

.lr.ph274:                                        ; preds = %.lr.ph274.preheader, %.lr.ph274
  %indvars.iv = phi i64 [ 0, %.lr.ph274.preheader ], [ %indvars.iv.next, %.lr.ph274 ]
  %162 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %163 = load ptr, ptr %162, align 8, !tbaa !5
  %164 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %163) #12
  call void @llvm.memset.p0.i64(ptr align 1 %163, i8 0, i64 %164, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge275, label %.lr.ph274, !llvm.loop !14
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @mbedtls_gcm_init(ptr noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) 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: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #7

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

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @mbedtls_gcm_setkey(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @mbedtls_entropy_init(ptr noundef) local_unnamed_addr #3

declare void @mbedtls_ctr_drbg_init(ptr noundef) local_unnamed_addr #3

declare i32 @mbedtls_ctr_drbg_seed(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

declare i32 @mbedtls_ctr_drbg_random(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #8

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4

declare i32 @mbedtls_gcm_crypt_and_tag(ptr noundef, i32 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @mbedtls_gcm_auth_decrypt(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #9

declare void @mbedtls_entropy_free(ptr noundef) local_unnamed_addr #3

declare void @mbedtls_ctr_drbg_free(ptr noundef) local_unnamed_addr #3

declare void @mbedtls_gcm_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #10

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #5 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #7 = { 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 #8 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #10 = { nofree nounwind willreturn memory(argmem: read) }
attributes #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { cold nounwind }
attributes #14 = { cold }
attributes #15 = { nounwind allocsize(0) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass