; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/I2c (I2cHostQueueRequest)

; 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.I2C_HOST_CONTEXT = type { i64, i64, ptr, ptr, i64, i8, %struct._LIST_ENTRY, %struct._EFI_I2C_HOST_PROTOCOL, ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._EFI_I2C_HOST_PROTOCOL = type { ptr, ptr }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct.I2C_REQUEST = type { i32, %struct._LIST_ENTRY, i64, i64, ptr, ptr, ptr }
%struct.EFI_I2C_REQUEST_PACKET = type { i64, [1 x %struct.EFI_I2C_OPERATION] }
%struct.EFI_I2C_OPERATION = type { i32, i32, ptr }

@gBS = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [139 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [42 x i8], align 1

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

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

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

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

declare ptr @AllocateZeroPool(i64 noundef) #1

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

25:                                               ; preds = %6
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

26:                                               ; preds = %6
  %27 = load i64, ptr %10, align 8, !tbaa !9
  %28 = and i64 %27, 2147483648
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  store i64 10, ptr %21, align 8, !tbaa !9
  br label %32

31:                                               ; preds = %26
  store i64 7, ptr %21, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %31, %30
  %33 = load i64, ptr %10, align 8, !tbaa !9
  %34 = trunc i64 %33 to i32
  %35 = load i64, ptr %21, align 8, !tbaa !9
  %36 = call i32 @BitFieldRead32(i32 noundef %34, i64 noundef %35, i64 noundef 30)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  store i64 -9223372036854775794, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

39:                                               ; preds = %32
  %40 = call zeroext i8 @DebugAssertEnabled()
  %41 = zext i8 %40 to i32
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %53

43:                                               ; preds = %39
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = ptrtoint ptr %44 to i64
  %46 = sub i64 %45, ptrtoint (ptr getelementptr inbounds (%struct.I2C_HOST_CONTEXT, ptr null, i32 0, i32 7) to i64)
  %47 = inttoptr i64 %46 to ptr
  %48 = getelementptr inbounds %struct.I2C_HOST_CONTEXT, ptr %47, i32 0, i32 0
  %49 = load i64, ptr %48, align 8, !tbaa !12
  %50 = icmp ne i64 %49, 1212363337
  br i1 %50, label %51, label %53

51:                                               ; preds = %43
  call void @DebugAssert(ptr noundef @.str.12, i64 noundef 964, ptr noundef @.str.13)
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  br label %58

53:                                               ; preds = %43, %39
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = ptrtoint ptr %54 to i64
  %56 = sub i64 %55, ptrtoint (ptr getelementptr inbounds (%struct.I2C_HOST_CONTEXT, ptr null, i32 0, i32 7) to i64)
  %57 = inttoptr i64 %56 to ptr
  br label %58

58:                                               ; preds = %53, %51
  %59 = phi ptr [ %52, %51 ], [ %57, %53 ]
  store ptr %59, ptr %18, align 8, !tbaa !5
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %72

62:                                               ; preds = %58
  %63 = load ptr, ptr @gBS, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %63, i32 0, i32 8
  %65 = load ptr, ptr %64, align 8, !tbaa !16
  %66 = call i64 %65(i32 noundef 0, i64 noundef 16, ptr noundef null, ptr noundef null, ptr noundef %15)
  store i64 %66, ptr %14, align 8, !tbaa !9
  %67 = load i64, ptr %14, align 8, !tbaa !9
  %68 = icmp slt i64 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %62
  %70 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %70, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

71:                                               ; preds = %62
  br label %72

72:                                               ; preds = %71, %58
  %73 = call i64 @EfiGetCurrentTpl()
  store i64 %73, ptr %16, align 8, !tbaa !9
  %74 = load i64, ptr %16, align 8, !tbaa !9
  %75 = icmp ugt i64 %74, 16
  br i1 %75, label %82, label %76

76:                                               ; preds = %72
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %98

79:                                               ; preds = %76
  %80 = load i64, ptr %16, align 8, !tbaa !9
  %81 = icmp ugt i64 %80, 8
  br i1 %81, label %82, label %98

82:                                               ; preds = %79, %72
  br label %83

83:                                               ; preds = %82
  %84 = call zeroext i8 @DebugPrintEnabled()
  %85 = icmp ne i8 %84, 0
  br i1 %85, label %86, label %95

86:                                               ; preds = %83
  br label %87

87:                                               ; preds = %86
  %88 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %89 = icmp ne i8 %88, 0
  br i1 %89, label %90, label %92

90:                                               ; preds = %87
  %91 = load i64, ptr %16, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.15, i64 noundef %91)
  br label %92

92:                                               ; preds = %90, %87
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94, %83
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

98:                                               ; preds = %79, %76
  %99 = call ptr @AllocateZeroPool(i64 noundef 64)
  store ptr %99, ptr %17, align 8, !tbaa !5
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %117

102:                                              ; preds = %98
  br label %103

103:                                              ; preds = %102
  %104 = call zeroext i8 @DebugPrintEnabled()
  %105 = icmp ne i8 %104, 0
  br i1 %105, label %106, label %114

106:                                              ; preds = %103
  br label %107

107:                                              ; preds = %106
  %108 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %109 = icmp ne i8 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %107
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.16)
  br label %111

111:                                              ; preds = %110, %107
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113, %103
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  store i64 -9223372036854775799, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

117:                                              ; preds = %98
  %118 = load ptr, ptr %17, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.I2C_REQUEST, ptr %118, i32 0, i32 0
  store i32 1380135497, ptr %119, align 8, !tbaa !20
  %120 = load i64, ptr %9, align 8, !tbaa !9
  %121 = load ptr, ptr %17, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.I2C_REQUEST, ptr %121, i32 0, i32 2
  store i64 %120, ptr %122, align 8, !tbaa !22
  %123 = load i64, ptr %10, align 8, !tbaa !9
  %124 = load ptr, ptr %17, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.I2C_REQUEST, ptr %124, i32 0, i32 3
  store i64 %123, ptr %125, align 8, !tbaa !23
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %130

128:                                              ; preds = %117
  %129 = load ptr, ptr %15, align 8, !tbaa !5
  br label %132

130:                                              ; preds = %117
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  br label %132

132:                                              ; preds = %130, %128
  %133 = phi ptr [ %129, %128 ], [ %131, %130 ]
  %134 = load ptr, ptr %17, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.I2C_REQUEST, ptr %134, i32 0, i32 4
  store ptr %133, ptr %135, align 8, !tbaa !24
  %136 = load ptr, ptr %13, align 8, !tbaa !5
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.I2C_REQUEST, ptr %137, i32 0, i32 6
  store ptr %136, ptr %138, align 8, !tbaa !25
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.EFI_I2C_REQUEST_PACKET, ptr %139, i32 0, i32 0
  %141 = load i64, ptr %140, align 8, !tbaa !26
  %142 = mul i64 %141, 16
  %143 = add i64 8, %142
  store i64 %143, ptr %20, align 8, !tbaa !9
  %144 = load i64, ptr %20, align 8, !tbaa !9
  %145 = call ptr @AllocateZeroPool(i64 noundef %144)
  %146 = load ptr, ptr %17, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.I2C_REQUEST, ptr %146, i32 0, i32 5
  store ptr %145, ptr %147, align 8, !tbaa !28
  br label %148

148:                                              ; preds = %132
  %149 = call zeroext i8 @DebugAssertEnabled()
  %150 = icmp ne i8 %149, 0
  br i1 %150, label %151, label %158

151:                                              ; preds = %148
  %152 = load ptr, ptr %17, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.I2C_REQUEST, ptr %152, i32 0, i32 5
  %154 = load ptr, ptr %153, align 8, !tbaa !28
  %155 = icmp ne ptr %154, null
  br i1 %155, label %157, label %156

156:                                              ; preds = %151
  call void @DebugAssert(ptr noundef @.str.12, i64 noundef 1015, ptr noundef @.str.17)
  br label %157

157:                                              ; preds = %156, %151
  br label %158

158:                                              ; preds = %157, %148
  br label %159

159:                                              ; preds = %158
  br label %160

160:                                              ; preds = %159
  %161 = load ptr, ptr %17, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.I2C_REQUEST, ptr %161, i32 0, i32 5
  %163 = load ptr, ptr %162, align 8, !tbaa !28
  %164 = load ptr, ptr %12, align 8, !tbaa !5
  %165 = load i64, ptr %20, align 8, !tbaa !9
  %166 = call ptr @CopyMem(ptr noundef %163, ptr noundef %164, i64 noundef %165)
  %167 = load ptr, ptr @gBS, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %167, i32 0, i32 1
  %169 = load ptr, ptr %168, align 8, !tbaa !29
  %170 = call i64 %169(i64 noundef 16)
  %171 = load ptr, ptr %18, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.I2C_HOST_CONTEXT, ptr %171, i32 0, i32 6
  %173 = call zeroext i8 @IsListEmpty(ptr noundef %172)
  store i8 %173, ptr %19, align 1, !tbaa !11
  %174 = load ptr, ptr %18, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.I2C_HOST_CONTEXT, ptr %174, i32 0, i32 6
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.I2C_REQUEST, ptr %176, i32 0, i32 1
  %178 = call ptr @InsertTailList(ptr noundef %175, ptr noundef %177)
  %179 = load ptr, ptr @gBS, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %179, i32 0, i32 2
  %181 = load ptr, ptr %180, align 8, !tbaa !30
  %182 = load i64, ptr %16, align 8, !tbaa !9
  call void %181(i64 noundef %182)
  %183 = load i8, ptr %19, align 1, !tbaa !11
  %184 = icmp ne i8 %183, 0
  br i1 %184, label %185, label %188

185:                                              ; preds = %160
  %186 = load ptr, ptr %18, align 8, !tbaa !5
  %187 = call i64 @I2cHostRequestEnable(ptr noundef %186)
  store i64 %187, ptr %14, align 8, !tbaa !9
  br label %188

188:                                              ; preds = %185, %160
  %189 = load ptr, ptr %11, align 8, !tbaa !5
  %190 = icmp ne ptr %189, null
  br i1 %190, label %191, label %192

191:                                              ; preds = %188
  store i64 0, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

192:                                              ; preds = %188
  br label %193

193:                                              ; preds = %199, %192
  %194 = load ptr, ptr @gBS, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %194, i32 0, i32 13
  %196 = load ptr, ptr %195, align 8, !tbaa !31
  %197 = load ptr, ptr %15, align 8, !tbaa !5
  %198 = call i64 %196(ptr noundef %197)
  store i64 %198, ptr %14, align 8, !tbaa !9
  br label %199

199:                                              ; preds = %193
  %200 = load i64, ptr %14, align 8, !tbaa !9
  %201 = icmp eq i64 %200, -9223372036854775802
  br i1 %201, label %193, label %202, !llvm.loop !32

202:                                              ; preds = %199
  %203 = load ptr, ptr %18, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.I2C_HOST_CONTEXT, ptr %203, i32 0, i32 4
  %205 = load i64, ptr %204, align 8, !tbaa !34
  store i64 %205, ptr %14, align 8, !tbaa !9
  %206 = load ptr, ptr %13, align 8, !tbaa !5
  %207 = icmp ne ptr %206, null
  br i1 %207, label %208, label %211

208:                                              ; preds = %202
  %209 = load i64, ptr %14, align 8, !tbaa !9
  %210 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 %209, ptr %210, align 8, !tbaa !9
  br label %211

211:                                              ; preds = %208, %202
  %212 = load ptr, ptr %15, align 8, !tbaa !5
  %213 = icmp ne ptr %212, null
  br i1 %213, label %214, label %220

214:                                              ; preds = %211
  %215 = load ptr, ptr @gBS, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %215, i32 0, i32 12
  %217 = load ptr, ptr %216, align 8, !tbaa !35
  %218 = load ptr, ptr %15, align 8, !tbaa !5
  %219 = call i64 %217(ptr noundef %218)
  br label %220

220:                                              ; preds = %214, %211
  %221 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %221, ptr %7, align 8
  store i32 1, ptr %22, align 4
  br label %222

222:                                              ; preds = %220, %191, %116, %97, %69, %38, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %223 = load i64, ptr %7, align 8
  ret i64 %223
}

declare i64 @EfiGetCurrentTpl() #1

declare zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #1

declare zeroext i8 @IsListEmpty(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @I2cHostRequestEnable(ptr noundef) #2

declare i32 @BitFieldRead32(i32 noundef, i64 noundef, i64 noundef) #1

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

declare ptr @InsertTailList(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { 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 #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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 0}
!13 = !{!"", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !7, i64 40, !14, i64 48, !15, i64 64, !6, i64 80, !6, i64 88}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"_EFI_I2C_HOST_PROTOCOL", !6, i64 0, !6, i64 8}
!16 = !{!17, !6, i64 80}
!17 = !{!"", !18, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!18 = !{!"", !10, i64 0, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20}
!19 = !{!"int", !7, i64 0}
!20 = !{!21, !19, i64 0}
!21 = !{!"", !19, i64 0, !14, i64 8, !10, i64 24, !10, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!22 = !{!21, !10, i64 24}
!23 = !{!21, !10, i64 32}
!24 = !{!21, !6, i64 40}
!25 = !{!21, !6, i64 56}
!26 = !{!27, !10, i64 0}
!27 = !{!"", !10, i64 0, !7, i64 8}
!28 = !{!21, !6, i64 48}
!29 = !{!17, !6, i64 24}
!30 = !{!17, !6, i64 32}
!31 = !{!17, !6, i64 120}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!13, !10, i64 32}
!35 = !{!17, !6, i64 112}


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

@gBS = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [139 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [42 x i8], align 1

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

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

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

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @I2cHostQueueRequest(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  %8 = icmp eq ptr %4, null
  br i1 %8, label %91, label %9

9:                                                ; preds = %6
  %10 = and i64 %2, 2147483648
  %.not = icmp eq i64 %10, 0
  %. = select i1 %.not, i64 7, i64 10
  %11 = trunc i64 %2 to i32
  %12 = tail call i32 @BitFieldRead32(i32 noundef %11, i64 noundef %., i64 noundef 30) #3
  %.not53 = icmp eq i32 %12, 0
  br i1 %.not53, label %13, label %91

13:                                               ; preds = %9
  %14 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not54 = icmp eq i8 %14, 0
  %.pre68 = ptrtoint ptr %0 to i64
  %.pre69 = add i64 %.pre68, -64
  %.pre71 = inttoptr i64 %.pre69 to ptr
  br i1 %.not54, label %._crit_edge, label %15

15:                                               ; preds = %13
  %16 = load i64, ptr %.pre71, align 8, !tbaa !9
  %.not55 = icmp eq i64 %16, 1212363337
  br i1 %.not55, label %._crit_edge, label %17

17:                                               ; preds = %15
  tail call void @DebugAssert(ptr noundef nonnull @.str.12, i64 noundef 964, ptr noundef nonnull @.str.13) #3
  br label %._crit_edge

._crit_edge:                                      ; preds = %13, %15, %17
  %18 = phi ptr [ %0, %17 ], [ %.pre71, %15 ], [ %.pre71, %13 ]
  %19 = icmp eq ptr %3, null
  br i1 %19, label %20, label %26

20:                                               ; preds = %._crit_edge
  %21 = load ptr, ptr @gBS, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 80
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = call i64 %23(i32 noundef 0, i64 noundef 16, ptr noundef null, ptr noundef null, ptr noundef nonnull %7) #3
  %25 = icmp slt i64 %24, 0
  br i1 %25, label %91, label %26

26:                                               ; preds = %20, %._crit_edge
  %27 = call i64 @EfiGetCurrentTpl() #3
  %28 = icmp ugt i64 %27, 16
  %29 = icmp ugt i64 %27, 8
  %or.cond = and i1 %19, %29
  %or.cond66 = or i1 %28, %or.cond
  br i1 %or.cond66, label %30, label %35

30:                                               ; preds = %26
  %31 = call zeroext i8 @DebugPrintEnabled() #3
  %.not64 = icmp eq i8 %31, 0
  br i1 %.not64, label %91, label %32

32:                                               ; preds = %30
  %33 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not65 = icmp eq i8 %33, 0
  br i1 %.not65, label %91, label %34

34:                                               ; preds = %32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.15, i64 noundef %27) #3
  br label %91

35:                                               ; preds = %26
  %36 = call ptr @AllocateZeroPool(i64 noundef 64) #3
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %43

38:                                               ; preds = %35
  %39 = call zeroext i8 @DebugPrintEnabled() #3
  %.not62 = icmp eq i8 %39, 0
  br i1 %.not62, label %91, label %40

40:                                               ; preds = %38
  %41 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not63 = icmp eq i8 %41, 0
  br i1 %.not63, label %91, label %42

42:                                               ; preds = %40
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.16) #3
  br label %91

43:                                               ; preds = %35
  store i32 1380135497, ptr %36, align 8, !tbaa !18
  %44 = getelementptr inbounds i8, ptr %36, i64 24
  store i64 %1, ptr %44, align 8, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %36, i64 32
  store i64 %2, ptr %45, align 8, !tbaa !21
  %46 = load ptr, ptr %7, align 8
  %47 = select i1 %19, ptr %46, ptr %3
  %48 = getelementptr inbounds i8, ptr %36, i64 40
  store ptr %47, ptr %48, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %36, i64 56
  store ptr %5, ptr %49, align 8, !tbaa !23
  %50 = load i64, ptr %4, align 8, !tbaa !24
  %51 = shl i64 %50, 4
  %52 = or disjoint i64 %51, 8
  %53 = call ptr @AllocateZeroPool(i64 noundef %52) #3
  %54 = getelementptr inbounds i8, ptr %36, i64 48
  store ptr %53, ptr %54, align 8, !tbaa !26
  %55 = call zeroext i8 @DebugAssertEnabled() #3
  %.not56 = icmp ne i8 %55, 0
  %.pre67 = load ptr, ptr %54, align 8, !tbaa !26
  %.not57 = icmp eq ptr %.pre67, null
  %or.cond73 = select i1 %.not56, i1 %.not57, i1 false
  br i1 %or.cond73, label %56, label %57

56:                                               ; preds = %43
  call void @DebugAssert(ptr noundef nonnull @.str.12, i64 noundef 1015, ptr noundef nonnull @.str.17) #3
  %.pre = load ptr, ptr %54, align 8, !tbaa !26
  br label %57

57:                                               ; preds = %56, %43
  %58 = phi ptr [ %.pre, %56 ], [ %.pre67, %43 ]
  %59 = call ptr @CopyMem(ptr noundef %58, ptr noundef nonnull %4, i64 noundef %52) #3
  %60 = load ptr, ptr @gBS, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 24
  %62 = load ptr, ptr %61, align 8, !tbaa !27
  %63 = call i64 %62(i64 noundef 16) #3
  %64 = getelementptr inbounds i8, ptr %18, i64 48
  %65 = call zeroext i8 @IsListEmpty(ptr noundef nonnull %64) #3
  %66 = getelementptr inbounds i8, ptr %36, i64 8
  %67 = call ptr @InsertTailList(ptr noundef nonnull %64, ptr noundef nonnull %66) #3
  %68 = load ptr, ptr @gBS, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 32
  %70 = load ptr, ptr %69, align 8, !tbaa !28
  call void %70(i64 noundef %27) #3
  %.not58 = icmp eq i8 %65, 0
  br i1 %.not58, label %73, label %71

71:                                               ; preds = %57
  %72 = call i64 @I2cHostRequestEnable(ptr noundef %18)
  br label %73

73:                                               ; preds = %71, %57
  br i1 %19, label %.preheader, label %91

.preheader:                                       ; preds = %73, %.preheader
  %74 = load ptr, ptr @gBS, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i64 120
  %76 = load ptr, ptr %75, align 8, !tbaa !29
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = call i64 %76(ptr noundef %77) #3
  %79 = icmp eq i64 %78, -9223372036854775802
  br i1 %79, label %.preheader, label %80, !llvm.loop !30

80:                                               ; preds = %.preheader
  %81 = getelementptr inbounds i8, ptr %18, i64 32
  %82 = load i64, ptr %81, align 8, !tbaa !32
  %.not60 = icmp eq ptr %5, null
  br i1 %.not60, label %84, label %83

83:                                               ; preds = %80
  store i64 %82, ptr %5, align 8, !tbaa !33
  br label %84

84:                                               ; preds = %83, %80
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %.not61 = icmp eq ptr %85, null
  br i1 %.not61, label %91, label %86

86:                                               ; preds = %84
  %87 = load ptr, ptr @gBS, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 112
  %89 = load ptr, ptr %88, align 8, !tbaa !34
  %90 = call i64 %89(ptr noundef nonnull %85) #3
  br label %91

91:                                               ; preds = %84, %86, %73, %38, %42, %40, %30, %34, %32, %20, %9, %6
  %.046 = phi i64 [ -9223372036854775806, %6 ], [ -9223372036854775794, %9 ], [ %24, %20 ], [ -9223372036854775806, %32 ], [ -9223372036854775806, %34 ], [ -9223372036854775806, %30 ], [ -9223372036854775799, %40 ], [ -9223372036854775799, %42 ], [ -9223372036854775799, %38 ], [ 0, %73 ], [ %82, %86 ], [ %82, %84 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  ret i64 %.046
}

declare i64 @EfiGetCurrentTpl() local_unnamed_addr #1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i8 @IsListEmpty(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @I2cHostRequestEnable(ptr noundef) local_unnamed_addr #2

declare i32 @BitFieldRead32(i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

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

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { 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 #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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !7, i64 40, !12, i64 48, !13, i64 64, !6, i64 80, !6, i64 88}
!11 = !{!"long long", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"_EFI_I2C_HOST_PROTOCOL", !6, i64 0, !6, i64 8}
!14 = !{!15, !6, i64 80}
!15 = !{!"", !16, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!16 = !{!"", !11, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !17, i64 0}
!19 = !{!"", !17, i64 0, !12, i64 8, !11, i64 24, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!20 = !{!19, !11, i64 24}
!21 = !{!19, !11, i64 32}
!22 = !{!19, !6, i64 40}
!23 = !{!19, !6, i64 56}
!24 = !{!25, !11, i64 0}
!25 = !{!"", !11, i64 0, !7, i64 8}
!26 = !{!19, !6, i64 48}
!27 = !{!15, !6, i64 24}
!28 = !{!15, !6, i64 32}
!29 = !{!15, !6, i64 120}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!10, !11, i64 32}
!33 = !{!11, !11, i64 0}
!34 = !{!15, !6, i64 112}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass