; LLVM IR from rweather/lightweight-crypto :: src/combined (tinyjambu-masked)

; 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.mask_x4_uint32_t = type { i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @tiny_jambu_128_masked_aead_decrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, ptr noundef %8) #0 {
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca [4 x %struct.mask_x4_uint32_t], align 16
  %21 = alloca [4 x %struct.mask_x4_uint32_t], align 16
  %22 = alloca [8 x i8], align 1
  %23 = alloca i32, align 4
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store ptr %3, ptr %14, align 8, !tbaa !5
  store i64 %4, ptr %15, align 8, !tbaa !9
  store ptr %5, ptr %16, align 8, !tbaa !5
  store i64 %6, ptr %17, align 8, !tbaa !9
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = load i64, ptr %15, align 8, !tbaa !9
  %26 = icmp ult i64 %25, 8
  br i1 %26, label %27, label %28

27:                                               ; preds = %9
  store i32 -1, ptr %10, align 4
  store i32 1, ptr %23, align 4
  br label %261

28:                                               ; preds = %9
  %29 = load i64, ptr %15, align 8, !tbaa !9
  %30 = sub i64 %29, 8
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %30, ptr %31, align 8, !tbaa !9
  call void @aead_random_init()
  br label %32

32:                                               ; preds = %28
  %33 = call i32 @aead_random_generate_32()
  %34 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %35 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %34, i32 0, i32 1
  store i32 %33, ptr %35, align 4, !tbaa !11
  %36 = call i32 @aead_random_generate_32()
  %37 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %38 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %37, i32 0, i32 2
  store i32 %36, ptr %38, align 8, !tbaa !14
  %39 = call i32 @aead_random_generate_32()
  %40 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %41 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %40, i32 0, i32 3
  store i32 %39, ptr %41, align 4, !tbaa !15
  %42 = load ptr, ptr %19, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i64 3
  %44 = load i8, ptr %43, align 1, !tbaa !16
  %45 = zext i8 %44 to i32
  %46 = shl i32 %45, 24
  %47 = load ptr, ptr %19, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 2
  %49 = load i8, ptr %48, align 1, !tbaa !16
  %50 = zext i8 %49 to i32
  %51 = shl i32 %50, 16
  %52 = or i32 %46, %51
  %53 = load ptr, ptr %19, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 1
  %55 = load i8, ptr %54, align 1, !tbaa !16
  %56 = zext i8 %55 to i32
  %57 = shl i32 %56, 8
  %58 = or i32 %52, %57
  %59 = load ptr, ptr %19, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 0
  %61 = load i8, ptr %60, align 1, !tbaa !16
  %62 = zext i8 %61 to i32
  %63 = or i32 %58, %62
  %64 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %65 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !11
  %67 = xor i32 %63, %66
  %68 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %69 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 8, !tbaa !14
  %71 = xor i32 %67, %70
  %72 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %73 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %72, i32 0, i32 3
  %74 = load i32, ptr %73, align 4, !tbaa !15
  %75 = xor i32 %71, %74
  %76 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %77 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %76, i32 0, i32 0
  store i32 %75, ptr %77, align 16, !tbaa !17
  br label %78

78:                                               ; preds = %32
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = call i32 @aead_random_generate_32()
  %82 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %83 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %82, i32 0, i32 1
  store i32 %81, ptr %83, align 4, !tbaa !11
  %84 = call i32 @aead_random_generate_32()
  %85 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %86 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %85, i32 0, i32 2
  store i32 %84, ptr %86, align 8, !tbaa !14
  %87 = call i32 @aead_random_generate_32()
  %88 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %89 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %88, i32 0, i32 3
  store i32 %87, ptr %89, align 4, !tbaa !15
  %90 = load ptr, ptr %19, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 4
  %92 = getelementptr inbounds i8, ptr %91, i64 3
  %93 = load i8, ptr %92, align 1, !tbaa !16
  %94 = zext i8 %93 to i32
  %95 = shl i32 %94, 24
  %96 = load ptr, ptr %19, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 4
  %98 = getelementptr inbounds i8, ptr %97, i64 2
  %99 = load i8, ptr %98, align 1, !tbaa !16
  %100 = zext i8 %99 to i32
  %101 = shl i32 %100, 16
  %102 = or i32 %95, %101
  %103 = load ptr, ptr %19, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i64 4
  %105 = getelementptr inbounds i8, ptr %104, i64 1
  %106 = load i8, ptr %105, align 1, !tbaa !16
  %107 = zext i8 %106 to i32
  %108 = shl i32 %107, 8
  %109 = or i32 %102, %108
  %110 = load ptr, ptr %19, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i64 4
  %112 = getelementptr inbounds i8, ptr %111, i64 0
  %113 = load i8, ptr %112, align 1, !tbaa !16
  %114 = zext i8 %113 to i32
  %115 = or i32 %109, %114
  %116 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %117 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %116, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !11
  %119 = xor i32 %115, %118
  %120 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %121 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %120, i32 0, i32 2
  %122 = load i32, ptr %121, align 8, !tbaa !14
  %123 = xor i32 %119, %122
  %124 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %125 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %124, i32 0, i32 3
  %126 = load i32, ptr %125, align 4, !tbaa !15
  %127 = xor i32 %123, %126
  %128 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 1
  %129 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %128, i32 0, i32 0
  store i32 %127, ptr %129, align 16, !tbaa !17
  br label %130

130:                                              ; preds = %80
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  %133 = call i32 @aead_random_generate_32()
  %134 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %135 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %134, i32 0, i32 1
  store i32 %133, ptr %135, align 4, !tbaa !11
  %136 = call i32 @aead_random_generate_32()
  %137 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %138 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %137, i32 0, i32 2
  store i32 %136, ptr %138, align 8, !tbaa !14
  %139 = call i32 @aead_random_generate_32()
  %140 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %141 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %140, i32 0, i32 3
  store i32 %139, ptr %141, align 4, !tbaa !15
  %142 = load ptr, ptr %19, align 8, !tbaa !5
  %143 = getelementptr inbounds i8, ptr %142, i64 8
  %144 = getelementptr inbounds i8, ptr %143, i64 3
  %145 = load i8, ptr %144, align 1, !tbaa !16
  %146 = zext i8 %145 to i32
  %147 = shl i32 %146, 24
  %148 = load ptr, ptr %19, align 8, !tbaa !5
  %149 = getelementptr inbounds i8, ptr %148, i64 8
  %150 = getelementptr inbounds i8, ptr %149, i64 2
  %151 = load i8, ptr %150, align 1, !tbaa !16
  %152 = zext i8 %151 to i32
  %153 = shl i32 %152, 16
  %154 = or i32 %147, %153
  %155 = load ptr, ptr %19, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 8
  %157 = getelementptr inbounds i8, ptr %156, i64 1
  %158 = load i8, ptr %157, align 1, !tbaa !16
  %159 = zext i8 %158 to i32
  %160 = shl i32 %159, 8
  %161 = or i32 %154, %160
  %162 = load ptr, ptr %19, align 8, !tbaa !5
  %163 = getelementptr inbounds i8, ptr %162, i64 8
  %164 = getelementptr inbounds i8, ptr %163, i64 0
  %165 = load i8, ptr %164, align 1, !tbaa !16
  %166 = zext i8 %165 to i32
  %167 = or i32 %161, %166
  %168 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %169 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %168, i32 0, i32 1
  %170 = load i32, ptr %169, align 4, !tbaa !11
  %171 = xor i32 %167, %170
  %172 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %173 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 8, !tbaa !14
  %175 = xor i32 %171, %174
  %176 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %177 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %176, i32 0, i32 3
  %178 = load i32, ptr %177, align 4, !tbaa !15
  %179 = xor i32 %175, %178
  %180 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 2
  %181 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %180, i32 0, i32 0
  store i32 %179, ptr %181, align 16, !tbaa !17
  br label %182

182:                                              ; preds = %132
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  %185 = call i32 @aead_random_generate_32()
  %186 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %187 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %186, i32 0, i32 1
  store i32 %185, ptr %187, align 4, !tbaa !11
  %188 = call i32 @aead_random_generate_32()
  %189 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %190 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %189, i32 0, i32 2
  store i32 %188, ptr %190, align 8, !tbaa !14
  %191 = call i32 @aead_random_generate_32()
  %192 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %193 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %192, i32 0, i32 3
  store i32 %191, ptr %193, align 4, !tbaa !15
  %194 = load ptr, ptr %19, align 8, !tbaa !5
  %195 = getelementptr inbounds i8, ptr %194, i64 12
  %196 = getelementptr inbounds i8, ptr %195, i64 3
  %197 = load i8, ptr %196, align 1, !tbaa !16
  %198 = zext i8 %197 to i32
  %199 = shl i32 %198, 24
  %200 = load ptr, ptr %19, align 8, !tbaa !5
  %201 = getelementptr inbounds i8, ptr %200, i64 12
  %202 = getelementptr inbounds i8, ptr %201, i64 2
  %203 = load i8, ptr %202, align 1, !tbaa !16
  %204 = zext i8 %203 to i32
  %205 = shl i32 %204, 16
  %206 = or i32 %199, %205
  %207 = load ptr, ptr %19, align 8, !tbaa !5
  %208 = getelementptr inbounds i8, ptr %207, i64 12
  %209 = getelementptr inbounds i8, ptr %208, i64 1
  %210 = load i8, ptr %209, align 1, !tbaa !16
  %211 = zext i8 %210 to i32
  %212 = shl i32 %211, 8
  %213 = or i32 %206, %212
  %214 = load ptr, ptr %19, align 8, !tbaa !5
  %215 = getelementptr inbounds i8, ptr %214, i64 12
  %216 = getelementptr inbounds i8, ptr %215, i64 0
  %217 = load i8, ptr %216, align 1, !tbaa !16
  %218 = zext i8 %217 to i32
  %219 = or i32 %213, %218
  %220 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %221 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %220, i32 0, i32 1
  %222 = load i32, ptr %221, align 4, !tbaa !11
  %223 = xor i32 %219, %222
  %224 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %225 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %224, i32 0, i32 2
  %226 = load i32, ptr %225, align 8, !tbaa !14
  %227 = xor i32 %223, %226
  %228 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %229 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %228, i32 0, i32 3
  %230 = load i32, ptr %229, align 4, !tbaa !15
  %231 = xor i32 %227, %230
  %232 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 3
  %233 = getelementptr inbounds %struct.mask_x4_uint32_t, ptr %232, i32 0, i32 0
  store i32 %231, ptr %233, align 16, !tbaa !17
  br label %234

234:                                              ; preds = %184
  br label %235

235:                                              ; preds = %234
  %236 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %20, i64 0, i64 0
  %237 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %238 = load ptr, ptr %18, align 8, !tbaa !5
  call void @tiny_jambu_setup_masked(ptr noundef %236, ptr noundef %237, i32 noundef 4, i32 noundef 8, ptr noundef %238)
  %239 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %20, i64 0, i64 0
  %240 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %241 = load ptr, ptr %16, align 8, !tbaa !5
  %242 = load i64, ptr %17, align 8, !tbaa !9
  call void @tiny_jambu_process_ad_masked(ptr noundef %239, ptr noundef %240, i32 noundef 4, ptr noundef %241, i64 noundef %242)
  %243 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %20, i64 0, i64 0
  %244 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %245 = load ptr, ptr %11, align 8, !tbaa !5
  %246 = load ptr, ptr %14, align 8, !tbaa !5
  %247 = load ptr, ptr %12, align 8, !tbaa !5
  %248 = load i64, ptr %247, align 8, !tbaa !9
  call void @tiny_jambu_decrypt_masked(ptr noundef %243, ptr noundef %244, i32 noundef 4, i32 noundef 8, ptr noundef %245, ptr noundef %246, i64 noundef %248)
  %249 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %20, i64 0, i64 0
  %250 = getelementptr inbounds [4 x %struct.mask_x4_uint32_t], ptr %21, i64 0, i64 0
  %251 = getelementptr inbounds [8 x i8], ptr %22, i64 0, i64 0
  call void @tiny_jambu_generate_tag_masked(ptr noundef %249, ptr noundef %250, i32 noundef 4, i32 noundef 8, ptr noundef %251)
  %252 = load ptr, ptr %11, align 8, !tbaa !5
  %253 = load ptr, ptr %12, align 8, !tbaa !5
  %254 = load i64, ptr %253, align 8, !tbaa !9
  %255 = getelementptr inbounds [8 x i8], ptr %22, i64 0, i64 0
  %256 = load ptr, ptr %14, align 8, !tbaa !5
  %257 = load ptr, ptr %12, align 8, !tbaa !5
  %258 = load i64, ptr %257, align 8, !tbaa !9
  %259 = getelementptr inbounds i8, ptr %256, i64 %258
  %260 = call i32 @aead_check_tag(ptr noundef %252, i64 noundef %254, ptr noundef %255, ptr noundef %259, i32 noundef 8)
  store i32 %260, ptr %10, align 4
  store i32 1, ptr %23, align 4
  br label %261

261:                                              ; preds = %235, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %20) #3
  %262 = load i32, ptr %10, align 4
  ret i32 %262
}

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

declare void @aead_random_init() #2

declare i32 @aead_random_generate_32() #2

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_setup_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_process_ad_masked(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_generate_tag_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_decrypt_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) #0

declare i32 @aead_check_tag(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!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 = !{!"long long", !7, i64 0}
!11 = !{!12, !13, i64 4}
!12 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 12}
!16 = !{!7, !7, i64 0}
!17 = !{!12, !13, i64 0}


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

%struct.mask_x4_uint32_t = type { i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @tiny_jambu_128_masked_aead_decrypt(ptr noundef %0, ptr nocapture noundef %1, ptr nocapture noundef readnone %2, ptr noundef %3, i64 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, ptr nocapture noundef readonly %8) local_unnamed_addr #0 {
  %10 = alloca [4 x %struct.mask_x4_uint32_t], align 16
  %11 = alloca [4 x %struct.mask_x4_uint32_t], align 16
  %12 = alloca [8 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #3
  %13 = icmp ult i64 %4, 8
  br i1 %13, label %66, label %14

14:                                               ; preds = %9
  %15 = add i64 %4, -8
  store i64 %15, ptr %1, align 8, !tbaa !5
  tail call void @aead_random_init() #3
  %16 = tail call i32 @aead_random_generate_32() #3
  %17 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 %16, ptr %17, align 4, !tbaa !9
  %18 = tail call i32 @aead_random_generate_32() #3
  %19 = getelementptr inbounds i8, ptr %11, i64 8
  store i32 %18, ptr %19, align 8, !tbaa !12
  %20 = tail call i32 @aead_random_generate_32() #3
  %21 = getelementptr inbounds i8, ptr %11, i64 12
  store i32 %20, ptr %21, align 4, !tbaa !13
  %22 = load i32, ptr %8, align 1
  %23 = xor i32 %22, %16
  %24 = xor i32 %23, %20
  %25 = xor i32 %24, %18
  store i32 %25, ptr %11, align 16, !tbaa !14
  %26 = tail call i32 @aead_random_generate_32() #3
  %27 = getelementptr inbounds i8, ptr %11, i64 16
  %28 = getelementptr inbounds i8, ptr %11, i64 20
  store i32 %26, ptr %28, align 4, !tbaa !9
  %29 = tail call i32 @aead_random_generate_32() #3
  %30 = getelementptr inbounds i8, ptr %11, i64 24
  store i32 %29, ptr %30, align 8, !tbaa !12
  %31 = tail call i32 @aead_random_generate_32() #3
  %32 = getelementptr inbounds i8, ptr %11, i64 28
  store i32 %31, ptr %32, align 4, !tbaa !13
  %33 = getelementptr inbounds i8, ptr %8, i64 4
  %34 = load i32, ptr %33, align 1
  %35 = xor i32 %34, %26
  %36 = xor i32 %35, %29
  %37 = xor i32 %36, %31
  store i32 %37, ptr %27, align 16, !tbaa !14
  %38 = tail call i32 @aead_random_generate_32() #3
  %39 = getelementptr inbounds i8, ptr %11, i64 32
  %40 = getelementptr inbounds i8, ptr %11, i64 36
  store i32 %38, ptr %40, align 4, !tbaa !9
  %41 = tail call i32 @aead_random_generate_32() #3
  %42 = getelementptr inbounds i8, ptr %11, i64 40
  store i32 %41, ptr %42, align 8, !tbaa !12
  %43 = tail call i32 @aead_random_generate_32() #3
  %44 = getelementptr inbounds i8, ptr %11, i64 44
  store i32 %43, ptr %44, align 4, !tbaa !13
  %45 = getelementptr inbounds i8, ptr %8, i64 8
  %46 = load i32, ptr %45, align 1
  %47 = xor i32 %46, %38
  %48 = xor i32 %47, %41
  %49 = xor i32 %48, %43
  store i32 %49, ptr %39, align 16, !tbaa !14
  %50 = tail call i32 @aead_random_generate_32() #3
  %51 = getelementptr inbounds i8, ptr %11, i64 48
  %52 = getelementptr inbounds i8, ptr %11, i64 52
  store i32 %50, ptr %52, align 4, !tbaa !9
  %53 = tail call i32 @aead_random_generate_32() #3
  %54 = getelementptr inbounds i8, ptr %11, i64 56
  store i32 %53, ptr %54, align 8, !tbaa !12
  %55 = tail call i32 @aead_random_generate_32() #3
  %56 = getelementptr inbounds i8, ptr %11, i64 60
  store i32 %55, ptr %56, align 4, !tbaa !13
  %57 = getelementptr inbounds i8, ptr %8, i64 12
  %58 = load i32, ptr %57, align 1
  %59 = xor i32 %58, %50
  %60 = xor i32 %59, %53
  %61 = xor i32 %60, %55
  store i32 %61, ptr %51, align 16, !tbaa !14
  call void @tiny_jambu_setup_masked(ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 4, i32 noundef 8, ptr noundef %7)
  call void @tiny_jambu_process_ad_masked(ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 4, ptr noundef %5, i64 noundef %6)
  %62 = load i64, ptr %1, align 8, !tbaa !5
  call void @tiny_jambu_decrypt_masked(ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 4, i32 noundef 8, ptr noundef %0, ptr noundef %3, i64 noundef %62)
  call void @tiny_jambu_generate_tag_masked(ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 4, i32 noundef 8, ptr noundef nonnull %12)
  %63 = load i64, ptr %1, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %3, i64 %63
  %65 = call i32 @aead_check_tag(ptr noundef %0, i64 noundef %63, ptr noundef nonnull %12, ptr noundef %64, i32 noundef 8) #3
  br label %66

66:                                               ; preds = %9, %14
  %.0 = phi i32 [ %65, %14 ], [ -1, %9 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %10) #3
  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

declare void @aead_random_init() local_unnamed_addr #2

declare i32 @aead_random_generate_32() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_setup_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_process_ad_masked(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_generate_tag_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @tiny_jambu_decrypt_masked(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare i32 @aead_check_tag(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 12}
!14 = !{!10, !11, i64 0}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass