def next_argument(self, isfloat, size, signed):
        if size == -1:
            size = 8

        if isfloat:
            float_state = self.tracer.floating_register_state
            if self.float_argument_registers and size == 8:
                argument_name = self.float_argument_registers.pop(0)
                bytes = getattr(float_state, argument_name).xmm_reg
                value = ctypes.string_at(ctypes.pointer(bytes), 16)
                return struct.unpack('d', value[:8])[0]
            else:
                raw = self.tracer.read_memory(self.stack_argument_address,
                                              size)
                if size in (4, 8):
                    self.stack_argument_address += 8
                    return struct.unpack("f" if size == 4 else "d", raw)[0]
                elif size == 10:
                    self.stack_argument_address += 16
                    return util.unpack_long_double(raw)
                else:
                    raise NotImplementedError('Unknown type')
        else:
            if self.int_argument_registers:
                registers = self.tracer.general_register_state
                raw = getattr(registers, self.int_argument_registers.pop(0))
                return util.convert_int(raw, size, signed)
            else:
                address = self.stack_argument_address
                raw = self.tracer.read_struct(address, "Q")[0]
                value = util.convert_int(raw, size, signed)
                self.stack_argument_address += 8
                return value
    def get_return_value(self, isfloat, size, signed):
        if size == -1:
            size = 8

        if isfloat:
            return self.get_float_return_value(size)
        else:
            raw = self.tracer.general_register_state.rax
            return util.convert_int(raw, size, signed)
    def next_argument(self, isfloat, size, signed):
        if size == -1:
            size = 4

        if isfloat:
            value = self.tracer.read_memory(self.current_argument, size)
            if size == 4:
                self.current_argument += 4
                return struct.unpack("f", value)[0]
            elif size == 8:
                self.current_argument += 8
                return struct.unpack("d", value)[0]
            elif size == 10:
                self.current_argument += 16
                return util.unpack_long_double(value)
            else:
                raise NotImplementedError('Unknown type')
        else:
            raw = self.tracer.read_struct(self.current_argument, "I")[0]
            value = util.convert_int(raw, size, signed)
            self.current_argument += 4
            return value