; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library (Tpm12NvDefineSpace)

; 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.TPM_CMD_NV_DEFINE_SPACE = type { %struct.tdTPM_RQU_COMMAND_HDR, %struct.TPM12_NV_DATA_PUBLIC, [20 x i8] }
%struct.tdTPM_RQU_COMMAND_HDR = type <{ i16, i32, i32 }>
%struct.TPM12_NV_DATA_PUBLIC = type <{ i16, i32, %struct.TPM12_PCR_INFO_SHORT, %struct.TPM12_PCR_INFO_SHORT, %struct.tdTPM_NV_ATTRIBUTES, i8, i8, i8, i32 }>
%struct.TPM12_PCR_INFO_SHORT = type { %struct.TPM12_PCR_SELECTION, i8, %struct.tdTPM_DIGEST }
%struct.TPM12_PCR_SELECTION = type <{ i16, [3 x i8] }>
%struct.tdTPM_DIGEST = type { [20 x i8] }
%struct.tdTPM_NV_ATTRIBUTES = type <{ i16, i32 }>
%struct.TPM_RSP_NV_DEFINE_SPACE = type { %struct.tdTPM_RSP_COMMAND_HDR }
%struct.tdTPM_RSP_COMMAND_HDR = type <{ i16, i32, i32 }>

@.str = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @Tpm12NvDefineSpace(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.TPM_CMD_NV_DEFINE_SPACE, align 1
  %10 = alloca %struct.TPM_RSP_NV_DEFINE_SPACE, align 1
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 101, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 10, ptr %7, align 4, !tbaa !9
  store i32 101, ptr %8, align 4, !tbaa !9
  %13 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 193)
  %14 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 0
  %15 = getelementptr inbounds %struct.tdTPM_RQU_COMMAND_HDR, ptr %14, i32 0, i32 0
  store i16 %13, ptr %15, align 1, !tbaa !11
  %16 = call i32 @SwapBytes32(i32 noundef 101)
  %17 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 0
  %18 = getelementptr inbounds %struct.tdTPM_RQU_COMMAND_HDR, ptr %17, i32 0, i32 1
  store i32 %16, ptr %18, align 1, !tbaa !20
  %19 = call i32 @SwapBytes32(i32 noundef 204)
  %20 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 0
  %21 = getelementptr inbounds %struct.tdTPM_RQU_COMMAND_HDR, ptr %20, i32 0, i32 2
  store i32 %19, ptr %21, align 1, !tbaa !21
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %22, i32 0, i32 0
  %24 = load i16, ptr %23, align 1, !tbaa !22
  %25 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %24)
  %26 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %27 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %26, i32 0, i32 0
  store i16 %25, ptr %27, align 1, !tbaa !23
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 1, !tbaa !24
  %31 = call i32 @SwapBytes32(i32 noundef %30)
  %32 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %33 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %32, i32 0, i32 1
  store i32 %31, ptr %33, align 1, !tbaa !25
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %34, i32 0, i32 2
  %36 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %36, i32 0, i32 0
  %38 = load i16, ptr %37, align 1, !tbaa !26
  %39 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %38)
  %40 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %41 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %40, i32 0, i32 2
  %42 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %42, i32 0, i32 0
  store i16 %39, ptr %43, align 1, !tbaa !27
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds [3 x i8], ptr %47, i64 0, i64 0
  %49 = load i8, ptr %48, align 1, !tbaa !28
  %50 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %51 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds [3 x i8], ptr %53, i64 0, i64 0
  store i8 %49, ptr %54, align 1, !tbaa !28
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %55, i32 0, i32 2
  %57 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds [3 x i8], ptr %58, i64 0, i64 1
  %60 = load i8, ptr %59, align 1, !tbaa !28
  %61 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %62 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %61, i32 0, i32 2
  %63 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %63, i32 0, i32 1
  %65 = getelementptr inbounds [3 x i8], ptr %64, i64 0, i64 1
  store i8 %60, ptr %65, align 1, !tbaa !28
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %66, i32 0, i32 2
  %68 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %68, i32 0, i32 1
  %70 = getelementptr inbounds [3 x i8], ptr %69, i64 0, i64 2
  %71 = load i8, ptr %70, align 1, !tbaa !28
  %72 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %73 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %74, i32 0, i32 1
  %76 = getelementptr inbounds [3 x i8], ptr %75, i64 0, i64 2
  store i8 %71, ptr %76, align 1, !tbaa !28
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %77, i32 0, i32 2
  %79 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %78, i32 0, i32 1
  %80 = load i8, ptr %79, align 1, !tbaa !29
  %81 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %82 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %81, i32 0, i32 2
  %83 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %82, i32 0, i32 1
  store i8 %80, ptr %83, align 1, !tbaa !30
  %84 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %85 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %84, i32 0, i32 2
  %86 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %87, i32 0, i32 2
  %89 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %88, i32 0, i32 2
  %90 = call ptr @CopyMem(ptr noundef %86, ptr noundef %89, i64 noundef 20)
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %91, i32 0, i32 3
  %93 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %92, i32 0, i32 0
  %94 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %93, i32 0, i32 0
  %95 = load i16, ptr %94, align 1, !tbaa !31
  %96 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %95)
  %97 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %98 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %97, i32 0, i32 3
  %99 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %99, i32 0, i32 0
  store i16 %96, ptr %100, align 1, !tbaa !32
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %101, i32 0, i32 3
  %103 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %102, i32 0, i32 0
  %104 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %103, i32 0, i32 1
  %105 = getelementptr inbounds [3 x i8], ptr %104, i64 0, i64 0
  %106 = load i8, ptr %105, align 1, !tbaa !28
  %107 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %108 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %107, i32 0, i32 3
  %109 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %109, i32 0, i32 1
  %111 = getelementptr inbounds [3 x i8], ptr %110, i64 0, i64 0
  store i8 %106, ptr %111, align 1, !tbaa !28
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %112, i32 0, i32 3
  %114 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %114, i32 0, i32 1
  %116 = getelementptr inbounds [3 x i8], ptr %115, i64 0, i64 1
  %117 = load i8, ptr %116, align 1, !tbaa !28
  %118 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %119 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %118, i32 0, i32 3
  %120 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %120, i32 0, i32 1
  %122 = getelementptr inbounds [3 x i8], ptr %121, i64 0, i64 1
  store i8 %117, ptr %122, align 1, !tbaa !28
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %123, i32 0, i32 3
  %125 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %124, i32 0, i32 0
  %126 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds [3 x i8], ptr %126, i64 0, i64 2
  %128 = load i8, ptr %127, align 1, !tbaa !28
  %129 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %130 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %129, i32 0, i32 3
  %131 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %130, i32 0, i32 0
  %132 = getelementptr inbounds %struct.TPM12_PCR_SELECTION, ptr %131, i32 0, i32 1
  %133 = getelementptr inbounds [3 x i8], ptr %132, i64 0, i64 2
  store i8 %128, ptr %133, align 1, !tbaa !28
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %134, i32 0, i32 3
  %136 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %135, i32 0, i32 1
  %137 = load i8, ptr %136, align 1, !tbaa !33
  %138 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %139 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %138, i32 0, i32 3
  %140 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %139, i32 0, i32 1
  store i8 %137, ptr %140, align 1, !tbaa !34
  %141 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %142 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %141, i32 0, i32 3
  %143 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %142, i32 0, i32 2
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %144, i32 0, i32 3
  %146 = getelementptr inbounds %struct.TPM12_PCR_INFO_SHORT, ptr %145, i32 0, i32 2
  %147 = call ptr @CopyMem(ptr noundef %143, ptr noundef %146, i64 noundef 20)
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %148, i32 0, i32 4
  %150 = getelementptr inbounds %struct.tdTPM_NV_ATTRIBUTES, ptr %149, i32 0, i32 0
  %151 = load i16, ptr %150, align 1, !tbaa !35
  %152 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %151)
  %153 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %154 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %153, i32 0, i32 4
  %155 = getelementptr inbounds %struct.tdTPM_NV_ATTRIBUTES, ptr %154, i32 0, i32 0
  store i16 %152, ptr %155, align 1, !tbaa !36
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %156, i32 0, i32 4
  %158 = getelementptr inbounds %struct.tdTPM_NV_ATTRIBUTES, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 1, !tbaa !37
  %160 = call i32 @SwapBytes32(i32 noundef %159)
  %161 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %162 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %161, i32 0, i32 4
  %163 = getelementptr inbounds %struct.tdTPM_NV_ATTRIBUTES, ptr %162, i32 0, i32 1
  store i32 %160, ptr %163, align 1, !tbaa !38
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %164, i32 0, i32 5
  %166 = load i8, ptr %165, align 1, !tbaa !39
  %167 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %168 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %167, i32 0, i32 5
  store i8 %166, ptr %168, align 1, !tbaa !40
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %169, i32 0, i32 6
  %171 = load i8, ptr %170, align 1, !tbaa !41
  %172 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %173 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %172, i32 0, i32 6
  store i8 %171, ptr %173, align 1, !tbaa !42
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %174, i32 0, i32 7
  %176 = load i8, ptr %175, align 1, !tbaa !43
  %177 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %178 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %177, i32 0, i32 7
  store i8 %176, ptr %178, align 1, !tbaa !44
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %179, i32 0, i32 8
  %181 = load i32, ptr %180, align 1, !tbaa !45
  %182 = call i32 @SwapBytes32(i32 noundef %181)
  %183 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 1
  %184 = getelementptr inbounds %struct.TPM12_NV_DATA_PUBLIC, ptr %183, i32 0, i32 8
  store i32 %182, ptr %184, align 1, !tbaa !46
  %185 = getelementptr inbounds %struct.TPM_CMD_NV_DEFINE_SPACE, ptr %9, i32 0, i32 2
  %186 = load ptr, ptr %5, align 8, !tbaa !5
  %187 = call ptr @CopyMem(ptr noundef %185, ptr noundef %186, i64 noundef 20)
  %188 = load i32, ptr %8, align 4, !tbaa !9
  %189 = call i64 @Tpm12SubmitCommand(i32 noundef %188, ptr noundef %9, ptr noundef %7, ptr noundef %10)
  store i64 %189, ptr %6, align 8, !tbaa !47
  %190 = load i64, ptr %6, align 8, !tbaa !47
  %191 = icmp slt i64 %190, 0
  br i1 %191, label %192, label %194

192:                                              ; preds = %2
  %193 = load i64, ptr %6, align 8, !tbaa !47
  store i64 %193, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %217

194:                                              ; preds = %2
  %195 = getelementptr inbounds %struct.TPM_RSP_NV_DEFINE_SPACE, ptr %10, i32 0, i32 0
  %196 = getelementptr inbounds %struct.tdTPM_RSP_COMMAND_HDR, ptr %195, i32 0, i32 2
  %197 = load i32, ptr %196, align 1, !tbaa !49
  %198 = call i32 @SwapBytes32(i32 noundef %197)
  store i32 %198, ptr %11, align 4, !tbaa !9
  br label %199

199:                                              ; preds = %194
  %200 = call zeroext i8 @DebugPrintEnabled()
  %201 = icmp ne i8 %200, 0
  br i1 %201, label %202, label %211

202:                                              ; preds = %199
  br label %203

203:                                              ; preds = %202
  %204 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %205 = icmp ne i8 %204, 0
  br i1 %205, label %206, label %208

206:                                              ; preds = %203
  %207 = load i32, ptr %11, align 4, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str, i32 noundef %207)
  br label %208

208:                                              ; preds = %206, %203
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210, %199
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %11, align 4, !tbaa !9
  switch i32 %214, label %215 [
    i32 0, label %216
  ]

215:                                              ; preds = %213
  store i64 -9223372036854775801, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %217

216:                                              ; preds = %213
  store i64 0, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %217

217:                                              ; preds = %216, %215, %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 10, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 101, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %218 = load i64, ptr %3, align 8
  ret i64 %218
}

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

declare zeroext i16 @SwapBytes16(i16 noundef zeroext) #2

declare i32 @SwapBytes32(i32 noundef) #2

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

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

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #2

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !14, i64 0}
!12 = !{!"", !13, i64 0, !15, i64 10, !7, i64 81}
!13 = !{!"tdTPM_RQU_COMMAND_HDR", !14, i64 0, !10, i64 2, !10, i64 6}
!14 = !{!"short", !7, i64 0}
!15 = !{!"", !14, i64 0, !10, i64 2, !16, i64 6, !16, i64 32, !19, i64 58, !7, i64 64, !7, i64 65, !7, i64 66, !10, i64 67}
!16 = !{!"", !17, i64 0, !7, i64 5, !18, i64 6}
!17 = !{!"", !14, i64 0, !7, i64 2}
!18 = !{!"tdTPM_DIGEST", !7, i64 0}
!19 = !{!"tdTPM_NV_ATTRIBUTES", !14, i64 0, !10, i64 2}
!20 = !{!12, !10, i64 2}
!21 = !{!12, !10, i64 6}
!22 = !{!15, !14, i64 0}
!23 = !{!12, !14, i64 10}
!24 = !{!15, !10, i64 2}
!25 = !{!12, !10, i64 12}
!26 = !{!15, !14, i64 6}
!27 = !{!12, !14, i64 16}
!28 = !{!7, !7, i64 0}
!29 = !{!15, !7, i64 11}
!30 = !{!12, !7, i64 21}
!31 = !{!15, !14, i64 32}
!32 = !{!12, !14, i64 42}
!33 = !{!15, !7, i64 37}
!34 = !{!12, !7, i64 47}
!35 = !{!15, !14, i64 58}
!36 = !{!12, !14, i64 68}
!37 = !{!15, !10, i64 60}
!38 = !{!12, !10, i64 70}
!39 = !{!15, !7, i64 64}
!40 = !{!12, !7, i64 74}
!41 = !{!15, !7, i64 65}
!42 = !{!12, !7, i64 75}
!43 = !{!15, !7, i64 66}
!44 = !{!12, !7, i64 76}
!45 = !{!15, !10, i64 67}
!46 = !{!12, !10, i64 77}
!47 = !{!48, !48, i64 0}
!48 = !{!"long long", !7, i64 0}
!49 = !{!50, !10, i64 6}
!50 = !{!"", !51, i64 0}
!51 = !{!"tdTPM_RSP_COMMAND_HDR", !14, i64 0, !10, i64 2, !10, i64 6}


; 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.TPM_CMD_NV_DEFINE_SPACE = type { %struct.tdTPM_RQU_COMMAND_HDR, %struct.TPM12_NV_DATA_PUBLIC, [20 x i8] }
%struct.tdTPM_RQU_COMMAND_HDR = type <{ i16, i32, i32 }>
%struct.TPM12_NV_DATA_PUBLIC = type <{ i16, i32, %struct.TPM12_PCR_INFO_SHORT, %struct.TPM12_PCR_INFO_SHORT, %struct.tdTPM_NV_ATTRIBUTES, i8, i8, i8, i32 }>
%struct.TPM12_PCR_INFO_SHORT = type { %struct.TPM12_PCR_SELECTION, i8, %struct.tdTPM_DIGEST }
%struct.TPM12_PCR_SELECTION = type <{ i16, [3 x i8] }>
%struct.tdTPM_DIGEST = type { [20 x i8] }
%struct.tdTPM_NV_ATTRIBUTES = type <{ i16, i32 }>
%struct.TPM_RSP_NV_DEFINE_SPACE = type { %struct.tdTPM_RSP_COMMAND_HDR }
%struct.tdTPM_RSP_COMMAND_HDR = type <{ i16, i32, i32 }>

@.str = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Tpm12NvDefineSpace(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca %struct.TPM_CMD_NV_DEFINE_SPACE, align 2
  %5 = alloca %struct.TPM_RSP_NV_DEFINE_SPACE, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %5) #3
  store i32 10, ptr %3, align 4, !tbaa !5
  %6 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext 193) #3
  store i16 %6, ptr %4, align 2, !tbaa !9
  %7 = tail call i32 @SwapBytes32(i32 noundef 101) #3
  %8 = getelementptr inbounds i8, ptr %4, i64 2
  store i32 %7, ptr %8, align 2, !tbaa !18
  %9 = tail call i32 @SwapBytes32(i32 noundef 204) #3
  %10 = getelementptr inbounds i8, ptr %4, i64 6
  store i32 %9, ptr %10, align 2, !tbaa !19
  %11 = load i16, ptr %0, align 1, !tbaa !20
  %12 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext %11) #3
  %13 = getelementptr inbounds i8, ptr %4, i64 10
  store i16 %12, ptr %13, align 2, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %0, i64 2
  %15 = load i32, ptr %14, align 1, !tbaa !22
  %16 = tail call i32 @SwapBytes32(i32 noundef %15) #3
  %17 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 %16, ptr %17, align 2, !tbaa !23
  %18 = getelementptr inbounds i8, ptr %0, i64 6
  %19 = load i16, ptr %18, align 1, !tbaa !24
  %20 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext %19) #3
  %21 = getelementptr inbounds i8, ptr %4, i64 16
  store i16 %20, ptr %21, align 2, !tbaa !25
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = getelementptr inbounds i8, ptr %4, i64 18
  %24 = load <4 x i8>, ptr %22, align 1, !tbaa !26
  store <4 x i8> %24, ptr %23, align 2, !tbaa !26
  %25 = getelementptr inbounds i8, ptr %4, i64 22
  %26 = getelementptr inbounds i8, ptr %0, i64 12
  %27 = call ptr @CopyMem(ptr noundef nonnull %25, ptr noundef nonnull %26, i64 noundef 20) #3
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load i16, ptr %28, align 1, !tbaa !27
  %30 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %29) #3
  %31 = getelementptr inbounds i8, ptr %4, i64 42
  store i16 %30, ptr %31, align 2, !tbaa !28
  %32 = getelementptr inbounds i8, ptr %0, i64 34
  %33 = getelementptr inbounds i8, ptr %4, i64 44
  %34 = load <4 x i8>, ptr %32, align 1, !tbaa !26
  store <4 x i8> %34, ptr %33, align 2, !tbaa !26
  %35 = getelementptr inbounds i8, ptr %4, i64 48
  %36 = getelementptr inbounds i8, ptr %0, i64 38
  %37 = call ptr @CopyMem(ptr noundef nonnull %35, ptr noundef nonnull %36, i64 noundef 20) #3
  %38 = getelementptr inbounds i8, ptr %0, i64 58
  %39 = load i16, ptr %38, align 1, !tbaa !29
  %40 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %39) #3
  %41 = getelementptr inbounds i8, ptr %4, i64 68
  store i16 %40, ptr %41, align 2, !tbaa !30
  %42 = getelementptr inbounds i8, ptr %0, i64 60
  %43 = load i32, ptr %42, align 1, !tbaa !31
  %44 = call i32 @SwapBytes32(i32 noundef %43) #3
  %45 = getelementptr inbounds i8, ptr %4, i64 70
  store i32 %44, ptr %45, align 2, !tbaa !32
  %46 = getelementptr inbounds i8, ptr %0, i64 64
  %47 = load i8, ptr %46, align 1, !tbaa !33
  %48 = getelementptr inbounds i8, ptr %4, i64 74
  store i8 %47, ptr %48, align 2, !tbaa !34
  %49 = getelementptr inbounds i8, ptr %0, i64 65
  %50 = load i8, ptr %49, align 1, !tbaa !35
  %51 = getelementptr inbounds i8, ptr %4, i64 75
  store i8 %50, ptr %51, align 1, !tbaa !36
  %52 = getelementptr inbounds i8, ptr %0, i64 66
  %53 = load i8, ptr %52, align 1, !tbaa !37
  %54 = getelementptr inbounds i8, ptr %4, i64 76
  store i8 %53, ptr %54, align 2, !tbaa !38
  %55 = getelementptr inbounds i8, ptr %0, i64 67
  %56 = load i32, ptr %55, align 1, !tbaa !39
  %57 = call i32 @SwapBytes32(i32 noundef %56) #3
  %58 = getelementptr inbounds i8, ptr %4, i64 77
  store i32 %57, ptr %58, align 1, !tbaa !40
  %59 = getelementptr inbounds i8, ptr %4, i64 81
  %60 = call ptr @CopyMem(ptr noundef nonnull %59, ptr noundef %1, i64 noundef 20) #3
  %61 = call i64 @Tpm12SubmitCommand(i32 noundef 101, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %5) #3
  %62 = icmp slt i64 %61, 0
  br i1 %62, label %72, label %63

63:                                               ; preds = %2
  %64 = getelementptr inbounds i8, ptr %5, i64 6
  %65 = load i32, ptr %64, align 1, !tbaa !41
  %66 = call i32 @SwapBytes32(i32 noundef %65) #3
  %67 = call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %67, 0
  br i1 %.not, label %71, label %68

68:                                               ; preds = %63
  %69 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not27 = icmp eq i8 %69, 0
  br i1 %.not27, label %71, label %70

70:                                               ; preds = %68
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str, i32 noundef %66) #3
  br label %71

71:                                               ; preds = %68, %70, %63
  %cond = icmp eq i32 %66, 0
  %. = select i1 %cond, i64 0, i64 -9223372036854775801
  br label %72

72:                                               ; preds = %71, %2
  %.0 = phi i64 [ %61, %2 ], [ %., %71 ]
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  ret i64 %.0
}

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

declare zeroext i16 @SwapBytes16(i16 noundef zeroext) local_unnamed_addr #2

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #2

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) local_unnamed_addr #2

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 0}
!10 = !{!"", !11, i64 0, !13, i64 10, !7, i64 81}
!11 = !{!"tdTPM_RQU_COMMAND_HDR", !12, i64 0, !6, i64 2, !6, i64 6}
!12 = !{!"short", !7, i64 0}
!13 = !{!"", !12, i64 0, !6, i64 2, !14, i64 6, !14, i64 32, !17, i64 58, !7, i64 64, !7, i64 65, !7, i64 66, !6, i64 67}
!14 = !{!"", !15, i64 0, !7, i64 5, !16, i64 6}
!15 = !{!"", !12, i64 0, !7, i64 2}
!16 = !{!"tdTPM_DIGEST", !7, i64 0}
!17 = !{!"tdTPM_NV_ATTRIBUTES", !12, i64 0, !6, i64 2}
!18 = !{!10, !6, i64 2}
!19 = !{!10, !6, i64 6}
!20 = !{!13, !12, i64 0}
!21 = !{!10, !12, i64 10}
!22 = !{!13, !6, i64 2}
!23 = !{!10, !6, i64 12}
!24 = !{!13, !12, i64 6}
!25 = !{!10, !12, i64 16}
!26 = !{!7, !7, i64 0}
!27 = !{!13, !12, i64 32}
!28 = !{!10, !12, i64 42}
!29 = !{!13, !12, i64 58}
!30 = !{!10, !12, i64 68}
!31 = !{!13, !6, i64 60}
!32 = !{!10, !6, i64 70}
!33 = !{!13, !7, i64 64}
!34 = !{!10, !7, i64 74}
!35 = !{!13, !7, i64 65}
!36 = !{!10, !7, i64 75}
!37 = !{!13, !7, i64 66}
!38 = !{!10, !7, i64 76}
!39 = !{!13, !6, i64 67}
!40 = !{!10, !6, i64 77}
!41 = !{!42, !6, i64 6}
!42 = !{!"", !43, i64 0}
!43 = !{!"tdTPM_RSP_COMMAND_HDR", !12, i64 0, !6, i64 2, !6, i64 6}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass