You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: raytracing.rs
    path of file: ./repos/ZLUDA/ptx/src
    
    the code of the file until where you have to start completion: // Bulk of the work for raytracing is done across those three transformations:
// * Bounding box needs to convert result pointer from 6xfloat format to
//   8xfloat format. This is done with a very narrow and brittle transformation
//   that looks for very specific assembly instructions
// * Conversions that change state space. This is mostly global -> local
//   conversion and we don't have a way to generically convert argument
//   form one state space to another. So we check only for obvious ones (ld/st).
//   This category splits into two subcategories:
//   * Variables with internally provided semantics (rtLaunchIndex and such),
//     those variables are function arguments, so we convert the instruction
//     state space
//   * Variables with user-provided attributes, they need additional function
//     call to adjust the pointer to use the specific variable
// * Conversion that preserves state space. This is robust and is done only for
//   a pointer to a variable block (so with insertion of variable pointer
//   calculation)

use cpp_demangle::{BorrowedSymbol, DemangleOptions};
use hip_common::raytracing::{Variable, VariablesBlock};
use rustc_hash::{FxHashMap, FxHashSet};
use std::{
    alloc::Layout,
    borrow::Cow,
    cmp,
    collections::BTreeMap,
    convert,
    ffi::{c_void, CStr, CString},
    mem,
};

use crate::{
    ast::{self, VariableDeclaration},
    translate::{
        self, ArgumentDescriptor, BrachCondition, CallGraph, ConstType, ConstantDefinition,
        ExpandedArgParams, ExpandedStatement, Id, IdGenerator, IdNameMapBuilder, LoadVarDetails,
        NormalizedArgParams, PtrAccess, RaytracingEntryPointKind, RaytracingTranslationState,
        RepackVectorDetails, ResolvedCall, Statement, StoreVarDetails, TranslationDirective,
        TranslationMethod, TranslationModule, TypedArgParams, TypedOperand, Visitable,
    },
    TranslateError,
};

static ZLUDA_RT_PTX_IMPL_AMD: &'static [u8] = include_bytes!("../lib/zluda_rt_ptx_impl.bc");
static KERNEL_SOURCE: &'static str = include_str!("../lib/raytracing.cpp");
static KERNEL_HEADER: &'static str = include_str!("../lib/raytracing.hpp");
static KERNEL_SOURCE_BOUNDING_BOX: &'static str =
    include_str!("../lib/raytracing_bounding_box.cpp");
static KERNEL_SOURCE_INTERSECT: &'static str = include_str!("../lib/raytracing_intersect.cpp");
static KERNEL_SOURCE_CALLAB
    
    fn get_type_space(self) -> (ast::Type, ast::StateSpace) {
        match self {
            InjectedArgument::GlobalState => (
                ast::Type::Scalar(ast::ScalarType::B8),
                ast::StateSpace::Shared,
            ),
            InjectedArgument::PrimitiveIndex => (
                ast::Type::Scalar(ast::ScalarType::B32),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::LaunchIndex | InjectedArgument::LaunchDim => (
                ast::Type::Vector(ast::ScalarType::B32, 2),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::CurrentRay => (
                ast::Type::Array(ast::ScalarType::B8, vec![36]),
                ast::StateSpace::Local,
            ),
            InjectedArgument::CurrentTime => (
                ast::Type::Scalar(ast::ScalarType::F32),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::Payload => (
                ast::Type::Scalar(ast::ScalarType::B8),
                ast::StateSpace::Local,
            ),
            InjectedArgument::TriangleBarycentrics => (
                ast::Type::Vector(ast::ScalarType::F32, 2),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::TriangleNormals => (
                ast::Type::Vector(ast::ScalarType::F32, 3),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::VariablesBlock => (
                ast::Type::Scalar(ast::ScalarType::B8),
                ast::StateSpace::Global,
            ),
            InjectedArgument::AttributesBlock => (
                ast::Type::Scalar(ast::ScalarType::B8),
                ast::StateSpace::Global,
            ),
            InjectedArgument::TransformBlock => (
                ast::Type::Scalar(ast::ScalarType::B8),
                ast::StateSpace::Global,
            ),
            InjectedArgument::NewDistance => (
                ast::Type::Scalar(ast::ScalarType::F32),
                ast::StateSpace::Local,
            ),
            InjectedArgument::IntersectionResult => (
                ast::Type::Scalar(ast::ScalarType::B32),
                ast::StateSpace::Local,
            ),
            InjectedArgument::IntersectionDistance => (
                ast::Type::Scalar(ast::ScalarType::F32),
                ast::StateSpace::Reg,
            ),
            InjectedArgument::MaterialResult => (
                ast::Type::Scalar(ast::ScalarType::B32),
                ast::StateSpace::Local,
            ),
            InjectedArgument::_Count => unreachable!(),
        }
    }